| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 void PluginPreroller::OnThrottleStateChange() { | 60 void PluginPreroller::OnThrottleStateChange() { |
| 61 if (!throttler_->IsThrottled()) | 61 if (!throttler_->IsThrottled()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 ChromePluginPlaceholder* placeholder = | 64 ChromePluginPlaceholder* placeholder = |
| 65 ChromePluginPlaceholder::CreateBlockedPlugin( | 65 ChromePluginPlaceholder::CreateBlockedPlugin( |
| 66 render_frame(), frame_, params_, info_, identifier_, name_, | 66 render_frame(), frame_, params_, info_, identifier_, name_, |
| 67 IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_); | 67 IDR_PLUGIN_POSTER_HTML, message_, keyframe_data_url_); |
| 68 placeholder->SetPremadePlugin(plugin_, throttler_); | 68 placeholder->SetPremadePlugin(plugin_, throttler_); |
| 69 placeholder->set_power_saver_mode( | 69 placeholder->set_power_saver_enabled(true); |
| 70 content::PluginPowerSaverMode::POWER_SAVER_MODE_PERIPHERAL_THROTTLED); | |
| 71 placeholder->set_allow_loading(true); | 70 placeholder->set_allow_loading(true); |
| 72 | 71 |
| 73 blink::WebPluginContainer* container = plugin_->container(); | 72 blink::WebPluginContainer* container = plugin_->container(); |
| 74 container->setPlugin(placeholder->plugin()); | 73 container->setPlugin(placeholder->plugin()); |
| 75 | 74 |
| 76 bool success = placeholder->plugin()->initialize(container); | 75 bool success = placeholder->plugin()->initialize(container); |
| 77 DCHECK(success); | 76 DCHECK(success); |
| 78 | 77 |
| 79 container->invalidate(); | 78 container->invalidate(); |
| 80 container->reportGeometry(); | 79 container->reportGeometry(); |
| 81 | 80 |
| 82 delete this; | 81 delete this; |
| 83 } | 82 } |
| 84 | 83 |
| 85 void PluginPreroller::OnThrottlerDestroyed() { | 84 void PluginPreroller::OnThrottlerDestroyed() { |
| 86 throttler_ = nullptr; | 85 throttler_ = nullptr; |
| 87 delete this; | 86 delete this; |
| 88 } | 87 } |
| OLD | NEW |