| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "content/browser/plugin_service.h" | 12 #include "content/browser/plugin_service.h" |
| 13 #include "content/browser/renderer_host/render_message_filter.h" | 13 #include "content/browser/renderer_host/render_message_filter.h" |
| 14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/common/pepper_plugin_info.h" | 16 #include "content/public/common/pepper_plugin_info.h" |
| 17 #include "content/public/common/process_type.h" |
| 17 #include "ipc/ipc_switches.h" | 18 #include "ipc/ipc_switches.h" |
| 18 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
| 19 #include "ppapi/proxy/ppapi_messages.h" | 20 #include "ppapi/proxy/ppapi_messages.h" |
| 20 | 21 |
| 21 class PpapiPluginProcessHost::PluginNetworkObserver | 22 class PpapiPluginProcessHost::PluginNetworkObserver |
| 22 : public net::NetworkChangeNotifier::IPAddressObserver, | 23 : public net::NetworkChangeNotifier::IPAddressObserver, |
| 23 public net::NetworkChangeNotifier::OnlineStateObserver { | 24 public net::NetworkChangeNotifier::OnlineStateObserver { |
| 24 public: | 25 public: |
| 25 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) | 26 explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) |
| 26 : process_host_(process_host) { | 27 : process_host_(process_host) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // be run once the channel is open. | 94 // be run once the channel is open. |
| 94 pending_requests_.push_back(client); | 95 pending_requests_.push_back(client); |
| 95 return; | 96 return; |
| 96 } | 97 } |
| 97 | 98 |
| 98 // We already have an open channel, send a request right away to plugin. | 99 // We already have an open channel, send a request right away to plugin. |
| 99 RequestPluginChannel(client); | 100 RequestPluginChannel(client); |
| 100 } | 101 } |
| 101 | 102 |
| 102 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) | 103 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) |
| 103 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_PLUGIN_PROCESS), | 104 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_PLUGIN), |
| 104 filter_(new PepperMessageFilter(host_resolver)), | 105 filter_(new PepperMessageFilter(host_resolver)), |
| 105 network_observer_(new PluginNetworkObserver(this)), | 106 network_observer_(new PluginNetworkObserver(this)), |
| 106 is_broker_(false), | 107 is_broker_(false), |
| 107 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { | 108 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { |
| 108 AddFilter(filter_.get()); | 109 AddFilter(filter_.get()); |
| 109 } | 110 } |
| 110 | 111 |
| 111 PpapiPluginProcessHost::PpapiPluginProcessHost() | 112 PpapiPluginProcessHost::PpapiPluginProcessHost() |
| 112 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_BROKER_PROCESS), | 113 : BrowserChildProcessHost(content::PROCESS_TYPE_PPAPI_BROKER), |
| 113 is_broker_(true), | 114 is_broker_(true), |
| 114 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { | 115 process_id_(ChildProcessInfo::GenerateChildProcessUniqueId()) { |
| 115 } | 116 } |
| 116 | 117 |
| 117 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { | 118 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { |
| 118 plugin_path_ = info.path; | 119 plugin_path_ = info.path; |
| 119 if (info.name.empty()) { | 120 if (info.name.empty()) { |
| 120 set_name(plugin_path_.BaseName().LossyDisplayName()); | 121 set_name(plugin_path_.BaseName().LossyDisplayName()); |
| 121 } else { | 122 } else { |
| 122 set_name(UTF8ToUTF16(info.name)); | 123 set_name(UTF8ToUTF16(info.name)); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 #endif | 294 #endif |
| 294 | 295 |
| 295 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 296 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
| 296 } | 297 } |
| 297 | 298 |
| 298 #if defined(OS_WIN) | 299 #if defined(OS_WIN) |
| 299 void PpapiPluginProcessHost::OnPreCacheFont(const LOGFONT& font) { | 300 void PpapiPluginProcessHost::OnPreCacheFont(const LOGFONT& font) { |
| 300 PreCacheFont(font, process_id_); | 301 PreCacheFont(font, process_id_); |
| 301 } | 302 } |
| 302 #endif | 303 #endif |
| OLD | NEW |