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/ppapi_plugin_process_host.h" | 5 #include "content/browser/ppapi_plugin_process_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") | 70 DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") |
71 << "~PpapiPluginProcessHost()"; | 71 << "~PpapiPluginProcessHost()"; |
72 CancelRequests(); | 72 CancelRequests(); |
73 } | 73 } |
74 | 74 |
75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( | 75 PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost( |
76 const content::PepperPluginInfo& info, | 76 const content::PepperPluginInfo& info, |
77 const FilePath& profile_data_directory, | 77 const FilePath& profile_data_directory, |
78 net::HostResolver* host_resolver) { | 78 net::HostResolver* host_resolver) { |
79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( | 79 PpapiPluginProcessHost* plugin_host = new PpapiPluginProcessHost( |
80 info.name, profile_data_directory, host_resolver); | 80 info, profile_data_directory, host_resolver); |
81 if (plugin_host->Init(info)) | 81 if (plugin_host->Init(info)) |
82 return plugin_host; | 82 return plugin_host; |
83 | 83 |
84 NOTREACHED(); // Init is not expected to fail. | 84 NOTREACHED(); // Init is not expected to fail. |
85 return NULL; | 85 return NULL; |
86 } | 86 } |
87 | 87 |
88 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( | 88 PpapiPluginProcessHost* PpapiPluginProcessHost::CreateBrokerHost( |
89 const content::PepperPluginInfo& info) { | 89 const content::PepperPluginInfo& info) { |
90 PpapiPluginProcessHost* plugin_host = | 90 PpapiPluginProcessHost* plugin_host = |
(...skipping 16 matching lines...) Expand all Loading... |
107 // be run once the channel is open. | 107 // be run once the channel is open. |
108 pending_requests_.push_back(client); | 108 pending_requests_.push_back(client); |
109 return; | 109 return; |
110 } | 110 } |
111 | 111 |
112 // We already have an open channel, send a request right away to plugin. | 112 // We already have an open channel, send a request right away to plugin. |
113 RequestPluginChannel(client); | 113 RequestPluginChannel(client); |
114 } | 114 } |
115 | 115 |
116 PpapiPluginProcessHost::PpapiPluginProcessHost( | 116 PpapiPluginProcessHost::PpapiPluginProcessHost( |
117 const std::string& plugin_name, | 117 const content::PepperPluginInfo& info, |
118 const FilePath& profile_data_directory, | 118 const FilePath& profile_data_directory, |
119 net::HostResolver* host_resolver) | 119 net::HostResolver* host_resolver) |
120 : network_observer_(new PluginNetworkObserver(this)), | 120 : network_observer_(new PluginNetworkObserver(this)), |
121 profile_data_directory_(profile_data_directory), | 121 profile_data_directory_(profile_data_directory), |
122 is_broker_(false) { | 122 is_broker_(false) { |
123 process_.reset(new BrowserChildProcessHostImpl( | 123 process_.reset(new BrowserChildProcessHostImpl( |
124 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); | 124 content::PROCESS_TYPE_PPAPI_PLUGIN, this)); |
125 | 125 |
126 filter_ = new PepperMessageFilter( | 126 filter_ = new PepperMessageFilter( |
127 PepperMessageFilter::PLUGIN, host_resolver); | 127 PepperMessageFilter::PLUGIN, host_resolver, |
| 128 ppapi::PpapiPermissions(info.permissions)); |
128 | 129 |
129 file_filter_ = new PepperTrustedFileMessageFilter( | 130 file_filter_ = new PepperTrustedFileMessageFilter( |
130 process_->GetData().id, plugin_name, profile_data_directory); | 131 process_->GetData().id, info.name, profile_data_directory); |
131 | 132 |
132 process_->GetHost()->AddFilter(filter_.get()); | 133 process_->GetHost()->AddFilter(filter_.get()); |
133 process_->GetHost()->AddFilter(file_filter_.get()); | 134 process_->GetHost()->AddFilter(file_filter_.get()); |
134 } | 135 } |
135 | 136 |
136 PpapiPluginProcessHost::PpapiPluginProcessHost() | 137 PpapiPluginProcessHost::PpapiPluginProcessHost() |
137 : is_broker_(true) { | 138 : is_broker_(true) { |
138 process_.reset(new BrowserChildProcessHostImpl( | 139 process_.reset(new BrowserChildProcessHostImpl( |
139 content::PROCESS_TYPE_PPAPI_BROKER, this)); | 140 content::PROCESS_TYPE_PPAPI_BROKER, this)); |
140 } | 141 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 if (sent_requests_.empty()) | 298 if (sent_requests_.empty()) |
298 return; | 299 return; |
299 | 300 |
300 // All requests should be processed FIFO, so the next item in the | 301 // All requests should be processed FIFO, so the next item in the |
301 // sent_requests_ queue should be the one that the plugin just created. | 302 // sent_requests_ queue should be the one that the plugin just created. |
302 Client* client = sent_requests_.front(); | 303 Client* client = sent_requests_.front(); |
303 sent_requests_.pop(); | 304 sent_requests_.pop(); |
304 | 305 |
305 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); | 306 client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); |
306 } | 307 } |
OLD | NEW |