Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/strings/string_number_conversions.h" | |
|
palmer
2015/09/15 21:43:43
You don't use this.
forshaw
2015/09/16 12:46:57
Used for DoubleToString below.
| |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "content/browser/browser_child_process_host_impl.h" | 15 #include "content/browser/browser_child_process_host_impl.h" |
| 15 #include "content/browser/plugin_service_impl.h" | 16 #include "content/browser/plugin_service_impl.h" |
| 16 #include "content/browser/renderer_host/render_message_filter.h" | 17 #include "content/browser/renderer_host/render_message_filter.h" |
| 17 #include "content/common/child_process_host_impl.h" | 18 #include "content/common/child_process_host_impl.h" |
| 18 #include "content/common/child_process_messages.h" | 19 #include "content/common/child_process_messages.h" |
| 19 #include "content/common/content_switches_internal.h" | 20 #include "content/common/content_switches_internal.h" |
| 20 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
| 21 #include "content/public/common/content_constants.h" | 22 #include "content/public/common/content_constants.h" |
| 22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 23 #include "content/public/common/pepper_plugin_info.h" | 24 #include "content/public/common/pepper_plugin_info.h" |
| 24 #include "content/public/common/process_type.h" | 25 #include "content/public/common/process_type.h" |
| 25 #include "content/public/common/sandbox_type.h" | 26 #include "content/public/common/sandbox_type.h" |
| 26 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 27 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 27 #include "ipc/ipc_switches.h" | 28 #include "ipc/ipc_switches.h" |
| 28 #include "net/base/network_change_notifier.h" | 29 #include "net/base/network_change_notifier.h" |
| 29 #include "ppapi/proxy/ppapi_messages.h" | 30 #include "ppapi/proxy/ppapi_messages.h" |
| 30 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
| 31 | 32 |
| 32 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 33 #include "content/common/sandbox_win.h" | 34 #include "content/common/sandbox_win.h" |
| 34 #include "sandbox/win/src/process_mitigations.h" | 35 #include "sandbox/win/src/process_mitigations.h" |
| 35 #include "sandbox/win/src/sandbox_policy.h" | 36 #include "sandbox/win/src/sandbox_policy.h" |
| 37 #include "ui/gfx/win/dpi.h" | |
| 36 #endif | 38 #endif |
| 37 | 39 |
| 38 namespace content { | 40 namespace content { |
| 39 | 41 |
| 40 // NOTE: changes to this class need to be reviewed by the security team. | 42 // NOTE: changes to this class need to be reviewed by the security team. |
| 41 class PpapiPluginSandboxedProcessLauncherDelegate | 43 class PpapiPluginSandboxedProcessLauncherDelegate |
| 42 : public content::SandboxedProcessLauncherDelegate { | 44 : public content::SandboxedProcessLauncherDelegate { |
| 43 public: | 45 public: |
| 44 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, | 46 PpapiPluginSandboxedProcessLauncherDelegate(bool is_broker, |
| 45 const PepperPluginInfo& info, | 47 const PepperPluginInfo& info, |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 } | 391 } |
| 390 cmd_line->AppendSwitchASCII(switches::kPpapiFlashArgs, existing_args); | 392 cmd_line->AppendSwitchASCII(switches::kPpapiFlashArgs, existing_args); |
| 391 } | 393 } |
| 392 | 394 |
| 393 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); | 395 std::string locale = GetContentClient()->browser()->GetApplicationLocale(); |
| 394 if (!locale.empty()) { | 396 if (!locale.empty()) { |
| 395 // Pass on the locale so the plugin will know what language we're using. | 397 // Pass on the locale so the plugin will know what language we're using. |
| 396 cmd_line->AppendSwitchASCII(switches::kLang, locale); | 398 cmd_line->AppendSwitchASCII(switches::kLang, locale); |
| 397 } | 399 } |
| 398 | 400 |
| 401 #if defined(OS_WIN) | |
| 402 cmd_line->AppendSwitchASCII(switches::kDeviceScaleFactor, | |
| 403 base::DoubleToString(gfx::GetDPIScale())); | |
| 404 #endif | |
| 405 | |
| 399 if (!plugin_launcher.empty()) | 406 if (!plugin_launcher.empty()) |
| 400 cmd_line->PrependWrapper(plugin_launcher); | 407 cmd_line->PrependWrapper(plugin_launcher); |
| 401 | 408 |
| 402 // On posix, never use the zygote for the broker. Also, only use the zygote if | 409 // On posix, never use the zygote for the broker. Also, only use the zygote if |
| 403 // we are not using a plugin launcher - having a plugin launcher means we need | 410 // we are not using a plugin launcher - having a plugin launcher means we need |
| 404 // to use another process instead of just forking the zygote. | 411 // to use another process instead of just forking the zygote. |
| 405 process_->Launch( | 412 process_->Launch( |
| 406 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_, | 413 new PpapiPluginSandboxedProcessLauncherDelegate(is_broker_, |
| 407 info, | 414 info, |
| 408 process_->GetHost()), | 415 process_->GetHost()), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 // sent_requests_ queue should be the one that the plugin just created. | 510 // sent_requests_ queue should be the one that the plugin just created. |
| 504 Client* client = sent_requests_.front(); | 511 Client* client = sent_requests_.front(); |
| 505 sent_requests_.pop(); | 512 sent_requests_.pop(); |
| 506 | 513 |
| 507 const ChildProcessData& data = process_->GetData(); | 514 const ChildProcessData& data = process_->GetData(); |
| 508 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), | 515 client->OnPpapiChannelOpened(channel_handle, base::GetProcId(data.handle), |
| 509 data.id); | 516 data.id); |
| 510 } | 517 } |
| 511 | 518 |
| 512 } // namespace content | 519 } // namespace content |
| OLD | NEW |