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

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

Issue 11450025: Revert 171389 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" 7 #include "content/browser/renderer_host/pepper/pepper_message_filter.h"
7
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 IPC::ChannelProxy* channel, 20 IPC::ChannelProxy* channel,
20 net::HostResolver* host_resolver, 21 net::HostResolver* host_resolver,
21 int render_process_id, 22 int render_process_id,
22 int render_view_id) { 23 int render_view_id) {
24 // TODO(raymes): Figure out how to plumb plugin_name and
25 // profile_data_directory through for NaCl. They are currently only needed for
26 // PPB_Flash_File interfaces so it doesn't matter.
27 std::string plugin_name;
28 FilePath profile_data_directory;
23 BrowserPpapiHostImpl* browser_ppapi_host = 29 BrowserPpapiHostImpl* browser_ppapi_host =
24 new BrowserPpapiHostImpl(sender, permissions); 30 new BrowserPpapiHostImpl(sender, permissions, plugin_name,
31 profile_data_directory, plugin_child_process_id);
25 browser_ppapi_host->set_plugin_process_handle(plugin_child_process); 32 browser_ppapi_host->set_plugin_process_handle(plugin_child_process);
26 33
27 channel->AddFilter( 34 channel->AddFilter(
28 new PepperMessageFilter(PepperMessageFilter::NACL, 35 new PepperMessageFilter(PepperMessageFilter::NACL,
29 permissions, 36 permissions,
30 host_resolver, 37 host_resolver,
31 render_process_id, 38 render_process_id,
32 render_view_id)); 39 render_view_id));
33 channel->AddFilter(browser_ppapi_host->message_filter()); 40 channel->AddFilter(browser_ppapi_host->message_filter());
34 41
35 return browser_ppapi_host; 42 return browser_ppapi_host;
36 } 43 }
37 44
38 BrowserPpapiHostImpl::BrowserPpapiHostImpl( 45 BrowserPpapiHostImpl::BrowserPpapiHostImpl(
39 IPC::Sender* sender, 46 IPC::Sender* sender,
40 const ppapi::PpapiPermissions& permissions) 47 const ppapi::PpapiPermissions& permissions,
48 const std::string& plugin_name,
49 const FilePath& profile_data_directory,
50 int plugin_process_id)
41 : ppapi_host_(sender, permissions), 51 : ppapi_host_(sender, permissions),
42 plugin_process_handle_(base::kNullProcessHandle) { 52 plugin_process_handle_(base::kNullProcessHandle),
53 plugin_name_(plugin_name),
54 profile_data_directory_(profile_data_directory),
55 plugin_process_id_(plugin_process_id) {
43 message_filter_ = new HostMessageFilter(&ppapi_host_); 56 message_filter_ = new HostMessageFilter(&ppapi_host_);
44 ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>( 57 ppapi_host_.AddHostFactoryFilter(scoped_ptr<ppapi::host::HostFactory>(
45 new ContentBrowserPepperHostFactory(this))); 58 new ContentBrowserPepperHostFactory(this)));
46 } 59 }
47 60
48 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() { 61 BrowserPpapiHostImpl::~BrowserPpapiHostImpl() {
49 // Notify the filter so it won't foward messages to us. 62 // Notify the filter so it won't foward messages to us.
50 message_filter_->OnHostDestroyed(); 63 message_filter_->OnHostDestroyed();
51 } 64 }
52 65
(...skipping 20 matching lines...) Expand all
73 *render_process_id = 0; 86 *render_process_id = 0;
74 *render_view_id = 0; 87 *render_view_id = 0;
75 return false; 88 return false;
76 } 89 }
77 90
78 *render_process_id = found->second.process_id; 91 *render_process_id = found->second.process_id;
79 *render_view_id = found->second.view_id; 92 *render_view_id = found->second.view_id;
80 return true; 93 return true;
81 } 94 }
82 95
96 const std::string& BrowserPpapiHostImpl::GetPluginName() {
97 return plugin_name_;
98 }
99
100 const FilePath& BrowserPpapiHostImpl::GetProfileDataDirectory() {
101 return profile_data_directory_;
102 }
103
104 int BrowserPpapiHostImpl::GetPluginProcessID() {
105 return plugin_process_id_;
106 }
107
83 void BrowserPpapiHostImpl::AddInstanceForView(PP_Instance instance, 108 void BrowserPpapiHostImpl::AddInstanceForView(PP_Instance instance,
84 int render_process_id, 109 int render_process_id,
85 int render_view_id) { 110 int render_view_id) {
86 DCHECK(instance_to_view_.find(instance) == instance_to_view_.end()); 111 DCHECK(instance_to_view_.find(instance) == instance_to_view_.end());
87 112
88 RenderViewIDs ids; 113 RenderViewIDs ids;
89 ids.process_id = render_process_id; 114 ids.process_id = render_process_id;
90 ids.view_id = render_view_id; 115 ids.view_id = render_view_id;
91 instance_to_view_[instance] = ids; 116 instance_to_view_[instance] = ids;
92 } 117 }
(...skipping 23 matching lines...) Expand all
116 */ 141 */
117 return ppapi_host_->OnMessageReceived(msg); 142 return ppapi_host_->OnMessageReceived(msg);
118 } 143 }
119 144
120 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() { 145 void BrowserPpapiHostImpl::HostMessageFilter::OnHostDestroyed() {
121 DCHECK(ppapi_host_); 146 DCHECK(ppapi_host_);
122 ppapi_host_ = NULL; 147 ppapi_host_ = NULL;
123 } 148 }
124 149
125 } // namespace content 150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698