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/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/browser/browser_child_process_host_impl.h" | 14 #include "content/browser/browser_child_process_host_impl.h" |
15 #include "content/browser/plugin_service_impl.h" | 15 #include "content/browser/plugin_service_impl.h" |
16 #include "content/browser/renderer_host/render_message_filter.h" | 16 #include "content/browser/renderer_host/render_message_filter.h" |
17 #include "content/common/child_process_host_impl.h" | 17 #include "content/common/child_process_host_impl.h" |
18 #include "content/common/child_process_messages.h" | 18 #include "content/common/child_process_messages.h" |
19 #include "content/public/browser/content_browser_client.h" | |
19 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
20 #include "content/public/common/pepper_plugin_info.h" | 21 #include "content/public/common/pepper_plugin_info.h" |
21 #include "content/public/common/process_type.h" | 22 #include "content/public/common/process_type.h" |
22 #include "ipc/ipc_switches.h" | 23 #include "ipc/ipc_switches.h" |
23 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
24 #include "ppapi/proxy/ppapi_messages.h" | 25 #include "ppapi/proxy/ppapi_messages.h" |
26 #include "ui/base/ui_base_switches.h" | |
25 #include "webkit/plugins/plugin_switches.h" | 27 #include "webkit/plugins/plugin_switches.h" |
26 | 28 |
27 using content::ChildProcessHost; | 29 using content::ChildProcessHost; |
28 using content::ChildProcessHostImpl; | 30 using content::ChildProcessHostImpl; |
29 | 31 |
30 class PpapiPluginProcessHost::PluginNetworkObserver | 32 class PpapiPluginProcessHost::PluginNetworkObserver |
31 : public net::NetworkChangeNotifier::IPAddressObserver, | 33 : public net::NetworkChangeNotifier::IPAddressObserver, |
32 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 34 public net::NetworkChangeNotifier::ConnectionTypeObserver { |
33 public: | 35 public: |
34 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) | 36 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 static const char* kPluginForwardSwitches[] = { | 184 static const char* kPluginForwardSwitches[] = { |
183 switches::kNoSandbox, | 185 switches::kNoSandbox, |
184 switches::kDisableSeccompFilterSandbox, | 186 switches::kDisableSeccompFilterSandbox, |
185 switches::kPpapiFlashArgs, | 187 switches::kPpapiFlashArgs, |
186 switches::kPpapiStartupDialog | 188 switches::kPpapiStartupDialog |
187 }; | 189 }; |
188 cmd_line->CopySwitchesFrom(browser_command_line, kPluginForwardSwitches, | 190 cmd_line->CopySwitchesFrom(browser_command_line, kPluginForwardSwitches, |
189 arraysize(kPluginForwardSwitches)); | 191 arraysize(kPluginForwardSwitches)); |
190 } | 192 } |
191 | 193 |
194 std::string locale = | |
195 content::GetContentClient()->browser()->GetApplicationLocale(); | |
brettw
2012/06/08 22:58:41
This runs on the I/O thread and you aren't suppose
| |
196 if (!locale.empty()) { | |
197 // Pass on the locale so the plugin will know what language we're using. | |
198 cmd_line->AppendSwitchASCII(switches::kLang, locale); | |
199 } | |
200 | |
192 if (!plugin_launcher.empty()) | 201 if (!plugin_launcher.empty()) |
193 cmd_line->PrependWrapper(plugin_launcher); | 202 cmd_line->PrependWrapper(plugin_launcher); |
194 | 203 |
195 // On posix, never use the zygote for the broker. Also, only use the zygote if | 204 // On posix, never use the zygote for the broker. Also, only use the zygote if |
196 // the plugin is sandboxed, and we are not using a plugin launcher - having a | 205 // the plugin is sandboxed, and we are not using a plugin launcher - having a |
197 // plugin launcher means we need to use another process instead of just | 206 // plugin launcher means we need to use another process instead of just |
198 // forking the zygote. | 207 // forking the zygote. |
199 #if defined(OS_POSIX) | 208 #if defined(OS_POSIX) |
200 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; | 209 bool use_zygote = !is_broker_ && plugin_launcher.empty() && info.is_sandboxed; |
201 if (!info.is_sandboxed) | 210 if (!info.is_sandboxed) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 if (sent_requests_.empty()) | 297 if (sent_requests_.empty()) |
289 return; | 298 return; |
290 | 299 |
291 // All requests should be processed FIFO, so the next item in the | 300 // All requests should be processed FIFO, so the next item in the |
292 // sent_requests_ queue should be the one that the plugin just created. | 301 // sent_requests_ queue should be the one that the plugin just created. |
293 Client* client = sent_requests_.front(); | 302 Client* client = sent_requests_.front(); |
294 sent_requests_.pop(); | 303 sent_requests_.pop(); |
295 | 304 |
296 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 305 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
297 } | 306 } |
OLD | NEW |