OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/public/web/WebPlugin.h" | 8 #include "third_party/WebKit/public/web/WebPlugin.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/sequenced_task_runner_helpers.h" | 12 #include "base/sequenced_task_runner_helpers.h" |
13 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" | 13 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" |
14 #include "content/renderer/mouse_lock_dispatcher.h" | 14 #include "content/renderer/mouse_lock_dispatcher.h" |
15 #include "content/renderer/render_view_impl.h" | 15 #include "content/renderer/render_view_impl.h" |
16 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 16 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
17 #include "third_party/WebKit/public/web/WebDragStatus.h" | 17 #include "third_party/WebKit/public/web/WebDragStatus.h" |
18 #include "third_party/WebKit/public/web/WebWidget.h" | 18 #include "third_party/WebKit/public/web/WebWidget.h" |
19 | 19 |
20 struct BrowserPluginHostMsg_ResizeGuest_Params; | 20 struct BrowserPluginHostMsg_ResizeGuest_Params; |
21 struct BrowserPluginMsg_UpdateRect_Params; | 21 struct BrowserPluginMsg_UpdateRect_Params; |
22 struct FrameMsg_BuffersSwapped_Params; | 22 struct FrameMsg_BuffersSwapped_Params; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
| 26 class BrowserPluginDelegate; |
26 class ChildFrameCompositingHelper; | 27 class ChildFrameCompositingHelper; |
27 class BrowserPluginManager; | 28 class BrowserPluginManager; |
28 class MockBrowserPlugin; | 29 class MockBrowserPlugin; |
29 | 30 |
30 class CONTENT_EXPORT BrowserPlugin : | 31 class CONTENT_EXPORT BrowserPlugin : |
31 NON_EXPORTED_BASE(public blink::WebPlugin), | 32 NON_EXPORTED_BASE(public blink::WebPlugin), |
32 public MouseLockDispatcher::LockTarget { | 33 public MouseLockDispatcher::LockTarget { |
33 public: | 34 public: |
34 RenderViewImpl* render_view() const { return render_view_.get(); } | 35 RenderViewImpl* render_view() const { return render_view_.get(); } |
35 int render_view_routing_id() const { return render_view_routing_id_; } | 36 int render_view_routing_id() const { return render_view_routing_id_; } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 friend class MockBrowserPlugin; | 159 friend class MockBrowserPlugin; |
159 | 160 |
160 // A BrowserPlugin object is a controller that represents an instance of a | 161 // A BrowserPlugin object is a controller that represents an instance of a |
161 // browser plugin within the embedder renderer process. Once a BrowserPlugin | 162 // browser plugin within the embedder renderer process. Once a BrowserPlugin |
162 // does an initial navigation or is attached to a newly created guest, it | 163 // does an initial navigation or is attached to a newly created guest, it |
163 // acquires a browser_plugin_instance_id as well. The guest instance ID | 164 // acquires a browser_plugin_instance_id as well. The guest instance ID |
164 // uniquely identifies a guest WebContents that's hosted by this | 165 // uniquely identifies a guest WebContents that's hosted by this |
165 // BrowserPlugin. | 166 // BrowserPlugin. |
166 BrowserPlugin(RenderViewImpl* render_view, | 167 BrowserPlugin(RenderViewImpl* render_view, |
167 blink::WebFrame* frame, | 168 blink::WebFrame* frame, |
168 bool auto_navigate); | 169 scoped_ptr<BrowserPluginDelegate> delegate); |
169 | 170 |
170 virtual ~BrowserPlugin(); | 171 virtual ~BrowserPlugin(); |
171 | 172 |
172 int width() const { return plugin_rect_.width(); } | 173 int width() const { return plugin_rect_.width(); } |
173 int height() const { return plugin_rect_.height(); } | 174 int height() const { return plugin_rect_.height(); } |
174 gfx::Size plugin_size() const { return plugin_rect_.size(); } | 175 gfx::Size plugin_size() const { return plugin_rect_.size(); } |
175 gfx::Rect plugin_rect() const { return plugin_rect_; } | 176 gfx::Rect plugin_rect() const { return plugin_rect_; } |
176 | 177 |
177 // Virtual to allow for mocking in tests. | 178 // Virtual to allow for mocking in tests. |
178 virtual float GetDeviceScaleFactor() const; | 179 virtual float GetDeviceScaleFactor() const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 float last_device_scale_factor_; | 218 float last_device_scale_factor_; |
218 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 219 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
219 SkBitmap* sad_guest_; | 220 SkBitmap* sad_guest_; |
220 bool guest_crashed_; | 221 bool guest_crashed_; |
221 int content_window_routing_id_; | 222 int content_window_routing_id_; |
222 bool plugin_focused_; | 223 bool plugin_focused_; |
223 // Tracks the visibility of the browser plugin regardless of the whole | 224 // Tracks the visibility of the browser plugin regardless of the whole |
224 // embedder RenderView's visibility. | 225 // embedder RenderView's visibility. |
225 bool visible_; | 226 bool visible_; |
226 | 227 |
227 const bool auto_navigate_; | |
228 std::string html_string_; | |
229 | |
230 WebCursor cursor_; | 228 WebCursor cursor_; |
231 | 229 |
232 gfx::Size last_view_size_; | 230 gfx::Size last_view_size_; |
233 bool mouse_locked_; | 231 bool mouse_locked_; |
234 | 232 |
235 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 233 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
236 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 234 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
237 // avoid accessing the RenderViewImpl. | 235 // avoid accessing the RenderViewImpl. |
238 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 236 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
239 | 237 |
240 // Used for HW compositing. | 238 // Used for HW compositing. |
241 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 239 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
242 | 240 |
243 // Used to identify the plugin to WebBindings. | 241 // Used to identify the plugin to WebBindings. |
244 scoped_ptr<struct _NPP> npp_; | 242 scoped_ptr<struct _NPP> npp_; |
245 | 243 |
246 // URL for the embedder frame. | 244 // URL for the embedder frame. |
247 int browser_plugin_instance_id_; | 245 int browser_plugin_instance_id_; |
248 | 246 |
249 std::vector<EditCommand> edit_commands_; | 247 std::vector<EditCommand> edit_commands_; |
250 | 248 |
| 249 scoped_ptr<BrowserPluginDelegate> delegate_; |
| 250 |
251 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 251 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
252 // get called after BrowserPlugin has been destroyed. | 252 // get called after BrowserPlugin has been destroyed. |
253 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 253 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
254 | 254 |
255 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 255 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
256 }; | 256 }; |
257 | 257 |
258 } // namespace content | 258 } // namespace content |
259 | 259 |
260 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 260 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |