OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
7 | 7 |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/sequenced_task_runner_helpers.h" | 11 #include "base/sequenced_task_runner_helpers.h" |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
14 #endif | 14 #endif |
15 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h" | 15 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h" |
16 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" | 16 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" |
17 #include "content/renderer/render_view_impl.h" | 17 #include "content/renderer/render_view_impl.h" |
18 | 18 |
| 19 struct BrowserPluginHostMsg_ResizeGuest_Params; |
19 struct BrowserPluginMsg_UpdateRect_Params; | 20 struct BrowserPluginMsg_UpdateRect_Params; |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 class BrowserPluginManager; | 24 class BrowserPluginManager; |
24 class MockBrowserPlugin; | 25 class MockBrowserPlugin; |
25 | 26 |
26 class CONTENT_EXPORT BrowserPlugin : | 27 class CONTENT_EXPORT BrowserPlugin : |
27 NON_EXPORTED_BASE(public WebKit::WebPlugin) { | 28 NON_EXPORTED_BASE(public WebKit::WebPlugin) { |
28 public: | 29 public: |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int width() const { return plugin_rect_.width(); } | 131 int width() const { return plugin_rect_.width(); } |
131 int height() const { return plugin_rect_.height(); } | 132 int height() const { return plugin_rect_.height(); } |
132 | 133 |
133 // Virtual to allow for mocking in tests. | 134 // Virtual to allow for mocking in tests. |
134 virtual float GetDeviceScaleFactor() const; | 135 virtual float GetDeviceScaleFactor() const; |
135 | 136 |
136 // Parses the attributes of the browser plugin from the element's attributes | 137 // Parses the attributes of the browser plugin from the element's attributes |
137 // and sets them appropriately. | 138 // and sets them appropriately. |
138 void ParseAttributes(const WebKit::WebPluginParams& params); | 139 void ParseAttributes(const WebKit::WebPluginParams& params); |
139 | 140 |
| 141 // Returns the pending resize guest param if there is one. Returns a param |
| 142 // with invalid transport dib otherwise. |
| 143 BrowserPluginHostMsg_ResizeGuest_Params* GetPendingResizeParams(); |
| 144 |
140 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 145 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
141 // is destroyed. | 146 // is destroyed. |
142 void RemoveEventListeners(); | 147 void RemoveEventListeners(); |
| 148 // Frees up the damage buffer if there is one. |
| 149 void FreeDamageBuffer(); |
143 | 150 |
144 int instance_id_; | 151 int instance_id_; |
145 RenderViewImpl* render_view_; | 152 RenderViewImpl* render_view_; |
146 WebKit::WebPluginContainer* container_; | 153 WebKit::WebPluginContainer* container_; |
147 scoped_ptr<BrowserPluginBindings> bindings_; | 154 scoped_ptr<BrowserPluginBindings> bindings_; |
148 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 155 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
149 TransportDIB* damage_buffer_; | 156 TransportDIB* damage_buffer_; |
150 gfx::Rect plugin_rect_; | 157 gfx::Rect plugin_rect_; |
151 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 158 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
152 SkBitmap* sad_guest_; | 159 SkBitmap* sad_guest_; |
153 bool guest_crashed_; | 160 bool guest_crashed_; |
154 bool resize_pending_; | 161 bool resize_pending_; |
| 162 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
155 // True if we have ever sent a NavigateGuest message to the embedder. | 163 // True if we have ever sent a NavigateGuest message to the embedder. |
156 bool navigate_src_sent_; | 164 bool navigate_src_sent_; |
157 std::string src_; | 165 std::string src_; |
158 int process_id_; | 166 int process_id_; |
159 std::string storage_partition_id_; | 167 std::string storage_partition_id_; |
160 bool persist_storage_; | 168 bool persist_storage_; |
161 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 169 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
162 typedef std::map<std::string, EventListeners> EventListenerMap; | 170 typedef std::map<std::string, EventListeners> EventListenerMap; |
163 EventListenerMap event_listener_map_; | 171 EventListenerMap event_listener_map_; |
164 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
165 base::SharedMemory shared_memory_; | 173 base::SharedMemory shared_memory_; |
166 #endif | 174 #endif |
167 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 175 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
168 }; | 176 }; |
169 | 177 |
170 } // namespace content | 178 } // namespace content |
171 | 179 |
172 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 180 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |