Chromium Code Reviews| 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 | |
| 13 namespace blink { | |
| 14 class WebPlugin; | |
| 15 class WebLocalFrame; | |
| 16 } | |
| 17 | |
| 18 class SkBitmap; | |
| 19 | |
| 20 // This class manages a plugin briefly for the purposes of keyframe extraction. | |
| 21 // Once a keyframe has been extracted, this class will replace it with a | |
| 22 // ChromePluginPlaceholder. The actual plugin will continue to live in a | |
| 23 // throttled state. This class manages its own lifetime. | |
| 24 class PluginPreroller : public content::PluginInstanceThrottler::Observer { | |
| 25 public: | |
| 26 // Does not take ownership of either |plugin| or |throttler|. | |
| 27 PluginPreroller(content::RenderFrame* render_frame, | |
| 28 blink::WebLocalFrame* frame, | |
| 29 const blink::WebPluginParams& params, | |
| 30 const content::WebPluginInfo& info, | |
| 31 const std::string& identifier, | |
| 32 const base::string16& name, | |
| 33 const base::string16& message, | |
| 34 blink::WebPlugin* plugin, | |
| 35 content::PluginInstanceThrottler* throttler); | |
| 36 | |
| 37 virtual ~PluginPreroller(); | |
| 38 | |
| 39 blink::WebPlugin* plugin() { return plugin_; } | |
| 40 | |
| 41 private: | |
| 42 // content::PluginInstanceThrottler::Observer methods: | |
| 43 void OnKeyframeExtracted(const SkBitmap* bitmap) override; | |
| 44 void OnThrottleStateChange() override; | |
| 45 void OnThrottlerDestroyed() override; | |
| 46 | |
| 47 content::RenderFrame* render_frame_; | |
| 48 blink::WebLocalFrame* frame_; | |
| 49 blink::WebPluginParams params_; | |
| 50 content::WebPluginInfo info_; | |
| 51 std::string identifier_; | |
| 52 base::string16 name_; | |
| 53 base::string16 message_; | |
| 54 | |
| 55 blink::WebPlugin* plugin_; | |
| 56 content::PluginInstanceThrottler* throttler_; | |
| 57 | |
| 58 std::string keyframe_data_url_; | |
|
Bernhard Bauer
2015/01/30 14:12:56
Any reason you're not storing this directly as a G
tommycli
2015/01/30 17:02:40
Done.
| |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(PluginPreroller); | |
| 61 }; | |
| 62 | |
| 63 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ | |
| OLD | NEW |