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