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

Side by Side Diff: content/plugin/webplugin_delegate_stub.cc

Issue 23503043: Load NPAPI plugin resources through the browser process directly instead of going through the render (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 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/plugin/webplugin_delegate_stub.h" 5 #include "content/plugin/webplugin_delegate_stub.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse, 139 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualResponse,
140 OnDidReceiveManualResponse) 140 OnDidReceiveManualResponse)
141 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData) 141 IPC_MESSAGE_HANDLER(PluginMsg_DidReceiveManualData, OnDidReceiveManualData)
142 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading, 142 IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading,
143 OnDidFinishManualLoading) 143 OnDidFinishManualLoading)
144 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail) 144 IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail)
145 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply, 145 IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply,
146 OnHandleURLRequestReply) 146 OnHandleURLRequestReply)
147 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply, 147 IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply,
148 OnHTTPRangeRequestReply) 148 OnHTTPRangeRequestReply)
149 IPC_MESSAGE_HANDLER(PluginMsg_FetchURL, OnFetchURL)
149 IPC_MESSAGE_UNHANDLED(handled = false) 150 IPC_MESSAGE_UNHANDLED(handled = false)
150 IPC_END_MESSAGE_MAP() 151 IPC_END_MESSAGE_MAP()
151 152
152 if (!in_destructor_) 153 if (!in_destructor_)
153 Release(); 154 Release();
154 155
155 DCHECK(handled); 156 DCHECK(handled);
156 return handled; 157 return handled;
157 } 158 }
158 159
(...skipping 15 matching lines...) Expand all
174 } 175 }
175 176
176 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 177 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
177 base::FilePath path = 178 base::FilePath path =
178 command_line.GetSwitchValuePath(switches::kPluginPath); 179 command_line.GetSwitchValuePath(switches::kPluginPath);
179 180
180 webplugin_ = new WebPluginProxy(channel_.get(), 181 webplugin_ = new WebPluginProxy(channel_.get(),
181 instance_id_, 182 instance_id_,
182 page_url_, 183 page_url_,
183 params.host_render_view_routing_id); 184 params.host_render_view_routing_id);
184 delegate_ = WebPluginDelegateImpl::Create(path, mime_type_); 185 delegate_ = WebPluginDelegateImpl::Create(webplugin_, path, mime_type_);
185 if (delegate_) { 186 if (delegate_) {
186 if (delegate_->GetQuirks() & 187 if (delegate_->GetQuirks() &
187 WebPluginDelegateImpl::PLUGIN_QUIRK_DIE_AFTER_UNLOAD) { 188 WebPluginDelegateImpl::PLUGIN_QUIRK_DIE_AFTER_UNLOAD) {
188 PluginThread::current()->SetForcefullyTerminatePluginProcess(); 189 PluginThread::current()->SetForcefullyTerminatePluginProcess();
189 } 190 }
190 191
191 webplugin_->set_delegate(delegate_); 192 webplugin_->set_delegate(delegate_);
192 std::vector<std::string> arg_names = params.arg_names; 193 std::vector<std::string> arg_names = params.arg_names;
193 std::vector<std::string> arg_values = params.arg_values; 194 std::vector<std::string> arg_values = params.arg_values;
194 195
195 // Register the plugin as a valid object owner. 196 // Register the plugin as a valid object owner.
196 WebBindings::registerObjectOwner(delegate_->GetPluginNPP()); 197 WebBindings::registerObjectOwner(delegate_->GetPluginNPP());
197 198
198 // Add an NPObject owner mapping for this instance, to support ownership 199 // Add an NPObject owner mapping for this instance, to support ownership
199 // tracking in the renderer. 200 // tracking in the renderer.
200 channel_->AddMappingForNPObjectOwner(instance_id_, 201 channel_->AddMappingForNPObjectOwner(instance_id_,
201 delegate_->GetPluginNPP()); 202 delegate_->GetPluginNPP());
202 203
203 *result = delegate_->Initialize(params.url, 204 *result = delegate_->Initialize(params.url,
204 arg_names, 205 arg_names,
205 arg_values, 206 arg_values,
206 webplugin_,
207 params.load_manually); 207 params.load_manually);
208 *transparent = delegate_->instance()->transparent(); 208 *transparent = delegate_->instance()->transparent();
209 } 209 }
210 } 210 }
211 211
212 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url, 212 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url,
213 int http_status_code) { 213 int http_status_code) {
214 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); 214 WebPluginResourceClient* client = webplugin_->GetResourceClient(id);
215 if (!client) 215 if (!client)
216 return; 216 return;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 webplugin_->OnResourceCreated(resource_id, resource_client); 416 webplugin_->OnResourceCreated(resource_id, resource_client);
417 } 417 }
418 418
419 void WebPluginDelegateStub::OnHTTPRangeRequestReply( 419 void WebPluginDelegateStub::OnHTTPRangeRequestReply(
420 unsigned long resource_id, int range_request_id) { 420 unsigned long resource_id, int range_request_id) {
421 WebPluginResourceClient* resource_client = 421 WebPluginResourceClient* resource_client =
422 delegate_->CreateSeekableResourceClient(resource_id, range_request_id); 422 delegate_->CreateSeekableResourceClient(resource_id, range_request_id);
423 webplugin_->OnResourceCreated(resource_id, resource_client); 423 webplugin_->OnResourceCreated(resource_id, resource_client);
424 } 424 }
425 425
426 void WebPluginDelegateStub::OnFetchURL(
427 const PluginMsg_FetchURL_Params& params) {
428 delegate_->FetchURL(params.resource_id,
429 params.notify_id,
430 params.url,
431 params.first_party_for_cookies,
432 params.method,
433 params.post_data,
434 params.referrer,
435 params.notify_redirect,
436 params.is_plugin_src_load,
437 channel_->renderer_id(),
438 params.render_view_id);
439 }
440
426 } // namespace content 441 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698