| 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 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |
| 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ | 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/common/webplugininfo.h" | 9 #include "content/public/common/webplugininfo.h" |
| 10 #include "content/public/renderer/plugin_instance_throttler.h" | 10 #include "content/public/renderer/plugin_instance_throttler.h" |
| 11 #include "content/public/renderer/render_frame_observer.h" | 11 #include "content/public/renderer/render_frame_observer.h" |
| 12 #include "third_party/WebKit/public/web/WebPluginParams.h" | 12 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace blink { | |
| 16 class WebLocalFrame; | |
| 17 } | |
| 18 | |
| 19 class SkBitmap; | 15 class SkBitmap; |
| 20 | 16 |
| 21 // This class manages a plugin briefly for the purposes of keyframe extraction. | 17 // This class manages a plugin briefly for the purposes of keyframe extraction. |
| 22 // Once a keyframe has been extracted, this class will replace the plugin with | 18 // Once a keyframe has been extracted, this class will replace the plugin with |
| 23 // a ChromePluginPlaceholder. The actual plugin will continue to live in a | 19 // a ChromePluginPlaceholder. The actual plugin will continue to live in a |
| 24 // throttled state. This class manages its own lifetime. | 20 // throttled state. This class manages its own lifetime. |
| 25 class PluginPreroller : public content::PluginInstanceThrottler::Observer, | 21 class PluginPreroller : public content::PluginInstanceThrottler::Observer, |
| 26 public content::RenderFrameObserver { | 22 public content::RenderFrameObserver { |
| 27 public: | 23 public: |
| 28 // Does not take ownership of either |plugin| or |throttler|. | 24 // Does not take ownership of |render_frame|, |plugin|, or |throttler|. |
| 29 PluginPreroller(content::RenderFrame* render_frame, | 25 PluginPreroller(content::RenderFrame* render_frame, |
| 30 blink::WebLocalFrame* frame, | |
| 31 const blink::WebPluginParams& params, | 26 const blink::WebPluginParams& params, |
| 32 const content::WebPluginInfo& info, | 27 const content::WebPluginInfo& info, |
| 33 const std::string& identifier, | 28 const std::string& identifier, |
| 34 const base::string16& name, | 29 const base::string16& name, |
| 35 const base::string16& message, | 30 const base::string16& message, |
| 36 content::PluginInstanceThrottler* throttler); | 31 content::PluginInstanceThrottler* throttler); |
| 37 | 32 |
| 38 ~PluginPreroller() override; | 33 ~PluginPreroller() override; |
| 39 | 34 |
| 40 private: | 35 private: |
| 41 // content::PluginInstanceThrottler::Observer methods: | 36 // content::PluginInstanceThrottler::Observer methods: |
| 42 void OnKeyframeExtracted(const SkBitmap* bitmap) override; | 37 void OnKeyframeExtracted(const SkBitmap* bitmap) override; |
| 43 void OnThrottleStateChange() override; | 38 void OnThrottleStateChange() override; |
| 44 void OnThrottlerDestroyed() override; | 39 void OnThrottlerDestroyed() override; |
| 45 | 40 |
| 46 // content::RenderFrameObserver implementation. | 41 // content::RenderFrameObserver implementation. |
| 47 void OnDestruct() override; | 42 void OnDestruct() override; |
| 48 | 43 |
| 49 blink::WebLocalFrame* frame_; | |
| 50 blink::WebPluginParams params_; | 44 blink::WebPluginParams params_; |
| 51 content::WebPluginInfo info_; | 45 content::WebPluginInfo info_; |
| 52 std::string identifier_; | 46 std::string identifier_; |
| 53 base::string16 name_; | 47 base::string16 name_; |
| 54 base::string16 message_; | 48 base::string16 message_; |
| 55 | 49 |
| 56 content::PluginInstanceThrottler* throttler_; | 50 content::PluginInstanceThrottler* throttler_; |
| 57 | 51 |
| 58 GURL keyframe_data_url_; | 52 GURL keyframe_data_url_; |
| 59 | 53 |
| 60 DISALLOW_COPY_AND_ASSIGN(PluginPreroller); | 54 DISALLOW_COPY_AND_ASSIGN(PluginPreroller); |
| 61 }; | 55 }; |
| 62 | 56 |
| 63 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ | 57 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |
| OLD | NEW |