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

Side by Side Diff: webkit/plugins/ppapi/ppapi_webplugin_impl.cc

Issue 19800005: Hide knowledge of webkit::ppapi::PluginDelegate from chrome. This is part of moving ppapi implement… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 5 #include "webkit/plugins/ppapi/ppapi_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"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using WebKit::WebURL; 42 using WebKit::WebURL;
43 using WebKit::WebVector; 43 using WebKit::WebVector;
44 using WebKit::WebView; 44 using WebKit::WebView;
45 45
46 namespace webkit { 46 namespace webkit {
47 namespace ppapi { 47 namespace ppapi {
48 48
49 struct WebPluginImpl::InitData { 49 struct WebPluginImpl::InitData {
50 scoped_refptr<PluginModule> module; 50 scoped_refptr<PluginModule> module;
51 base::WeakPtr<PluginDelegate> delegate; 51 base::WeakPtr<PluginDelegate> delegate;
52 base::WeakPtr<content::RenderView> render_view;
52 std::vector<std::string> arg_names; 53 std::vector<std::string> arg_names;
53 std::vector<std::string> arg_values; 54 std::vector<std::string> arg_values;
54 GURL url; 55 GURL url;
55 }; 56 };
56 57
57 WebPluginImpl::WebPluginImpl( 58 WebPluginImpl::WebPluginImpl(
58 PluginModule* plugin_module, 59 PluginModule* plugin_module,
59 const WebPluginParams& params, 60 const WebPluginParams& params,
60 const base::WeakPtr<PluginDelegate>& plugin_delegate) 61 const base::WeakPtr<PluginDelegate>& plugin_delegate,
62 const base::WeakPtr<content::RenderView>& render_view)
61 : init_data_(new InitData()), 63 : init_data_(new InitData()),
62 full_frame_(params.loadManually), 64 full_frame_(params.loadManually),
63 instance_object_(PP_MakeUndefined()), 65 instance_object_(PP_MakeUndefined()),
64 container_(NULL) { 66 container_(NULL) {
65 DCHECK(plugin_module); 67 DCHECK(plugin_module);
66 init_data_->module = plugin_module; 68 init_data_->module = plugin_module;
67 init_data_->delegate = plugin_delegate; 69 init_data_->delegate = plugin_delegate;
70 init_data_->render_view = render_view;
68 for (size_t i = 0; i < params.attributeNames.size(); ++i) { 71 for (size_t i = 0; i < params.attributeNames.size(); ++i) {
69 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); 72 init_data_->arg_names.push_back(params.attributeNames[i].utf8());
70 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); 73 init_data_->arg_values.push_back(params.attributeValues[i].utf8());
71 } 74 }
72 init_data_->url = params.url; 75 init_data_->url = params.url;
73 76
74 // Set subresource URL for crash reporting. 77 // Set subresource URL for crash reporting.
75 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec()); 78 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec());
76 } 79 }
77 80
78 WebPluginImpl::~WebPluginImpl() { 81 WebPluginImpl::~WebPluginImpl() {
79 } 82 }
80 83
81 WebKit::WebPluginContainer* WebPluginImpl::container() const { 84 WebKit::WebPluginContainer* WebPluginImpl::container() const {
82 return container_; 85 return container_;
83 } 86 }
84 87
85 bool WebPluginImpl::initialize(WebPluginContainer* container) { 88 bool WebPluginImpl::initialize(WebPluginContainer* container) {
86 // The plugin delegate may have gone away. 89 // The plugin delegate may have gone away.
87 if (!init_data_->delegate.get()) 90 if (!init_data_->delegate.get())
88 return false; 91 return false;
89 92
90 instance_ = init_data_->module 93 instance_ = init_data_->module->CreateInstance(
91 ->CreateInstance(init_data_->delegate.get(), container, init_data_->url); 94 init_data_->delegate.get(), init_data_->render_view.get(), container,
95 init_data_->url);
92 if (!instance_.get()) 96 if (!instance_.get())
93 return false; 97 return false;
94 98
95 // Enable script objects for this plugin. 99 // Enable script objects for this plugin.
96 container->allowScriptObjects(); 100 container->allowScriptObjects();
97 101
98 bool success = instance_->Initialize(init_data_->arg_names, 102 bool success = instance_->Initialize(init_data_->arg_names,
99 init_data_->arg_values, 103 init_data_->arg_values,
100 full_frame_); 104 full_frame_);
101 if (!success) { 105 if (!success) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void WebPluginImpl::rotateView(RotationType type) { 299 void WebPluginImpl::rotateView(RotationType type) {
296 instance_->RotateView(type); 300 instance_->RotateView(type);
297 } 301 }
298 302
299 bool WebPluginImpl::isPlaceholder() { 303 bool WebPluginImpl::isPlaceholder() {
300 return false; 304 return false;
301 } 305 }
302 306
303 } // namespace ppapi 307 } // namespace ppapi
304 } // namespace webkit 308 } // namespace webkit
OLDNEW
« chrome/renderer/pepper/ppb_pdf_impl.cc ('K') | « webkit/plugins/ppapi/ppapi_webplugin_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698