| 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 // Creates and maps transport dib. Overridden in tests. |
| 149 virtual TransportDIB* CreateTransportDIB(const size_t size); |
| 150 // Frees up the damage buffer. Overridden in tests. |
| 151 virtual void FreeDamageBuffer(); |
| 143 | 152 |
| 144 int instance_id_; | 153 int instance_id_; |
| 145 RenderViewImpl* render_view_; | 154 RenderViewImpl* render_view_; |
| 146 WebKit::WebPluginContainer* container_; | 155 WebKit::WebPluginContainer* container_; |
| 147 scoped_ptr<BrowserPluginBindings> bindings_; | 156 scoped_ptr<BrowserPluginBindings> bindings_; |
| 148 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 157 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
| 149 TransportDIB* damage_buffer_; | 158 TransportDIB* damage_buffer_; |
| 150 gfx::Rect plugin_rect_; | 159 gfx::Rect plugin_rect_; |
| 151 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 160 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
| 152 SkBitmap* sad_guest_; | 161 SkBitmap* sad_guest_; |
| 153 bool guest_crashed_; | 162 bool guest_crashed_; |
| 154 bool resize_pending_; | 163 bool resize_pending_; |
| 164 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
| 155 // True if we have ever sent a NavigateGuest message to the embedder. | 165 // True if we have ever sent a NavigateGuest message to the embedder. |
| 156 bool navigate_src_sent_; | 166 bool navigate_src_sent_; |
| 157 std::string src_; | 167 std::string src_; |
| 158 int process_id_; | 168 int process_id_; |
| 159 std::string storage_partition_id_; | 169 std::string storage_partition_id_; |
| 160 bool persist_storage_; | 170 bool persist_storage_; |
| 161 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 171 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
| 162 typedef std::map<std::string, EventListeners> EventListenerMap; | 172 typedef std::map<std::string, EventListeners> EventListenerMap; |
| 163 EventListenerMap event_listener_map_; | 173 EventListenerMap event_listener_map_; |
| 164 #if defined(OS_WIN) | 174 #if defined(OS_WIN) |
| 165 base::SharedMemory shared_memory_; | 175 base::SharedMemory shared_memory_; |
| 166 #endif | 176 #endif |
| 167 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 177 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
| 168 }; | 178 }; |
| 169 | 179 |
| 170 } // namespace content | 180 } // namespace content |
| 171 | 181 |
| 172 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 182 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
| OLD | NEW |