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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 | 157 |
157 // For unit/integration tests. | 158 // For unit/integration tests. |
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. |
167 // Takes ownership of |delegate| if there's one. | |
Ken Rockot(use gerrit already)
2014/09/04 00:57:43
Could you just make the argument a scoped_ptr so t
lazyboy
2014/09/04 18:59:33
Done.
| |
166 BrowserPlugin(RenderViewImpl* render_view, | 168 BrowserPlugin(RenderViewImpl* render_view, |
167 blink::WebFrame* frame, | 169 blink::WebFrame* frame, |
168 bool auto_navigate); | 170 BrowserPluginDelegate* delegate); |
169 | 171 |
170 virtual ~BrowserPlugin(); | 172 virtual ~BrowserPlugin(); |
171 | 173 |
172 int width() const { return plugin_rect_.width(); } | 174 int width() const { return plugin_rect_.width(); } |
173 int height() const { return plugin_rect_.height(); } | 175 int height() const { return plugin_rect_.height(); } |
174 gfx::Size plugin_size() const { return plugin_rect_.size(); } | 176 gfx::Size plugin_size() const { return plugin_rect_.size(); } |
175 gfx::Rect plugin_rect() const { return plugin_rect_; } | 177 gfx::Rect plugin_rect() const { return plugin_rect_; } |
176 | 178 |
177 // Virtual to allow for mocking in tests. | 179 // Virtual to allow for mocking in tests. |
178 virtual float GetDeviceScaleFactor() const; | 180 virtual float GetDeviceScaleFactor() const; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 float last_device_scale_factor_; | 229 float last_device_scale_factor_; |
228 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 230 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
229 SkBitmap* sad_guest_; | 231 SkBitmap* sad_guest_; |
230 bool guest_crashed_; | 232 bool guest_crashed_; |
231 int content_window_routing_id_; | 233 int content_window_routing_id_; |
232 bool plugin_focused_; | 234 bool plugin_focused_; |
233 // Tracks the visibility of the browser plugin regardless of the whole | 235 // Tracks the visibility of the browser plugin regardless of the whole |
234 // embedder RenderView's visibility. | 236 // embedder RenderView's visibility. |
235 bool visible_; | 237 bool visible_; |
236 | 238 |
237 const bool auto_navigate_; | |
238 std::string html_string_; | |
239 | |
240 WebCursor cursor_; | 239 WebCursor cursor_; |
241 | 240 |
242 gfx::Size last_view_size_; | 241 gfx::Size last_view_size_; |
243 bool mouse_locked_; | 242 bool mouse_locked_; |
244 | 243 |
245 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 244 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
246 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 245 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
247 // avoid accessing the RenderViewImpl. | 246 // avoid accessing the RenderViewImpl. |
248 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 247 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
249 | 248 |
250 // Used for HW compositing. | 249 // Used for HW compositing. |
251 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 250 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
252 | 251 |
253 // Used to identify the plugin to WebBindings. | 252 // Used to identify the plugin to WebBindings. |
254 scoped_ptr<struct _NPP> npp_; | 253 scoped_ptr<struct _NPP> npp_; |
255 | 254 |
256 // URL for the embedder frame. | 255 // URL for the embedder frame. |
257 int browser_plugin_instance_id_; | 256 int browser_plugin_instance_id_; |
258 | 257 |
259 std::vector<EditCommand> edit_commands_; | 258 std::vector<EditCommand> edit_commands_; |
260 | 259 |
260 scoped_ptr<BrowserPluginDelegate> delegate_; | |
261 | |
261 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 262 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
262 // get called after BrowserPlugin has been destroyed. | 263 // get called after BrowserPlugin has been destroyed. |
263 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 264 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
264 | 265 |
265 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 266 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
266 }; | 267 }; |
267 | 268 |
268 } // namespace content | 269 } // namespace content |
269 | 270 |
270 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 271 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |