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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 friend class MockBrowserPlugin; | 161 friend class MockBrowserPlugin; |
161 | 162 |
162 // A BrowserPlugin object is a controller that represents an instance of a | 163 // A BrowserPlugin object is a controller that represents an instance of a |
163 // browser plugin within the embedder renderer process. Once a BrowserPlugin | 164 // browser plugin within the embedder renderer process. Once a BrowserPlugin |
164 // does an initial navigation or is attached to a newly created guest, it | 165 // does an initial navigation or is attached to a newly created guest, it |
165 // acquires a browser_plugin_instance_id as well. The guest instance ID | 166 // acquires a browser_plugin_instance_id as well. The guest instance ID |
166 // uniquely identifies a guest WebContents that's hosted by this | 167 // uniquely identifies a guest WebContents that's hosted by this |
167 // BrowserPlugin. | 168 // BrowserPlugin. |
168 BrowserPlugin(RenderViewImpl* render_view, | 169 BrowserPlugin(RenderViewImpl* render_view, |
169 blink::WebFrame* frame, | 170 blink::WebFrame* frame, |
170 bool auto_navigate); | 171 bool auto_navigate, |
172 const std::string& mime_type); | |
Fady Samuel
2014/08/29 18:52:31
Take in a delegate.
lazyboy
2014/08/29 22:08:25
Done.
| |
171 | 173 |
172 virtual ~BrowserPlugin(); | 174 virtual ~BrowserPlugin(); |
173 | 175 |
174 int width() const { return plugin_rect_.width(); } | 176 int width() const { return plugin_rect_.width(); } |
175 int height() const { return plugin_rect_.height(); } | 177 int height() const { return plugin_rect_.height(); } |
176 gfx::Size plugin_size() const { return plugin_rect_.size(); } | 178 gfx::Size plugin_size() const { return plugin_rect_.size(); } |
177 gfx::Rect plugin_rect() const { return plugin_rect_; } | 179 gfx::Rect plugin_rect() const { return plugin_rect_; } |
178 | 180 |
179 // Virtual to allow for mocking in tests. | 181 // Virtual to allow for mocking in tests. |
180 virtual float GetDeviceScaleFactor() const; | 182 virtual float GetDeviceScaleFactor() const; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 232 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
231 SkBitmap* sad_guest_; | 233 SkBitmap* sad_guest_; |
232 bool guest_crashed_; | 234 bool guest_crashed_; |
233 int content_window_routing_id_; | 235 int content_window_routing_id_; |
234 bool plugin_focused_; | 236 bool plugin_focused_; |
235 // Tracks the visibility of the browser plugin regardless of the whole | 237 // Tracks the visibility of the browser plugin regardless of the whole |
236 // embedder RenderView's visibility. | 238 // embedder RenderView's visibility. |
237 bool visible_; | 239 bool visible_; |
238 | 240 |
239 const bool auto_navigate_; | 241 const bool auto_navigate_; |
242 const std::string mime_type_; | |
240 std::string html_string_; | 243 std::string html_string_; |
Fady Samuel
2014/08/29 18:52:31
Get rid of these three member variables.
lazyboy
2014/08/29 22:08:25
Done.
| |
241 | 244 |
242 WebCursor cursor_; | 245 WebCursor cursor_; |
243 | 246 |
244 gfx::Size last_view_size_; | 247 gfx::Size last_view_size_; |
245 bool mouse_locked_; | 248 bool mouse_locked_; |
246 | 249 |
247 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to | 250 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to |
248 // store the BrowserPlugin's BrowserPluginManager in a member variable to | 251 // store the BrowserPlugin's BrowserPluginManager in a member variable to |
249 // avoid accessing the RenderViewImpl. | 252 // avoid accessing the RenderViewImpl. |
250 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; | 253 const scoped_refptr<BrowserPluginManager> browser_plugin_manager_; |
251 | 254 |
252 // Used for HW compositing. | 255 // Used for HW compositing. |
253 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 256 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
254 | 257 |
255 // Used to identify the plugin to WebBindings. | 258 // Used to identify the plugin to WebBindings. |
256 scoped_ptr<struct _NPP> npp_; | 259 scoped_ptr<struct _NPP> npp_; |
257 | 260 |
258 // URL for the embedder frame. | 261 // URL for the embedder frame. |
259 int browser_plugin_instance_id_; | 262 int browser_plugin_instance_id_; |
260 | 263 |
261 std::vector<EditCommand> edit_commands_; | 264 std::vector<EditCommand> edit_commands_; |
262 | 265 |
266 scoped_ptr<BrowserPluginDelegate> delegate_; | |
267 | |
263 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might | 268 // Weak factory used in v8 |MakeWeak| callback, since the v8 callback might |
264 // get called after BrowserPlugin has been destroyed. | 269 // get called after BrowserPlugin has been destroyed. |
265 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 270 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
266 | 271 |
267 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 272 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
268 }; | 273 }; |
269 | 274 |
270 } // namespace content | 275 } // namespace content |
271 | 276 |
272 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 277 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |