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

Side by Side Diff: content/renderer/pepper/pepper_webplugin_impl.cc

Issue 105553005: Make PepperWebPlugin not use RenderViews. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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/renderer/pepper/pepper_webplugin_impl.h" 5 #include "content/renderer/pepper/pepper_webplugin_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "content/public/common/page_zoom.h" 11 #include "content/public/common/page_zoom.h"
12 #include "content/public/renderer/content_renderer_client.h" 12 #include "content/public/renderer/content_renderer_client.h"
13 #include "content/renderer/pepper/message_channel.h" 13 #include "content/renderer/pepper/message_channel.h"
14 #include "content/renderer/pepper/npobject_var.h" 14 #include "content/renderer/pepper/npobject_var.h"
15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
16 #include "content/renderer/pepper/plugin_module.h" 16 #include "content/renderer/pepper/plugin_module.h"
17 #include "content/renderer/render_view_impl.h" 17 #include "content/renderer/render_frame_impl.h"
18 #include "ppapi/shared_impl/ppapi_globals.h" 18 #include "ppapi/shared_impl/ppapi_globals.h"
19 #include "ppapi/shared_impl/var_tracker.h" 19 #include "ppapi/shared_impl/var_tracker.h"
20 #include "third_party/WebKit/public/platform/WebPoint.h" 20 #include "third_party/WebKit/public/platform/WebPoint.h"
21 #include "third_party/WebKit/public/platform/WebRect.h" 21 #include "third_party/WebKit/public/platform/WebRect.h"
22 #include "third_party/WebKit/public/platform/WebSize.h" 22 #include "third_party/WebKit/public/platform/WebSize.h"
23 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 23 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
24 #include "third_party/WebKit/public/web/WebBindings.h" 24 #include "third_party/WebKit/public/web/WebBindings.h"
25 #include "third_party/WebKit/public/web/WebDocument.h" 25 #include "third_party/WebKit/public/web/WebDocument.h"
26 #include "third_party/WebKit/public/web/WebElement.h" 26 #include "third_party/WebKit/public/web/WebElement.h"
27 #include "third_party/WebKit/public/web/WebFrame.h" 27 #include "third_party/WebKit/public/web/WebFrame.h"
(...skipping 13 matching lines...) Expand all
41 using blink::WebRect; 41 using blink::WebRect;
42 using blink::WebSize; 42 using blink::WebSize;
43 using blink::WebString; 43 using blink::WebString;
44 using blink::WebURL; 44 using blink::WebURL;
45 using blink::WebVector; 45 using blink::WebVector;
46 46
47 namespace content { 47 namespace content {
48 48
49 struct PepperWebPluginImpl::InitData { 49 struct PepperWebPluginImpl::InitData {
50 scoped_refptr<PluginModule> module; 50 scoped_refptr<PluginModule> module;
51 base::WeakPtr<RenderViewImpl> render_view; 51 RenderFrameImpl* render_frame;
52 RenderFrame* render_frame;
53 std::vector<std::string> arg_names; 52 std::vector<std::string> arg_names;
54 std::vector<std::string> arg_values; 53 std::vector<std::string> arg_values;
55 GURL url; 54 GURL url;
56 }; 55 };
57 56
58 PepperWebPluginImpl::PepperWebPluginImpl( 57 PepperWebPluginImpl::PepperWebPluginImpl(
59 PluginModule* plugin_module, 58 PluginModule* plugin_module,
60 const WebPluginParams& params, 59 const WebPluginParams& params,
61 const base::WeakPtr<RenderViewImpl>& render_view, 60 RenderFrameImpl* render_frame)
62 RenderFrame* render_frame)
63 : init_data_(new InitData()), 61 : init_data_(new InitData()),
64 full_frame_(params.loadManually), 62 full_frame_(params.loadManually),
65 instance_object_(PP_MakeUndefined()), 63 instance_object_(PP_MakeUndefined()),
66 container_(NULL) { 64 container_(NULL) {
67 DCHECK(plugin_module); 65 DCHECK(plugin_module);
68 init_data_->module = plugin_module; 66 init_data_->module = plugin_module;
69 init_data_->render_view = render_view;
70 init_data_->render_frame = render_frame; 67 init_data_->render_frame = render_frame;
71 for (size_t i = 0; i < params.attributeNames.size(); ++i) { 68 for (size_t i = 0; i < params.attributeNames.size(); ++i) {
72 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); 69 init_data_->arg_names.push_back(params.attributeNames[i].utf8());
73 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); 70 init_data_->arg_values.push_back(params.attributeValues[i].utf8());
74 } 71 }
75 init_data_->url = params.url; 72 init_data_->url = params.url;
76 73
77 // Set subresource URL for crash reporting. 74 // Set subresource URL for crash reporting.
78 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec()); 75 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec());
79 } 76 }
80 77
81 PepperWebPluginImpl::~PepperWebPluginImpl() { 78 PepperWebPluginImpl::~PepperWebPluginImpl() {
82 } 79 }
83 80
84 blink::WebPluginContainer* PepperWebPluginImpl::container() const { 81 blink::WebPluginContainer* PepperWebPluginImpl::container() const {
85 return container_; 82 return container_;
86 } 83 }
87 84
88 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) { 85 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) {
89 // The plugin delegate may have gone away. 86 // The plugin delegate may have gone away.
90 instance_ = init_data_->module->CreateInstance( 87 instance_ = init_data_->module->CreateInstance(
91 init_data_->render_view->main_render_frame(), container, init_data_->url); 88 init_data_->render_frame, container, init_data_->url);
92 if (!instance_.get()) 89 if (!instance_.get())
93 return false; 90 return false;
94 91
95 // Enable script objects for this plugin. 92 // Enable script objects for this plugin.
96 container->allowScriptObjects(); 93 container->allowScriptObjects();
97 94
98 bool success = instance_->Initialize(init_data_->arg_names, 95 bool success = instance_->Initialize(init_data_->arg_names,
99 init_data_->arg_values, 96 init_data_->arg_values,
100 full_frame_); 97 full_frame_);
101 if (!success) { 98 if (!success) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 292
296 void PepperWebPluginImpl::rotateView(RotationType type) { 293 void PepperWebPluginImpl::rotateView(RotationType type) {
297 instance_->RotateView(type); 294 instance_->RotateView(type);
298 } 295 }
299 296
300 bool PepperWebPluginImpl::isPlaceholder() { 297 bool PepperWebPluginImpl::isPlaceholder() {
301 return false; 298 return false;
302 } 299 }
303 300
304 } // namespace content 301 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698