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/renderer_host/pepper/browser_ppapi_host_impl.h" | 5 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
6 | 6 |
7 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 7 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // static | 14 // static |
15 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess( | 15 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess( |
16 IPC::Sender* sender, | 16 IPC::Sender* sender, |
17 ppapi::PpapiPermissions permissions, | 17 ppapi::PpapiPermissions permissions, |
18 base::ProcessHandle plugin_child_process, | 18 base::ProcessHandle plugin_child_process, |
19 int plugin_child_process_id, | 19 int plugin_child_process_id, |
20 ProcessType plugin_child_process_type, | |
20 IPC::ChannelProxy* channel, | 21 IPC::ChannelProxy* channel, |
21 net::HostResolver* host_resolver, | 22 net::HostResolver* host_resolver, |
22 int render_process_id, | 23 int render_process_id, |
23 int render_view_id) { | 24 int render_view_id) { |
24 // TODO(raymes): Figure out how to plumb plugin_name and | 25 // TODO(raymes): Figure out how to plumb plugin_name and |
25 // profile_data_directory through for NaCl. They are currently only needed for | 26 // profile_data_directory through for NaCl. They are currently only needed for |
26 // PPB_Flash_File interfaces so it doesn't matter. | 27 // PPB_Flash_File interfaces so it doesn't matter. |
27 std::string plugin_name; | 28 std::string plugin_name; |
28 FilePath profile_data_directory; | 29 FilePath profile_data_directory; |
29 BrowserPpapiHostImpl* browser_ppapi_host = | 30 BrowserPpapiHostImpl* browser_ppapi_host = |
30 new BrowserPpapiHostImpl(sender, permissions, plugin_name, | 31 new BrowserPpapiHostImpl(sender, permissions, plugin_name, |
31 profile_data_directory, plugin_child_process_id); | 32 profile_data_directory, |
33 plugin_child_process_id, | |
34 plugin_child_process_type); | |
32 browser_ppapi_host->set_plugin_process_handle(plugin_child_process); | 35 browser_ppapi_host->set_plugin_process_handle(plugin_child_process); |
33 | 36 |
34 channel->AddFilter( | 37 channel->AddFilter( |
35 new PepperMessageFilter(PepperMessageFilter::NACL, | 38 new PepperMessageFilter(plugin_child_process_type, |
dmichael (off chromium)
2012/12/12 23:23:38
I'm not sure I understand why you are changing the
ygorshenin1
2012/12/18 12:07:16
Because there are different policies for nacl- and
dmichael (off chromium)
2012/12/22 00:35:08
But don't we only come in to this code path if the
ygorshenin1
2012/12/24 14:41:43
Because I don't understand why do we need PepperMe
dmichael (off chromium)
2013/01/10 05:57:16
I'm fine with using content::ProcessType. Makes se
ygorshenin1
2013/01/10 11:36:12
OK, agree. Done.
On 2013/01/10 05:57:16, dmichael
| |
36 permissions, | 39 permissions, |
37 host_resolver, | 40 host_resolver, |
38 render_process_id, | 41 render_process_id, |
39 render_view_id)); | 42 render_view_id)); |
40 channel->AddFilter(browser_ppapi_host->message_filter()); | 43 channel->AddFilter(browser_ppapi_host->message_filter()); |
41 | 44 |
42 return browser_ppapi_host; | 45 return browser_ppapi_host; |
43 } | 46 } |
44 | 47 |
45 BrowserPpapiHostImpl::BrowserPpapiHostImpl( | 48 BrowserPpapiHostImpl::BrowserPpapiHostImpl( |
46 IPC::Sender* sender, | 49 IPC::Sender* sender, |
47 const ppapi::PpapiPermissions& permissions, | 50 const ppapi::PpapiPermissions& permissions, |
48 const std::string& plugin_name, | 51 const std::string& plugin_name, |
49 const FilePath& profile_data_directory, | 52 const FilePath& profile_data_directory, |
50 int plugin_process_id) | 53 int plugin_process_id, |
54 ProcessType plugin_process_type) | |
51 : ppapi_host_(sender, permissions), | 55 : ppapi_host_(sender, permissions), |
52 plugin_process_handle_(base::kNullProcessHandle), | 56 plugin_process_handle_(base::kNullProcessHandle), |
53 plugin_name_(plugin_name), | 57 plugin_name_(plugin_name), |
54 profile_data_directory_(profile_data_directory), | 58 profile_data_directory_(profile_data_directory), |
55 plugin_process_id_(plugin_process_id) { | 59 plugin_process_id_(plugin_process_id), |
60 plugin_process_type_(plugin_process_type) { | |
56 message_filter_ = new HostMessageFilter(&ppapi_host_); | 61 message_filter_ = new HostMessageFilter(&ppapi_host_); |
57 ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( | 62 ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( |
58 new ContentBrowserPepperHostFactory(this))); | 63 new ContentBrowserPepperHostFactory(this))); |
59 } | 64 } |
60 | 65 |
61 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { | 66 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { |
62 // Notify the filter so it won't foward messages to us. | 67 // Notify the filter so it won't foward messages to us. |
63 message_filter_->OnHostDestroyed(); | 68 message_filter_->OnHostDestroyed(); |
64 } | 69 } |
65 | 70 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 */ | 146 */ |
142 return ppapi_host_->OnMessageReceived(msg); | 147 return ppapi_host_->OnMessageReceived(msg); |
143 } | 148 } |
144 | 149 |
145 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() { | 150 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() { |
146 DCHECK(ppapi_host_); | 151 DCHECK(ppapi_host_); |
147 ppapi_host_ = NULL; | 152 ppapi_host_ = NULL; |
148 } | 153 } |
149 | 154 |
150 } // namespace content | 155 } // namespace content |
OLD | NEW |