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

Side by Side Diff: components/plugins/renderer/plugin_placeholder.cc

Issue 981623003: Plugin Power Saver: Implement srcset syntax for posters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add device scale factor hackery. Created 5 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/plugins/renderer/plugin_placeholder.h" 5 #include "components/plugins/renderer/plugin_placeholder.h"
6 6
7 #include "content/public/renderer/render_frame.h" 7 #include "content/public/renderer/render_frame.h"
8 8
9 namespace plugins { 9 namespace plugins {
10 10
11 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; 11 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin};
12 12
13 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, 13 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame,
14 blink::WebLocalFrame* frame, 14 blink::WebLocalFrame* frame,
15 const blink::WebPluginParams& params, 15 const blink::WebPluginParams& params,
16 const std::string& html_data, 16 const std::string& html_data,
17 GURL placeholderDataUrl) 17 GURL placeholderDataUrl)
18 : content::RenderFrameObserver(render_frame), 18 : content::RenderFrameObserver(render_frame),
19 frame_(frame), 19 frame_(frame),
20 plugin_params_(params), 20 plugin_params_(params),
21 plugin_(WebViewPlugin::Create(this, 21 plugin_(WebViewPlugin::Create(this,
22 render_frame->GetWebkitPreferences(), 22 render_frame->GetWebkitPreferences(),
23 html_data, 23 html_data,
24 placeholderDataUrl)) { 24 placeholderDataUrl)) {
25 DCHECK(placeholderDataUrl.is_valid())
26 << "Blink requires the placeholder to have a valid URL.";
25 } 27 }
26 28
27 PluginPlaceholder::~PluginPlaceholder() {} 29 PluginPlaceholder::~PluginPlaceholder() {}
28 30
29 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { 31 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const {
30 return plugin_params_; 32 return plugin_params_;
31 } 33 }
32 34
33 void PluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) { 35 void PluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) {
34 // Does nothing by default. Will be overridden if a specific browser wants 36 // Does nothing by default. Will be overridden if a specific browser wants
35 // a context menu. 37 // a context menu.
36 return; 38 return;
37 } 39 }
38 40
39 void PluginPlaceholder::PluginDestroyed() { 41 void PluginPlaceholder::PluginDestroyed() {
40 plugin_ = NULL; 42 plugin_ = NULL;
41 } 43 }
42 44
43 void PluginPlaceholder::OnDestruct() { 45 void PluginPlaceholder::OnDestruct() {
44 frame_ = NULL; 46 frame_ = NULL;
45 } 47 }
46 48
47 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; } 49 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; }
48 50
49 } // namespace plugins 51 } // namespace plugins
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698