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/browser_child_process_host.h" | 12 #include "content/browser/browser_child_process_host_impl.h" |
13 #include "content/browser/plugin_service_impl.h" | 13 #include "content/browser/plugin_service_impl.h" |
14 #include "content/browser/renderer_host/render_message_filter.h" | 14 #include "content/browser/renderer_host/render_message_filter.h" |
15 #include "content/common/child_process_host_impl.h" | 15 #include "content/common/child_process_host_impl.h" |
16 #include "content/common/child_process_messages.h" | 16 #include "content/common/child_process_messages.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/pepper_plugin_info.h" | 18 #include "content/public/common/pepper_plugin_info.h" |
19 #include "content/public/common/process_type.h" | 19 #include "content/public/common/process_type.h" |
20 #include "ipc/ipc_switches.h" | 20 #include "ipc/ipc_switches.h" |
21 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
22 #include "ppapi/proxy/ppapi_messages.h" | 22 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // We already have an open channel, send a request right away to plugin. | 104 // We already have an open channel, send a request right away to plugin. |
105 RequestPluginChannel(client); | 105 RequestPluginChannel(client); |
106 } | 106 } |
107 | 107 |
108 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) | 108 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) |
109 : filter_(new PepperMessageFilter(host_resolver)), | 109 : filter_(new PepperMessageFilter(host_resolver)), |
110 network_observer_(new PluginNetworkObserver(this)), | 110 network_observer_(new PluginNetworkObserver(this)), |
111 is_broker_(false), | 111 is_broker_(false), |
112 process_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()) { | 112 process_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()) { |
113 process_.reset(new BrowserChildProcessHost( | 113 process_.reset(new BrowserChildProcessHostImpl( |
114 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); | 114 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); |
115 process_->GetHost()->AddFilter(filter_.get()); | 115 process_->GetHost()->AddFilter(filter_.get()); |
116 } | 116 } |
117 | 117 |
118 PpapiPluginProcessHost::PpapiPluginProcessHost() | 118 PpapiPluginProcessHost::PpapiPluginProcessHost() |
119 : is_broker_(true), | 119 : is_broker_(true), |
120 process_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()) { | 120 process_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()) { |
121 process_.reset(new BrowserChildProcessHost( | 121 process_.reset(new BrowserChildProcessHostImpl( |
122 content::PROCESS_TYPE_PPAPI_BROKER, this)); | 122 content::PROCESS_TYPE_PPAPI_BROKER, this)); |
123 } | 123 } |
124 | 124 |
125 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { | 125 bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) { |
126 plugin_path_ = info.path; | 126 plugin_path_ = info.path; |
127 if (info.name.empty()) { | 127 if (info.name.empty()) { |
128 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); | 128 process_->SetName(plugin_path_.BaseName().LossyDisplayName()); |
129 } else { | 129 } else { |
130 process_->SetName(UTF8ToUTF16(info.name)); | 130 process_->SetName(UTF8ToUTF16(info.name)); |
131 } | 131 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, | 287 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, |
288 renderer_process, &renderers_plugin_handle, | 288 renderer_process, &renderers_plugin_handle, |
289 0, FALSE, DUPLICATE_SAME_ACCESS); | 289 0, FALSE, DUPLICATE_SAME_ACCESS); |
290 #elif defined(OS_POSIX) | 290 #elif defined(OS_POSIX) |
291 // Don't need to duplicate anything on POSIX since it's just a PID. | 291 // Don't need to duplicate anything on POSIX since it's just a PID. |
292 base::ProcessHandle renderers_plugin_handle = plugin_process; | 292 base::ProcessHandle renderers_plugin_handle = plugin_process; |
293 #endif | 293 #endif |
294 | 294 |
295 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 295 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
296 } | 296 } |
OLD | NEW |