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