Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 12086095: Fixed drag and drop into and out of Browser Plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Drag and drop enabled for linux only Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // A browser plugin guest provides functionality for WebContents to operate in 68 // A browser plugin guest provides functionality for WebContents to operate in
69 // the guest role and implements guest-specific overrides for ViewHostMsg_* 69 // the guest role and implements guest-specific overrides for ViewHostMsg_*
70 // messages. 70 // messages.
71 // 71 //
72 // When a guest is initially created, it is in an unattached state. That is, 72 // When a guest is initially created, it is in an unattached state. That is,
73 // it is not visible anywhere and has no embedder WebContents assigned. 73 // it is not visible anywhere and has no embedder WebContents assigned.
74 // A BrowserPluginGuest is said to be "attached" if it has an embedder. 74 // A BrowserPluginGuest is said to be "attached" if it has an embedder.
75 // A BrowserPluginGuest can also create a new unattached guest via 75 // A BrowserPluginGuest can also create a new unattached guest via
76 // CreateNewWindow. The newly created guest will live in the same partition, 76 // CreateNewWindow. The newly created guest will live in the same partition,
77 // which means it can share storage and can script this guest. 77 // which means it can share storage and can script this guest.
78 class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, 78 class CONTENT_EXPORT BrowserPluginGuest
79 public WebContentsDelegate, 79 : public NotificationObserver,
80 public WebContentsObserver { 80 public WebContentsDelegate,
81 public WebContentsObserver,
82 public base::SupportsWeakPtr<BrowserPluginGuest> {
81 public: 83 public:
82 typedef base::Callback<void(bool)> GeolocationCallback; 84 typedef base::Callback<void(bool)> GeolocationCallback;
83 virtual ~BrowserPluginGuest(); 85 virtual ~BrowserPluginGuest();
84 86
85 static BrowserPluginGuest* Create( 87 static BrowserPluginGuest* Create(
86 int instance_id, 88 int instance_id,
87 WebContentsImpl* web_contents); 89 WebContentsImpl* web_contents);
88 90
89 // Destroys the guest WebContents and all its associated state, including 91 // Destroys the guest WebContents and all its associated state, including
90 // this BrowserPluginGuest, and its new unattached windows. 92 // this BrowserPluginGuest, and its new unattached windows.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // BrowserPluginGuest is already destroyed. 230 // BrowserPluginGuest is already destroyed.
229 static void AcknowledgeBufferPresent(int route_id, 231 static void AcknowledgeBufferPresent(int route_id,
230 int gpu_host_id, 232 int gpu_host_id,
231 const std::string& mailbox_name, 233 const std::string& mailbox_name,
232 uint32 sync_point); 234 uint32 sync_point);
233 235
234 // Returns whether BrowserPluginGuest is interested in receiving the given 236 // Returns whether BrowserPluginGuest is interested in receiving the given
235 // |message|. 237 // |message|.
236 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); 238 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);
237 239
240 void DragSourceEndedAt(int client_x, int client_y, int screen_x,
241 int screen_y, WebKit::WebDragOperation operation);
242
243 void DragSourceMovedTo(int client_x, int client_y,
244 int screen_x, int screen_y);
245
246 // Called when the drag started by this guest ends at an OS-level.
247 void EndSystemDrag();
248
238 private: 249 private:
239 typedef std::pair<MediaStreamRequest, MediaResponseCallback> 250 typedef std::pair<MediaStreamRequest, MediaResponseCallback>
240 MediaStreamRequestAndCallbackPair; 251 MediaStreamRequestAndCallbackPair;
241 typedef std::map<int, MediaStreamRequestAndCallbackPair> 252 typedef std::map<int, MediaStreamRequestAndCallbackPair>
242 MediaStreamRequestsMap; 253 MediaStreamRequestsMap;
243 254
244 class EmbedderRenderViewHostObserver; 255 class EmbedderRenderViewHostObserver;
245 friend class TestBrowserPluginGuest; 256 friend class TestBrowserPluginGuest;
246 257
247 BrowserPluginGuest(int instance_id, 258 BrowserPluginGuest(int instance_id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Handles drag events from the embedder. 294 // Handles drag events from the embedder.
284 // When dragging, the drag events go to the embedder first, and if the drag 295 // When dragging, the drag events go to the embedder first, and if the drag
285 // happens on the browser plugin, then the plugin sends a corresponding 296 // happens on the browser plugin, then the plugin sends a corresponding
286 // drag-message to the guest. This routes the drag-message to the guest 297 // drag-message to the guest. This routes the drag-message to the guest
287 // renderer. 298 // renderer.
288 void OnDragStatusUpdate(int instance_id, 299 void OnDragStatusUpdate(int instance_id,
289 WebKit::WebDragStatus drag_status, 300 WebKit::WebDragStatus drag_status,
290 const WebDropData& drop_data, 301 const WebDropData& drop_data,
291 WebKit::WebDragOperationsMask drag_mask, 302 WebKit::WebDragOperationsMask drag_mask,
292 const gfx::Point& location); 303 const gfx::Point& location);
304 // Called when a drag and drop Drop event has taken place inside the guest.
305 void OnDropAck(bool* handled);
293 // If possible, navigate the guest to |relative_index| entries away from the 306 // If possible, navigate the guest to |relative_index| entries away from the
294 // current navigation entry. 307 // current navigation entry.
295 virtual void OnGo(int instance_id, int relative_index); 308 virtual void OnGo(int instance_id, int relative_index);
296 // Overriden in tests. 309 // Overriden in tests.
297 virtual void OnHandleInputEvent(int instance_id, 310 virtual void OnHandleInputEvent(int instance_id,
298 const gfx::Rect& guest_window_rect, 311 const gfx::Rect& guest_window_rect,
299 const WebKit::WebInputEvent* event); 312 const WebKit::WebInputEvent* event);
300 void OnLockMouse(bool user_gesture, 313 void OnLockMouse(bool user_gesture,
301 bool last_unlocked_by_target, 314 bool last_unlocked_by_target,
302 bool privileged); 315 bool privileged);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void OnUnlockMouse(); 361 void OnUnlockMouse();
349 void OnUnlockMouseAck(int instance_id); 362 void OnUnlockMouseAck(int instance_id);
350 void OnUpdateRectACK( 363 void OnUpdateRectACK(
351 int instance_id, 364 int instance_id,
352 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, 365 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params,
353 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); 366 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params);
354 367
355 368
356 // Message handlers for messages from guest. 369 // Message handlers for messages from guest.
357 370
371 void OnDragStopped();
358 void OnHandleInputEventAck( 372 void OnHandleInputEventAck(
359 WebKit::WebInputEvent::Type event_type, 373 WebKit::WebInputEvent::Type event_type,
360 InputEventAckState ack_result); 374 InputEventAckState ack_result);
361 void OnHasTouchEventHandlers(bool accept); 375 void OnHasTouchEventHandlers(bool accept);
362 void OnSetCursor(const WebCursor& cursor); 376 void OnSetCursor(const WebCursor& cursor);
363 // On MacOSX popups are painted by the browser process. We handle them here 377 // On MacOSX popups are painted by the browser process. We handle them here
364 // so that they are positioned correctly. 378 // so that they are positioned correctly.
365 #if defined(OS_MACOSX) 379 #if defined(OS_MACOSX)
366 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); 380 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params);
367 #endif 381 #endif
368 void OnShowView(int route_id, 382 void OnShowView(int route_id,
369 WindowOpenDisposition disposition, 383 WindowOpenDisposition disposition,
370 const gfx::Rect& initial_bounds, 384 const gfx::Rect& initial_bounds,
371 bool user_gesture); 385 bool user_gesture);
372 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); 386 void OnShowWidget(int route_id, const gfx::Rect& initial_pos);
387 void OnStartDragging(bool* handled);
373 // Overriden in tests. 388 // Overriden in tests.
374 virtual void OnTakeFocus(bool reverse); 389 virtual void OnTakeFocus(bool reverse);
375 void OnUpdateDragCursor(WebKit::WebDragOperation operation); 390 void OnTargetDrop_ACK(bool* handled);
376 void OnUpdateFrameName(int frame_id, 391 void OnUpdateFrameName(int frame_id,
377 bool is_top_level, 392 bool is_top_level,
378 const std::string& name); 393 const std::string& name);
379 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); 394 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
380 395
381 // Helpers for |OnRespondPermission|. 396 // Helpers for |OnRespondPermission|.
382 void OnRespondPermissionGeolocation(int request_id, bool should_allow); 397 void OnRespondPermissionGeolocation(int request_id, bool should_allow);
383 void OnRespondPermissionMedia(int request_id, bool should_allow); 398 void OnRespondPermissionMedia(int request_id, bool should_allow);
384 void OnRespondPermissionNewWindow(int request_id, bool should_allow); 399 void OnRespondPermissionNewWindow(int request_id, bool should_allow);
385 400
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // A map from request ID to instance ID for use by the New Window API. 446 // A map from request ID to instance ID for use by the New Window API.
432 typedef std::map<int, int> NewWindowRequestMap; 447 typedef std::map<int, int> NewWindowRequestMap;
433 NewWindowRequestMap new_window_request_map_; 448 NewWindowRequestMap new_window_request_map_;
434 449
435 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 450 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
436 }; 451 };
437 452
438 } // namespace content 453 } // namespace content
439 454
440 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 455 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698