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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/browser/plugin_service.h" | 11 #include "content/browser/plugin_service.h" |
12 #include "content/browser/renderer_host/render_message_filter.h" | 12 #include "content/browser/renderer_host/render_message_filter.h" |
13 #include "content/common/content_switches.h" | 13 #include "content/common/content_switches.h" |
14 #include "content/common/pepper_plugin_registry.h" | |
15 #include "ipc/ipc_switches.h" | 14 #include "ipc/ipc_switches.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 15 #include "ppapi/proxy/ppapi_messages.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_plugin_info.h" |
17 | 17 |
18 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) | 18 PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver) |
19 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_PLUGIN_PROCESS), | 19 : BrowserChildProcessHost(ChildProcessInfo::PPAPI_PLUGIN_PROCESS), |
20 filter_(new PepperMessageFilter(host_resolver)) { | 20 filter_(new PepperMessageFilter(host_resolver)) { |
21 AddFilter(filter_.get()); | 21 AddFilter(filter_.get()); |
22 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 22 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
23 net::NetworkChangeNotifier::AddOnlineStateObserver(this); | 23 net::NetworkChangeNotifier::AddOnlineStateObserver(this); |
24 } | 24 } |
25 | 25 |
26 PpapiPluginProcessHost::~PpapiPluginProcessHost() { | 26 PpapiPluginProcessHost::~PpapiPluginProcessHost() { |
27 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); | 27 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); |
28 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 28 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
29 CancelRequests(); | 29 CancelRequests(); |
30 } | 30 } |
31 | 31 |
32 bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { | 32 bool PpapiPluginProcessHost::Init(const webkit::ppapi::PluginInfo& info) { |
33 plugin_path_ = info.path; | 33 plugin_path_ = info.path; |
34 set_name(UTF8ToUTF16(info.name)); | 34 set_name(UTF8ToUTF16(info.name)); |
35 set_version(UTF8ToUTF16(info.version)); | 35 set_version(UTF8ToUTF16(info.version)); |
36 | 36 |
37 if (!CreateChannel()) | 37 if (!CreateChannel()) |
38 return false; | 38 return false; |
39 | 39 |
40 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 40 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
41 CommandLine::StringType plugin_launcher = | 41 CommandLine::StringType plugin_launcher = |
42 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); | 42 browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, | 202 ::DuplicateHandle(::GetCurrentProcess(), plugin_process, |
203 renderer_process, &renderers_plugin_handle, | 203 renderer_process, &renderers_plugin_handle, |
204 0, FALSE, DUPLICATE_SAME_ACCESS); | 204 0, FALSE, DUPLICATE_SAME_ACCESS); |
205 #elif defined(OS_POSIX) | 205 #elif defined(OS_POSIX) |
206 // Don't need to duplicate anything on POSIX since it's just a PID. | 206 // Don't need to duplicate anything on POSIX since it's just a PID. |
207 base::ProcessHandle renderers_plugin_handle = plugin_process; | 207 base::ProcessHandle renderers_plugin_handle = plugin_process; |
208 #endif | 208 #endif |
209 | 209 |
210 client->OnChannelOpened(renderers_plugin_handle, channel_handle); | 210 client->OnChannelOpened(renderers_plugin_handle, channel_handle); |
211 } | 211 } |
OLD | NEW |