| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 int width() const { return plugin_rect_.width(); } | 144 int width() const { return plugin_rect_.width(); } |
| 144 int height() const { return plugin_rect_.height(); } | 145 int height() const { return plugin_rect_.height(); } |
| 145 | 146 |
| 146 // Virtual to allow for mocking in tests. | 147 // Virtual to allow for mocking in tests. |
| 147 virtual float GetDeviceScaleFactor() const; | 148 virtual float GetDeviceScaleFactor() const; |
| 148 | 149 |
| 149 // Parses the attributes of the browser plugin from the element's attributes | 150 // Parses the attributes of the browser plugin from the element's attributes |
| 150 // and sets them appropriately. | 151 // and sets them appropriately. |
| 151 void ParseAttributes(const WebKit::WebPluginParams& params); | 152 void ParseAttributes(const WebKit::WebPluginParams& params); |
| 152 | 153 |
| 154 // Returns the pending resize guest param if there is one. Returns a param |
| 155 // with invalid transport dib otherwise. |
| 156 BrowserPluginHostMsg_ResizeGuest_Params* GetPendingResizeParams(); |
| 157 |
| 153 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 158 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
| 154 // is destroyed. | 159 // is destroyed. |
| 155 void RemoveEventListeners(); | 160 void RemoveEventListeners(); |
| 161 // Creates and maps transport dib. Overridden in tests. |
| 162 virtual TransportDIB* CreateTransportDIB(const size_t size); |
| 163 // Frees up the damage buffer. Overridden in tests. |
| 164 virtual void FreeDamageBuffer(); |
| 156 | 165 |
| 157 int instance_id_; | 166 int instance_id_; |
| 158 RenderViewImpl* render_view_; | 167 RenderViewImpl* render_view_; |
| 159 WebKit::WebPluginContainer* container_; | 168 WebKit::WebPluginContainer* container_; |
| 160 scoped_ptr<BrowserPluginBindings> bindings_; | 169 scoped_ptr<BrowserPluginBindings> bindings_; |
| 161 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 170 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
| 162 TransportDIB* damage_buffer_; | 171 TransportDIB* damage_buffer_; |
| 163 gfx::Rect plugin_rect_; | 172 gfx::Rect plugin_rect_; |
| 164 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 173 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
| 165 SkBitmap* sad_guest_; | 174 SkBitmap* sad_guest_; |
| 166 bool guest_crashed_; | 175 bool guest_crashed_; |
| 167 bool resize_pending_; | 176 bool resize_pending_; |
| 177 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
| 168 // True if we have ever sent a NavigateGuest message to the embedder. | 178 // True if we have ever sent a NavigateGuest message to the embedder. |
| 169 bool navigate_src_sent_; | 179 bool navigate_src_sent_; |
| 170 std::string src_; | 180 std::string src_; |
| 171 int process_id_; | 181 int process_id_; |
| 172 std::string storage_partition_id_; | 182 std::string storage_partition_id_; |
| 173 bool persist_storage_; | 183 bool persist_storage_; |
| 174 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 184 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 175 typedef std::map<std::string, EventListeners> EventListenerMap; | 185 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 176 EventListenerMap event_listener_map_; | 186 EventListenerMap event_listener_map_; |
| 177 #if defined(OS_WIN) | 187 #if defined(OS_WIN) |
| 178 base::SharedMemory shared_memory_; | 188 base::SharedMemory shared_memory_; |
| 179 #endif | 189 #endif |
| 180 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 190 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 181 }; | 191 }; |
| 182 | 192 |
| 183 } // namespace content | 193 } // namespace content |
| 184 | 194 |
| 185 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 195 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |