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

Side by Side Diff: chrome/renderer/plugins/plugin_preroller.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/renderer/plugins/plugin_preroller.h" 5 #include "chrome/renderer/plugins/plugin_preroller.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "chrome/grit/renderer_resources.h" 8 #include "chrome/grit/renderer_resources.h"
9 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 9 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
10 #include "third_party/WebKit/public/platform/WebRect.h" 10 #include "third_party/WebKit/public/platform/WebRect.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 keyframe_data_url_ = GURL(data_url_header + data_url_body); 54 keyframe_data_url_ = GURL(data_url_header + data_url_body);
55 } 55 }
56 56
57 void PluginPreroller::OnThrottleStateChange() { 57 void PluginPreroller::OnThrottleStateChange() {
58 if (!throttler_->IsThrottled()) 58 if (!throttler_->IsThrottled())
59 return; 59 return;
60 60
61 ChromePluginPlaceholder* placeholder = 61 ChromePluginPlaceholder* placeholder =
62 ChromePluginPlaceholder::CreateBlockedPlugin( 62 ChromePluginPlaceholder::CreateBlockedPlugin(
63 render_frame(), frame_, params_, info_, identifier_, name_, 63 render_frame(), frame_, params_, info_, identifier_, name_,
64 IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_); 64 IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_.spec(), GURL());
65 placeholder->SetPremadePlugin(throttler_); 65 placeholder->SetPremadePlugin(throttler_);
66 placeholder->set_power_saver_enabled(true); 66 placeholder->set_power_saver_enabled(true);
67 placeholder->set_allow_loading(true); 67 placeholder->set_allow_loading(true);
68 68
69 blink::WebPluginContainer* container = 69 blink::WebPluginContainer* container =
70 throttler_->GetWebPlugin()->container(); 70 throttler_->GetWebPlugin()->container();
71 container->setPlugin(placeholder->plugin()); 71 container->setPlugin(placeholder->plugin());
72 72
73 bool success = placeholder->plugin()->initialize(container); 73 bool success = placeholder->plugin()->initialize(container);
74 DCHECK(success); 74 DCHECK(success);
75 75
76 container->invalidate(); 76 container->invalidate();
77 container->reportGeometry(); 77 container->reportGeometry();
78 78
79 delete this; 79 delete this;
80 } 80 }
81 81
82 void PluginPreroller::OnThrottlerDestroyed() { 82 void PluginPreroller::OnThrottlerDestroyed() {
83 throttler_ = nullptr; 83 throttler_ = nullptr;
84 delete this; 84 delete this;
85 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698