Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: content/browser/renderer_host/pepper/browser_ppapi_host_impl.cc

Issue 19005006: Switched proxy for TCPServerSocketPrivate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync, fix. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #include "content/browser/tracing/trace_message_filter.h" 7 #include "content/browser/tracing/trace_message_filter.h"
9 #include "content/common/pepper_renderer_instance_data.h" 8 #include "content/common/pepper_renderer_instance_data.h"
10 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
11 #include "content/public/common/process_type.h" 10 #include "content/public/common/process_type.h"
12 #include "ipc/ipc_message_macros.h" 11 #include "ipc/ipc_message_macros.h"
13 12
14 namespace content { 13 namespace content {
15 14
16 // static 15 // static
17 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess( 16 BrowserPpapiHost* BrowserPpapiHost::CreateExternalPluginProcess(
18 IPC::Sender* sender, 17 IPC::Sender* sender,
19 ppapi::PpapiPermissions permissions, 18 ppapi::PpapiPermissions permissions,
20 base::ProcessHandle plugin_child_process, 19 base::ProcessHandle plugin_child_process,
21 IPC::ChannelProxy* channel, 20 IPC::ChannelProxy* channel,
22 net::HostResolver* host_resolver, 21 net::HostResolver* host_resolver,
23 int render_process_id, 22 int render_process_id,
24 int render_view_id, 23 int render_view_id,
25 const base::FilePath& profile_directory) { 24 const base::FilePath& profile_directory) {
26 // The plugin name and path shouldn't be needed for NaCl apps. 25 scoped_refptr<PepperMessageFilter> pepper_message_filter(
27 BrowserPpapiHostImpl* browser_ppapi_host =
28 new BrowserPpapiHostImpl(sender, permissions, std::string(),
29 base::FilePath(), profile_directory, true);
30 browser_ppapi_host->set_plugin_process_handle(plugin_child_process);
31
32 channel->AddFilter(
33 new PepperMessageFilter(permissions, 26 new PepperMessageFilter(permissions,
34 host_resolver, 27 host_resolver,
35 render_process_id, 28 render_process_id,
36 render_view_id)); 29 render_view_id));
30
31 // The plugin name and path shouldn't be needed for external plugins.
32 BrowserPpapiHostImpl* browser_ppapi_host =
33 new BrowserPpapiHostImpl(sender, permissions, std::string(),
34 base::FilePath(), profile_directory, true,
35 pepper_message_filter);
36 browser_ppapi_host->set_plugin_process_handle(plugin_child_process);
37
38 channel->AddFilter(pepper_message_filter);
37 channel->AddFilter(browser_ppapi_host->message_filter().get()); 39 channel->AddFilter(browser_ppapi_host->message_filter().get());
38 channel->AddFilter(new TraceMessageFilter()); 40 channel->AddFilter(new TraceMessageFilter());
39 41
40 return browser_ppapi_host; 42 return browser_ppapi_host;
41 } 43 }
42 44
43 BrowserPpapiHostImpl::BrowserPpapiHostImpl( 45 BrowserPpapiHostImpl::BrowserPpapiHostImpl(
44 IPC::Sender* sender, 46 IPC::Sender* sender,
45 const ppapi::PpapiPermissions& permissions, 47 const ppapi::PpapiPermissions& permissions,
46 const std::string& plugin_name, 48 const std::string& plugin_name,
47 const base::FilePath& plugin_path, 49 const base::FilePath& plugin_path,
48 const base::FilePath& profile_data_directory, 50 const base::FilePath& profile_data_directory,
49 bool external_plugin) 51 bool external_plugin,
52 const scoped_refptr<PepperMessageFilter>& pepper_message_filter)
50 : ppapi_host_(new ppapi::host::PpapiHost(sender, permissions)), 53 : ppapi_host_(new ppapi::host::PpapiHost(sender, permissions)),
51 plugin_process_handle_(base::kNullProcessHandle), 54 plugin_process_handle_(base::kNullProcessHandle),
52 plugin_name_(plugin_name), 55 plugin_name_(plugin_name),
53 plugin_path_(plugin_path), 56 plugin_path_(plugin_path),
54 profile_data_directory_(profile_data_directory), 57 profile_data_directory_(profile_data_directory),
55 external_plugin_(external_plugin) { 58 external_plugin_(external_plugin) {
56 message_filter_ = new HostMessageFilter(ppapi_host_.get()); 59 message_filter_ = new HostMessageFilter(ppapi_host_.get());
57 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( 60 ppapi_host_->AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
58 new ContentBrowserPepperHostFactory(this))); 61 new ContentBrowserPepperHostFactory(this, pepper_message_filter)));
59 } 62 }
60 63
61 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { 64 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() {
62 // Notify the filter so it won't foward messages to us. 65 // Notify the filter so it won't foward messages to us.
63 message_filter_->OnHostDestroyed(); 66 message_filter_->OnHostDestroyed();
64 67
65 // Delete the host explicitly first. This shutdown will destroy the 68 // Delete the host explicitly first. This shutdown will destroy the
66 // resources, which may want to do cleanup in their destructors and expect 69 // resources, which may want to do cleanup in their destructors and expect
67 // their pointers to us to be valid. 70 // their pointers to us to be valid.
68 ppapi_host_.reset(); 71 ppapi_host_.reset();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 */ 159 */
157 return ppapi_host_->OnMessageReceived(msg); 160 return ppapi_host_->OnMessageReceived(msg);
158 } 161 }
159 162
160 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() { 163 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() {
161 DCHECK(ppapi_host_); 164 DCHECK(ppapi_host_);
162 ppapi_host_ = NULL; 165 ppapi_host_ = NULL;
163 } 166 }
164 167
165 } // namespace content 168 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698