summaryrefslogtreecommitdiff
path: root/chromium/content/browser/ppapi_plugin_process_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/ppapi_plugin_process_host.cc')
-rw-r--r--chromium/content/browser/ppapi_plugin_process_host.cc53
1 files changed, 28 insertions, 25 deletions
diff --git a/chromium/content/browser/ppapi_plugin_process_host.cc b/chromium/content/browser/ppapi_plugin_process_host.cc
index 794a5a10803..74c6e0f75e2 100644
--- a/chromium/content/browser/ppapi_plugin_process_host.cc
+++ b/chromium/content/browser/ppapi_plugin_process_host.cc
@@ -4,14 +4,19 @@
#include "content/browser/ppapi_plugin_process_host.h"
+#include <stddef.h>
+
#include <string>
+#include <utility>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/macros.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
#include "content/browser/browser_child_process_host_impl.h"
#include "content/browser/plugin_service_impl.h"
#include "content/browser/renderer_host/render_message_filter.h"
@@ -31,6 +36,7 @@
#include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
+#include "content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h"
#include "content/common/sandbox_win.h"
#include "sandbox/win/src/process_mitigations.h"
#include "sandbox/win/src/sandbox_policy.h"
@@ -46,7 +52,10 @@ class PpapiPluginSandboxedProcessLauncherDelegate
PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker,
const PepperPluginInfo& info,
ChildProcessHost* host)
- : info_(info),
+ :
+#if defined(OS_WIN)
+ info_(info),
+#endif // OS_WIN
#if defined(OS_POSIX)
ipc_fd_(host->TakeClientFileDescriptor()),
#endif // OS_POSIX
@@ -59,10 +68,10 @@ class PpapiPluginSandboxedProcessLauncherDelegate
return !is_broker_;
}
- void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override {
+ bool PreSpawnTarget(sandbox::TargetPolicy* policy) override {
if (is_broker_)
- return;
- *success = false;
+ return true;
+
// The Pepper process is as locked-down as a renderer except that it can
// create the server side of Chrome pipes.
sandbox::ResultCode result;
@@ -70,12 +79,13 @@ class PpapiPluginSandboxedProcessLauncherDelegate
sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
L"\\\\.\\pipe\\chrome.*");
if (result != sandbox::SBOX_ALL_OK)
- return;
+ return false;
+
#if !defined(NACL_WIN64)
for (const auto& mime_type : info_.mime_types) {
if (IsWin32kLockdownEnabledForMimeType(mime_type.mime_type)) {
if (!AddWin32kLockdownPolicy(policy))
- return;
+ return false;
break;
}
}
@@ -86,7 +96,7 @@ class PpapiPluginSandboxedProcessLauncherDelegate
if (!sid.empty())
AddAppContainerPolicy(policy, sid.c_str());
- *success = true;
+ return true;
}
#elif defined(OS_POSIX)
@@ -97,7 +107,7 @@ class PpapiPluginSandboxedProcessLauncherDelegate
.GetSwitchValueNative(switches::kPpapiPluginLauncher);
return !is_broker_ && plugin_launcher.empty();
}
- base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); }
+ base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
#endif // OS_WIN
SandboxType GetSandboxType() override {
@@ -105,7 +115,9 @@ class PpapiPluginSandboxedProcessLauncherDelegate
}
private:
+#if defined(OS_WIN)
const PepperPluginInfo& info_;
+#endif // OS_WIN
#if defined(OS_POSIX)
base::ScopedFD ipc_fd_;
#endif // OS_POSIX
@@ -186,7 +198,7 @@ PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost(
// static
void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
int plugin_process_id,
- int32 pp_instance,
+ int32_t pp_instance,
const PepperRendererInstanceData& instance_data) {
for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
if (iter->process_.get() &&
@@ -209,7 +221,7 @@ void PpapiPluginProcessHost::DidCreateOutOfProcessInstance(
// static
void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance(
int plugin_process_id,
- int32 pp_instance) {
+ int32_t pp_instance) {
for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
if (iter->process_.get() &&
iter->process_->GetData().id == plugin_process_id) {
@@ -226,7 +238,7 @@ void PpapiPluginProcessHost::DidDeleteOutOfProcessInstance(
// static
void PpapiPluginProcessHost::OnPluginInstanceThrottleStateChange(
int plugin_process_id,
- int32 pp_instance,
+ int32_t pp_instance,
bool is_throttled) {
for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
if (iter->process_.get() &&
@@ -273,7 +285,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(
const base::FilePath& profile_data_directory)
: profile_data_directory_(profile_data_directory),
is_broker_(false) {
- uint32 base_permissions = info.permissions;
+ uint32_t base_permissions = info.permissions;
// We don't have to do any whitelisting for APIs in this process host, so
// don't bother passing a browser context or document url here.
@@ -293,6 +305,9 @@ PpapiPluginProcessHost::PpapiPluginProcessHost(
filter_ = new PepperMessageFilter();
process_->AddFilter(filter_.get());
process_->GetHost()->AddFilter(host_impl_->message_filter().get());
+#if defined(OS_WIN)
+ process_->AddFilter(new DWriteFontProxyMessageFilter());
+#endif
GetContentClient()->browser()->DidCreatePpapiPlugin(host_impl_.get());
@@ -375,20 +390,8 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) {
// Copy any flash args over and introduce field trials if necessary.
// TODO(vtl): Stop passing flash args in the command line, or windows is
// going to explode.
- std::string field_trial =
- base::FieldTrialList::FindFullName(kFlashHwVideoDecodeFieldTrialName);
std::string existing_args =
browser_command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs);
- if (field_trial == kFlashHwVideoDecodeFieldTrialEnabledName) {
- // Arguments passed to Flash are comma delimited.
- if (!existing_args.empty())
- existing_args.append(",");
- existing_args.append("enable_hw_video_decode=1");
-#if defined(OS_MACOSX)
- // TODO(ihf): Remove this once Flash newer than 15.0.0.223 is released.
- existing_args.append(",enable_hw_video_decode_mac=1");
-#endif
- }
cmd_line->AppendSwitchASCII(switches::kPpapiFlashArgs, existing_args);
}
@@ -460,7 +463,7 @@ bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
}
// Called when the browser <--> plugin channel has been established.
-void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) {
+void PpapiPluginProcessHost::OnChannelConnected(int32_t peer_pid) {
// This will actually load the plugin. Errors will actually not be reported
// back at this point. Instead, the plugin will fail to establish the
// connections when we request them on behalf of the renderer(s).