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 COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ |
6 #define COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ | 6 #define COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "components/plugins/renderer/plugin_placeholder.h" | 9 #include "components/plugins/renderer/plugin_placeholder.h" |
10 #include "content/public/common/webplugininfo.h" | 10 #include "content/public/common/webplugininfo.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 // gin::Wrappable method: | 79 // gin::Wrappable method: |
80 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 80 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
81 v8::Isolate* isolate) override; | 81 v8::Isolate* isolate) override; |
82 | 82 |
83 private: | 83 private: |
84 // WebViewPlugin::Delegate methods: | 84 // WebViewPlugin::Delegate methods: |
85 void PluginDestroyed() override; | 85 void PluginDestroyed() override; |
86 v8::Local<v8::Object> GetV8ScriptableObject( | 86 v8::Local<v8::Object> GetV8ScriptableObject( |
87 v8::Isolate* isolate) const override; | 87 v8::Isolate* isolate) const override; |
88 #if defined(ENABLE_PLUGINS) | |
89 void OnUnobscuredSizeUpdate(const gfx::Size& unobscured_size) override; | |
90 #endif | |
88 | 91 |
89 // RenderFrameObserver methods: | 92 // RenderFrameObserver methods: |
90 void WasShown() override; | 93 void WasShown() override; |
91 | 94 |
92 // Javascript callbacks: | 95 // Javascript callbacks: |
93 void LoadCallback(); | 96 void LoadCallback(); |
94 void HideCallback(); | 97 void HideCallback(); |
95 void DidFinishLoadingCallback(); | 98 void DidFinishLoadingCallback(); |
96 | 99 |
97 void UpdateMessage(); | 100 void UpdateMessage(); |
98 | 101 |
99 bool LoadingBlocked() const; | 102 bool LoadingBlocked() const; |
103 #if defined(ENABLE_PLUGINS) | |
104 void RecheckSizeAndMaybeUnthrottle(); | |
105 #endif | |
100 | 106 |
101 // Plugin creation is embedder-specific. | 107 // Plugin creation is embedder-specific. |
102 virtual blink::WebPlugin* CreatePlugin() = 0; | 108 virtual blink::WebPlugin* CreatePlugin() = 0; |
103 | 109 |
104 content::WebPluginInfo plugin_info_; | 110 content::WebPluginInfo plugin_info_; |
105 | 111 |
106 base::string16 message_; | 112 base::string16 message_; |
107 | 113 |
108 // True if the plugin load was deferred due to page being a background tab. | 114 // True if the plugin load was deferred due to page being a background tab. |
109 // Plugin may be automatically loaded when the page is foregrounded. | 115 // Plugin may be automatically loaded when the page is foregrounded. |
(...skipping 12 matching lines...) Expand all Loading... | |
122 | 128 |
123 // When we load, uses this premade plugin instead of creating a new one. | 129 // When we load, uses this premade plugin instead of creating a new one. |
124 content::PluginInstanceThrottler* premade_throttler_; | 130 content::PluginInstanceThrottler* premade_throttler_; |
125 | 131 |
126 bool allow_loading_; | 132 bool allow_loading_; |
127 | 133 |
128 bool hidden_; | 134 bool hidden_; |
129 bool finished_loading_; | 135 bool finished_loading_; |
130 std::string identifier_; | 136 std::string identifier_; |
131 | 137 |
138 // Used to prevent re-entrancy during the size recheck for throttled plugins. | |
139 bool in_size_recheck_; | |
140 gfx::Size unobscured_size_; | |
141 | |
142 // A separate weak factory so we can schedule, coalesce and cancel unthrottle | |
143 // calls due to plugin size updates. | |
144 base::WeakPtrFactory<LoadablePluginPlaceholder> size_update_weak_factory_; | |
groby-ooo-7-16
2015/06/05 23:03:45
You can skip the WeakPtrFactory thing, and instead
tommycli
2015/06/06 01:23:22
Delaying this change per offline discussion.
| |
145 | |
132 base::WeakPtrFactory<LoadablePluginPlaceholder> weak_factory_; | 146 base::WeakPtrFactory<LoadablePluginPlaceholder> weak_factory_; |
133 | 147 |
134 DISALLOW_COPY_AND_ASSIGN(LoadablePluginPlaceholder); | 148 DISALLOW_COPY_AND_ASSIGN(LoadablePluginPlaceholder); |
135 }; | 149 }; |
136 | 150 |
137 } // namespace plugins | 151 } // namespace plugins |
138 | 152 |
139 #endif // COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ | 153 #endif // COMPONENTS_PLUGINS_RENDERER_LOADABLE_PLUGIN_PLACEHOLDER_H_ |
OLD | NEW |