| 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 BrowserPluginEmbedder handles messages coming from a BrowserPlugin's | 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's |
| 6 // embedder that are not directed at any particular existing guest process. | 6 // embedder that are not directed at any particular existing guest process. |
| 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer | 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer |
| 8 // process requests an initial navigation, the WebContents for that renderer | 8 // process requests an initial navigation, the WebContents for that renderer |
| 9 // renderer creates a BrowserPluginEmbedder for itself. The | 9 // renderer creates a BrowserPluginEmbedder for itself. The |
| 10 // BrowserPluginEmbedder, in turn, forwards the requests to a | 10 // BrowserPluginEmbedder, in turn, forwards the requests to a |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { | 31 class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { |
| 32 public: | 32 public: |
| 33 ~BrowserPluginEmbedder() override; | 33 ~BrowserPluginEmbedder() override; |
| 34 | 34 |
| 35 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); | 35 static BrowserPluginEmbedder* Create(WebContentsImpl* web_contents); |
| 36 | 36 |
| 37 // Called when embedder's |rwh| has sent screen rects to renderer. | 37 // Called when embedder's |rwh| has sent screen rects to renderer. |
| 38 void DidSendScreenRects(); | 38 void DidSendScreenRects(); |
| 39 | 39 |
| 40 // WebContentsObserver implementation. | 40 // WebContentsObserver implementation. |
| 41 bool OnMessageReceived(const IPC::Message& message) override; | |
| 42 bool OnMessageReceived(const IPC::Message& message, | 41 bool OnMessageReceived(const IPC::Message& message, |
| 43 RenderFrameHost* render_frame_host) override; | 42 RenderFrameHost* render_frame_host) override; |
| 44 | 43 |
| 45 // Sends a 'dragend' message to the guest that started the drag. | 44 // Sends a 'dragend' message to the guest that started the drag. |
| 46 void DragSourceEndedAt(int client_x, int client_y, int screen_x, | 45 void DragSourceEndedAt(int client_x, int client_y, int screen_x, |
| 47 int screen_y, blink::WebDragOperation operation); | 46 int screen_y, blink::WebDragOperation operation); |
| 48 | 47 |
| 49 // Indicates that a drag operation has entered into the bounds of a given | 48 // Indicates that a drag operation has entered into the bounds of a given |
| 50 // |guest|. Returns whether the |guest| also started the operation. | 49 // |guest|. Returns whether the |guest| also started the operation. |
| 51 bool DragEnteredGuest(BrowserPluginGuest* guest); | 50 bool DragEnteredGuest(BrowserPluginGuest* guest); |
| 52 | 51 |
| 53 // Indicates that a drag operation has left the bounds of a given |guest|. | 52 // Indicates that a drag operation has left the bounds of a given |guest|. |
| 54 void DragLeftGuest(BrowserPluginGuest* guest); | 53 void DragLeftGuest(BrowserPluginGuest* guest); |
| 55 | 54 |
| 56 // Called when the screen info has changed. | 55 // Called when the screen info has changed. |
| 57 void ScreenInfoChanged(); | 56 void ScreenInfoChanged(); |
| 58 | 57 |
| 59 // Closes modal dialogs in all of the guests. | 58 // Closes modal dialogs in all of the guests. |
| 60 void CancelGuestDialogs(); | 59 void CancelGuestDialogs(); |
| 61 | 60 |
| 62 // Called by WebContentsViewGuest when a drag operation is started within | 61 // Called by WebContentsViewGuest when a drag operation is started within |
| 63 // |guest|. This |guest| will be signaled at the end of the drag operation. | 62 // |guest|. This |guest| will be signaled at the end of the drag operation. |
| 64 void StartDrag(BrowserPluginGuest* guest); | 63 void StartDrag(BrowserPluginGuest* guest); |
| 65 | 64 |
| 66 // Sends EndSystemDrag message to the guest that initiated the last drag/drop | 65 // Sends EndSystemDrag message to the guest that initiated the last drag/drop |
| 67 // operation, if there's any. | 66 // operation, if there's any. |
| 68 void SystemDragEnded(); | 67 void SystemDragEnded(); |
| 69 | 68 |
| 69 // The page wants to update the mouse cursor during a drag & drop |
| 70 // operation. This update will be suppressed if the cursor is dragging over a |
| 71 // guest. |
| 72 bool OnUpdateDragCursor(); |
| 73 |
| 70 // Used to handle special keyboard events. | 74 // Used to handle special keyboard events. |
| 71 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 75 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 72 | 76 |
| 73 // Find the given |search_text| in the page. Returns true if the find request | 77 // Find the given |search_text| in the page. Returns true if the find request |
| 74 // is handled by this browser plugin embedder. | 78 // is handled by this browser plugin embedder. |
| 75 bool Find(int request_id, | 79 bool Find(int request_id, |
| 76 const base::string16& search_text, | 80 const base::string16& search_text, |
| 77 const blink::WebFindOptions& options); | 81 const blink::WebFindOptions& options); |
| 78 bool StopFinding(StopFindAction action); | 82 bool StopFinding(StopFindAction action); |
| 79 | 83 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 110 WebContents* guest); | 114 WebContents* guest); |
| 111 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); | 115 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); |
| 112 | 116 |
| 113 static bool GuestRecentlyAudibleCallback(WebContents* guest); | 117 static bool GuestRecentlyAudibleCallback(WebContents* guest); |
| 114 | 118 |
| 115 // Message handlers. | 119 // Message handlers. |
| 116 | 120 |
| 117 void OnAttach(RenderFrameHost* render_frame_host, | 121 void OnAttach(RenderFrameHost* render_frame_host, |
| 118 int instance_id, | 122 int instance_id, |
| 119 const BrowserPluginHostMsg_Attach_Params& params); | 123 const BrowserPluginHostMsg_Attach_Params& params); |
| 120 void OnUpdateDragCursor(bool* handled); | |
| 121 | 124 |
| 122 // Used to correctly update the cursor when dragging over a guest, and to | 125 // Used to correctly update the cursor when dragging over a guest, and to |
| 123 // handle a race condition when dropping onto the guest that started the drag | 126 // handle a race condition when dropping onto the guest that started the drag |
| 124 // (the race is that the dragend message arrives before the drop message so | 127 // (the race is that the dragend message arrives before the drop message so |
| 125 // the drop never takes place). | 128 // the drop never takes place). |
| 126 // crbug.com/233571 | 129 // crbug.com/233571 |
| 127 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; | 130 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; |
| 128 | 131 |
| 129 // Pointer to the guest that started the drag, used to forward necessary drag | 132 // Pointer to the guest that started the drag, used to forward necessary drag |
| 130 // status messages to the correct guest. | 133 // status messages to the correct guest. |
| 131 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; | 134 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; |
| 132 | 135 |
| 133 // Keeps track of "dragend" state. | 136 // Keeps track of "dragend" state. |
| 134 bool guest_drag_ending_; | 137 bool guest_drag_ending_; |
| 135 | 138 |
| 136 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 139 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
| 137 | 140 |
| 138 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 141 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
| 139 }; | 142 }; |
| 140 | 143 |
| 141 } // namespace content | 144 } // namespace content |
| 142 | 145 |
| 143 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 146 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| OLD | NEW |