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

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

Issue 669703003: Plugin Power Saver: Restrict Power Saver to cross-origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 struct PepperWebPluginImpl::InitData { 49 struct PepperWebPluginImpl::InitData {
50 scoped_refptr<PluginModule> module; 50 scoped_refptr<PluginModule> module;
51 RenderFrameImpl* render_frame; 51 RenderFrameImpl* render_frame;
52 std::vector<std::string> arg_names; 52 std::vector<std::string> arg_names;
53 std::vector<std::string> arg_values; 53 std::vector<std::string> arg_values;
54 GURL url; 54 GURL url;
55 }; 55 };
56 56
57 PepperWebPluginImpl::PepperWebPluginImpl(PluginModule* plugin_module, 57 PepperWebPluginImpl::PepperWebPluginImpl(PluginModule* plugin_module,
58 const WebPluginParams& params, 58 const WebPluginParams& params,
59 RenderFrameImpl* render_frame) 59 RenderFrameImpl* render_frame,
60 const blink::WebURL& top_frame_url)
60 : init_data_(new InitData()), 61 : init_data_(new InitData()),
61 full_frame_(params.loadManually), 62 full_frame_(params.loadManually),
62 instance_object_(PP_MakeUndefined()), 63 instance_object_(PP_MakeUndefined()),
63 container_(NULL) { 64 container_(NULL),
65 top_frame_url_(top_frame_url) {
64 DCHECK(plugin_module); 66 DCHECK(plugin_module);
65 init_data_->module = plugin_module; 67 init_data_->module = plugin_module;
66 init_data_->render_frame = render_frame; 68 init_data_->render_frame = render_frame;
67 for (size_t i = 0; i < params.attributeNames.size(); ++i) { 69 for (size_t i = 0; i < params.attributeNames.size(); ++i) {
68 init_data_->arg_names.push_back(params.attributeNames[i].utf8()); 70 init_data_->arg_names.push_back(params.attributeNames[i].utf8());
69 init_data_->arg_values.push_back(params.attributeValues[i].utf8()); 71 init_data_->arg_values.push_back(params.attributeValues[i].utf8());
70 } 72 }
71 init_data_->url = params.url; 73 init_data_->url = params.url;
72 74
73 // Set subresource URL for crash reporting. 75 // Set subresource URL for crash reporting.
74 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec()); 76 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec());
75 } 77 }
76 78
77 PepperWebPluginImpl::~PepperWebPluginImpl() {} 79 PepperWebPluginImpl::~PepperWebPluginImpl() {}
78 80
79 blink::WebPluginContainer* PepperWebPluginImpl::container() const { 81 blink::WebPluginContainer* PepperWebPluginImpl::container() const {
80 return container_; 82 return container_;
81 } 83 }
82 84
83 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) { 85 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) {
84 // The plugin delegate may have gone away. 86 // The plugin delegate may have gone away.
85 instance_ = init_data_->module->CreateInstance( 87 instance_ = init_data_->module->CreateInstance(
86 init_data_->render_frame, container, init_data_->url); 88 init_data_->render_frame, container, init_data_->url, top_frame_url_);
87 if (!instance_.get()) 89 if (!instance_.get())
88 return false; 90 return false;
89 91
90 // Enable script objects for this plugin. 92 // Enable script objects for this plugin.
91 container->allowScriptObjects(); 93 container->allowScriptObjects();
92 94
93 bool success = instance_->Initialize( 95 bool success = instance_->Initialize(
94 init_data_->arg_names, init_data_->arg_values, full_frame_); 96 init_data_->arg_names, init_data_->arg_values, full_frame_);
95 if (!success) { 97 if (!success) {
96 instance_->Delete(); 98 instance_->Delete();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 274
273 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); } 275 bool PepperWebPluginImpl::canRotateView() { return instance_->CanRotateView(); }
274 276
275 void PepperWebPluginImpl::rotateView(RotationType type) { 277 void PepperWebPluginImpl::rotateView(RotationType type) {
276 instance_->RotateView(type); 278 instance_->RotateView(type);
277 } 279 }
278 280
279 bool PepperWebPluginImpl::isPlaceholder() { return false; } 281 bool PepperWebPluginImpl::isPlaceholder() { return false; }
280 282
281 } // namespace content 283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698