| 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 // A BrowserPluginGuest is the browser side of a browser <--> embedder | 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder |
| 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder | 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder |
| 7 // renderer side of browser <--> embedder renderer communication. | 7 // renderer side of browser <--> embedder renderer communication. |
| 8 // | 8 // |
| 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a | 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a |
| 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The | 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 struct WebDropData; | 50 struct WebDropData; |
| 51 | 51 |
| 52 namespace WebKit { | 52 namespace WebKit { |
| 53 class WebInputEvent; | 53 class WebInputEvent; |
| 54 } | 54 } |
| 55 | 55 |
| 56 namespace content { | 56 namespace content { |
| 57 | 57 |
| 58 class BrowserPluginHostFactory; | 58 class BrowserPluginHostFactory; |
| 59 class BrowserPluginEmbedder; | 59 class BrowserPluginEmbedder; |
| 60 class DragEventSourceInfo; |
| 60 class RenderProcessHost; | 61 class RenderProcessHost; |
| 61 | 62 |
| 62 // A browser plugin guest provides functionality for WebContents to operate in | 63 // A browser plugin guest provides functionality for WebContents to operate in |
| 63 // the guest role and implements guest specific overrides for ViewHostMsg_* | 64 // the guest role and implements guest specific overrides for ViewHostMsg_* |
| 64 // messages. | 65 // messages. |
| 65 // | 66 // |
| 66 // BrowserPluginEmbedder is responsible for creating and destroying a guest. | 67 // BrowserPluginEmbedder is responsible for creating and destroying a guest. |
| 67 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, | 68 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| 68 public WebContentsDelegate, | 69 public WebContentsDelegate, |
| 69 public WebContentsObserver { | 70 public WebContentsObserver { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Helper to send messages to embedder. Overridden in test implementation | 163 // Helper to send messages to embedder. Overridden in test implementation |
| 163 // since we want to intercept certain messages for testing. | 164 // since we want to intercept certain messages for testing. |
| 164 virtual void SendMessageToEmbedder(IPC::Message* msg); | 165 virtual void SendMessageToEmbedder(IPC::Message* msg); |
| 165 | 166 |
| 166 // Returns the embedder's routing ID. | 167 // Returns the embedder's routing ID. |
| 167 int embedder_routing_id() const; | 168 int embedder_routing_id() const; |
| 168 // Returns the identifier that uniquely identifies a browser plugin guest | 169 // Returns the identifier that uniquely identifies a browser plugin guest |
| 169 // within an embedder. | 170 // within an embedder. |
| 170 int instance_id() const { return instance_id_; } | 171 int instance_id() const { return instance_id_; } |
| 171 | 172 |
| 173 bool dragging() { return dragging_; } |
| 174 |
| 175 bool drag_over() { return drag_over_; } |
| 176 |
| 172 private: | 177 private: |
| 173 friend class TestBrowserPluginGuest; | 178 friend class TestBrowserPluginGuest; |
| 174 | 179 |
| 175 BrowserPluginGuest(int instance_id, | 180 BrowserPluginGuest(int instance_id, |
| 176 WebContentsImpl* web_contents, | 181 WebContentsImpl* web_contents, |
| 177 const BrowserPluginHostMsg_CreateGuest_Params& params); | 182 const BrowserPluginHostMsg_CreateGuest_Params& params); |
| 178 | 183 |
| 179 base::SharedMemory* damage_buffer() const { return damage_buffer_.get(); } | 184 base::SharedMemory* damage_buffer() const { return damage_buffer_.get(); } |
| 180 const gfx::Size& damage_view_size() const { return damage_view_size_; } | 185 const gfx::Size& damage_view_size() const { return damage_view_size_; } |
| 181 float damage_buffer_scale_factor() const { | 186 float damage_buffer_scale_factor() const { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, | 257 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, |
| 253 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); | 258 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); |
| 254 | 259 |
| 255 | 260 |
| 256 // Message handlers for messages from guest. | 261 // Message handlers for messages from guest. |
| 257 | 262 |
| 258 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params, | 263 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params, |
| 259 int* route_id, | 264 int* route_id, |
| 260 int* surface_id, | 265 int* surface_id, |
| 261 int64* cloned_session_storage_namespace_id); | 266 int64* cloned_session_storage_namespace_id); |
| 267 void OnDragStopped(); |
| 262 void OnHandleInputEventAck( | 268 void OnHandleInputEventAck( |
| 263 WebKit::WebInputEvent::Type event_type, | 269 WebKit::WebInputEvent::Type event_type, |
| 264 InputEventAckState ack_result); | 270 InputEventAckState ack_result); |
| 265 void OnHasTouchEventHandlers(bool accept); | 271 void OnHasTouchEventHandlers(bool accept); |
| 266 void OnSetCursor(const WebCursor& cursor); | 272 void OnSetCursor(const WebCursor& cursor); |
| 267 // On MacOSX popups are painted by the browser process. We handle them here | 273 // On MacOSX popups are painted by the browser process. We handle them here |
| 268 // so that they are positioned correctly. | 274 // so that they are positioned correctly. |
| 269 #if defined(OS_MACOSX) | 275 #if defined(OS_MACOSX) |
| 270 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 276 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
| 271 #endif | 277 #endif |
| 272 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); | 278 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
| 279 void OnStartDragging(bool* handled); |
| 273 // Overriden in tests. | 280 // Overriden in tests. |
| 274 virtual void OnTakeFocus(bool reverse); | 281 virtual void OnTakeFocus(bool reverse); |
| 275 void OnUpdateDragCursor(WebKit::WebDragOperation operation); | |
| 276 void OnUpdateFrameName(int frame_id, | 282 void OnUpdateFrameName(int frame_id, |
| 277 bool is_top_level, | 283 bool is_top_level, |
| 278 const std::string& name); | 284 const std::string& name); |
| 279 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | 285 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
| 280 | 286 |
| 281 // Static factory instance (always NULL for non-test). | 287 // Static factory instance (always NULL for non-test). |
| 282 static content::BrowserPluginHostFactory* factory_; | 288 static content::BrowserPluginHostFactory* factory_; |
| 283 | 289 |
| 284 NotificationRegistrar notification_registrar_; | 290 NotificationRegistrar notification_registrar_; |
| 285 WebContentsImpl* embedder_web_contents_; | 291 WebContentsImpl* embedder_web_contents_; |
| 286 // An identifier that uniquely identifies a browser plugin guest within an | 292 // An identifier that uniquely identifies a browser plugin guest within an |
| 287 // embedder. | 293 // embedder. |
| 288 int instance_id_; | 294 int instance_id_; |
| 289 scoped_ptr<base::SharedMemory> damage_buffer_; | 295 scoped_ptr<base::SharedMemory> damage_buffer_; |
| 290 // An identifier that uniquely identifies a damage buffer. | 296 // An identifier that uniquely identifies a damage buffer. |
| 291 uint32 damage_buffer_sequence_id_; | 297 uint32 damage_buffer_sequence_id_; |
| 292 size_t damage_buffer_size_; | 298 size_t damage_buffer_size_; |
| 293 gfx::Size damage_view_size_; | 299 gfx::Size damage_view_size_; |
| 294 float damage_buffer_scale_factor_; | 300 float damage_buffer_scale_factor_; |
| 295 gfx::Rect guest_window_rect_; | 301 gfx::Rect guest_window_rect_; |
| 296 gfx::Rect guest_screen_rect_; | 302 gfx::Rect guest_screen_rect_; |
| 297 base::TimeDelta guest_hang_timeout_; | 303 base::TimeDelta guest_hang_timeout_; |
| 298 bool focused_; | 304 bool focused_; |
| 299 bool visible_; | 305 bool visible_; |
| 306 // True if this guest initiated a drag n drop event that is currently active. |
| 307 bool dragging_; |
| 308 bool drag_over_; |
| 300 std::string name_; | 309 std::string name_; |
| 301 bool auto_size_enabled_; | 310 bool auto_size_enabled_; |
| 302 gfx::Size max_auto_size_; | 311 gfx::Size max_auto_size_; |
| 303 gfx::Size min_auto_size_; | 312 gfx::Size min_auto_size_; |
| 304 | 313 |
| 305 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 314 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 306 }; | 315 }; |
| 307 | 316 |
| 308 } // namespace content | 317 } // namespace content |
| 309 | 318 |
| 310 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 319 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |