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

Side by Side Diff: content/child/npapi/webplugin_delegate_impl.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: plumb RenderView's routing IDs 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/child/npapi/webplugin_delegate_impl.h" 5 #include "content/child/npapi/webplugin_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/child/npapi/plugin_instance.h" 14 #include "content/child/npapi/plugin_instance.h"
15 #include "content/child/npapi/plugin_lib.h" 15 #include "content/child/npapi/plugin_lib.h"
16 #include "content/child/npapi/plugin_stream_url.h" 16 #include "content/child/npapi/plugin_stream_url.h"
17 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
18 #include "webkit/glue/webkit_glue.h" 18 #include "webkit/glue/webkit_glue.h"
19 19
20 using WebKit::WebCursorInfo; 20 using WebKit::WebCursorInfo;
21 using WebKit::WebInputEvent; 21 using WebKit::WebInputEvent;
22 22
23 namespace content { 23 namespace content {
24 24
25 WebPluginDelegateImpl* WebPluginDelegateImpl::Create( 25 WebPluginDelegateImpl* WebPluginDelegateImpl::Create(
26 WebPlugin* plugin,
26 const base::FilePath& filename, 27 const base::FilePath& filename,
27 const std::string& mime_type) { 28 const std::string& mime_type) {
28 scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(filename)); 29 scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(filename));
29 if (plugin_lib.get() == NULL) 30 if (plugin_lib.get() == NULL)
30 return NULL; 31 return NULL;
31 32
32 NPError err = plugin_lib->NP_Initialize(); 33 NPError err = plugin_lib->NP_Initialize();
33 if (err != NPERR_NO_ERROR) 34 if (err != NPERR_NO_ERROR)
34 return NULL; 35 return NULL;
35 36
36 scoped_refptr<PluginInstance> instance(plugin_lib->CreateInstance(mime_type)); 37 scoped_refptr<PluginInstance> instance(plugin_lib->CreateInstance(mime_type));
37 return new WebPluginDelegateImpl(instance.get()); 38 return new WebPluginDelegateImpl(plugin, instance.get());
38 } 39 }
39 40
40 void WebPluginDelegateImpl::PluginDestroyed() { 41 void WebPluginDelegateImpl::PluginDestroyed() {
41 if (handle_event_depth_) { 42 if (handle_event_depth_) {
42 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 43 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
43 } else { 44 } else {
44 delete this; 45 delete this;
45 } 46 }
46 } 47 }
47 48
48 bool WebPluginDelegateImpl::Initialize( 49 bool WebPluginDelegateImpl::Initialize(
49 const GURL& url, 50 const GURL& url,
50 const std::vector<std::string>& arg_names, 51 const std::vector<std::string>& arg_names,
51 const std::vector<std::string>& arg_values, 52 const std::vector<std::string>& arg_values,
52 WebPlugin* plugin,
53 bool load_manually) { 53 bool load_manually) {
54 plugin_ = plugin;
55
56 instance_->set_web_plugin(plugin_); 54 instance_->set_web_plugin(plugin_);
57 if (quirks_ & PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES) { 55 if (quirks_ & PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES) {
58 PluginLib* plugin_lib = instance()->plugin_lib(); 56 PluginLib* plugin_lib = instance()->plugin_lib();
59 if (plugin_lib->instance_count() > 1) { 57 if (plugin_lib->instance_count() > 1) {
60 return false; 58 return false;
61 } 59 }
62 } 60 }
63 61
64 int argc = 0; 62 int argc = 0;
65 scoped_ptr<char*[]> argn(new char*[arg_names.size()]); 63 scoped_ptr<char*[]> argn(new char*[arg_names.size()]);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 292
295 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient( 293 WebPluginResourceClient* WebPluginDelegateImpl::CreateSeekableResourceClient(
296 unsigned long resource_id, int range_request_id) { 294 unsigned long resource_id, int range_request_id) {
297 WebPluginResourceClient* resource_client = instance()->GetRangeRequest( 295 WebPluginResourceClient* resource_client = instance()->GetRangeRequest(
298 range_request_id); 296 range_request_id);
299 if (resource_client) 297 if (resource_client)
300 resource_client->AddRangeRequestResourceId(resource_id); 298 resource_client->AddRangeRequestResourceId(resource_id);
301 return resource_client; 299 return resource_client;
302 } 300 }
303 301
302 void WebPluginDelegateImpl::FetchURL(unsigned long resource_id,
303 int notify_id,
304 const GURL& url,
305 const GURL& first_party_for_cookies,
306 const std::string& method,
307 const std::string& post_data,
308 const GURL& referrer,
309 bool notify_redirects,
310 bool is_plugin_src_load) {
311 NOTIMPLEMENTED();
312 }
313
304 } // namespace content 314 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698