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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 int height() const { return plugin_rect_.height(); } | 125 int height() const { return plugin_rect_.height(); } |
125 | 126 |
126 // Virtual to allow for mocking in tests. | 127 // Virtual to allow for mocking in tests. |
127 virtual float GetDeviceScaleFactor() const; | 128 virtual float GetDeviceScaleFactor() const; |
128 | 129 |
129 // Parses the source URL of the browser plugin from the element's attributes | 130 // Parses the source URL of the browser plugin from the element's attributes |
130 // and outputs them. | 131 // and outputs them. |
131 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, | 132 bool ParseSrcAttribute(const WebKit::WebPluginParams& params, |
132 std::string* src); | 133 std::string* src); |
133 | 134 |
| 135 // Returns the pending resize guest param if there is one. Returns a param |
| 136 // with invalid transport dib otherwise. |
| 137 BrowserPluginHostMsg_ResizeGuest_Params* GetPendingResizeParams(); |
| 138 |
134 // Cleanup event listener state to free v8 resources when a BrowserPlugin | 139 // Cleanup event listener state to free v8 resources when a BrowserPlugin |
135 // is destroyed. | 140 // is destroyed. |
136 void RemoveEventListeners(); | 141 void RemoveEventListeners(); |
137 | 142 |
138 int instance_id_; | 143 int instance_id_; |
139 RenderViewImpl* render_view_; | 144 RenderViewImpl* render_view_; |
140 WebKit::WebPluginContainer* container_; | 145 WebKit::WebPluginContainer* container_; |
141 scoped_ptr<BrowserPluginBindings> bindings_; | 146 scoped_ptr<BrowserPluginBindings> bindings_; |
142 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 147 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
143 TransportDIB* damage_buffer_; | 148 TransportDIB* damage_buffer_; |
144 gfx::Rect plugin_rect_; | 149 gfx::Rect plugin_rect_; |
145 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 150 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
146 SkBitmap* sad_guest_; | 151 SkBitmap* sad_guest_; |
147 bool guest_crashed_; | 152 bool guest_crashed_; |
148 bool resize_pending_; | 153 bool resize_pending_; |
| 154 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
149 // True if we have ever sent a NavigateGuest message to the embedder. | 155 // True if we have ever sent a NavigateGuest message to the embedder. |
150 bool navigate_src_sent_; | 156 bool navigate_src_sent_; |
151 int64 parent_frame_; | 157 int64 parent_frame_; |
152 std::string src_; | 158 std::string src_; |
153 int process_id_; | 159 int process_id_; |
154 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; | 160 typedef std::vector<v8::Persistent<v8::Function> > EventListeners; |
155 typedef std::map<std::string, EventListeners> EventListenerMap; | 161 typedef std::map<std::string, EventListeners> EventListenerMap; |
156 EventListenerMap event_listener_map_; | 162 EventListenerMap event_listener_map_; |
157 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
158 base::SharedMemory shared_memory_; | 164 base::SharedMemory shared_memory_; |
159 #endif | 165 #endif |
160 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 166 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
161 }; | 167 }; |
162 | 168 |
163 } // namespace content | 169 } // namespace content |
164 | 170 |
165 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 171 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |