| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Indicates that a drag operation has entered into the bounds of a given | 49 // Indicates that a drag operation has entered into the bounds of a given |
| 50 // |guest|. Returns whether the |guest| also started the operation. | 50 // |guest|. Returns whether the |guest| also started the operation. |
| 51 bool DragEnteredGuest(BrowserPluginGuest* guest); | 51 bool DragEnteredGuest(BrowserPluginGuest* guest); |
| 52 | 52 |
| 53 // Indicates that a drag operation has left the bounds of a given |guest|. | 53 // Indicates that a drag operation has left the bounds of a given |guest|. |
| 54 void DragLeftGuest(BrowserPluginGuest* guest); | 54 void DragLeftGuest(BrowserPluginGuest* guest); |
| 55 | 55 |
| 56 // Called when the screen info has changed. | 56 // Called when the screen info has changed. |
| 57 void ScreenInfoChanged(); | 57 void ScreenInfoChanged(); |
| 58 | 58 |
| 59 // Closes modal dialogs in all of the guests. |
| 60 void CancelGuestDialogs(); |
| 61 |
| 59 // Called by WebContentsViewGuest when a drag operation is started within | 62 // Called by WebContentsViewGuest when a drag operation is started within |
| 60 // |guest|. This |guest| will be signaled at the end of the drag operation. | 63 // |guest|. This |guest| will be signaled at the end of the drag operation. |
| 61 void StartDrag(BrowserPluginGuest* guest); | 64 void StartDrag(BrowserPluginGuest* guest); |
| 62 | 65 |
| 63 // Sends EndSystemDrag message to the guest that initiated the last drag/drop | 66 // Sends EndSystemDrag message to the guest that initiated the last drag/drop |
| 64 // operation, if there's any. | 67 // operation, if there's any. |
| 65 void SystemDragEnded(); | 68 void SystemDragEnded(); |
| 66 | 69 |
| 67 // Used to handle special keyboard events. | 70 // Used to handle special keyboard events. |
| 68 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 71 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 69 | 72 |
| 70 // Returns the "full page" guest if there is one. That is, if there is a | 73 // Returns the "full page" guest if there is one. That is, if there is a |
| 71 // single BrowserPlugin in the embedder which takes up the full page, then it | 74 // single BrowserPlugin in the embedder which takes up the full page, then it |
| 72 // is returned. | 75 // is returned. |
| 73 BrowserPluginGuest* GetFullPageGuest(); | 76 BrowserPluginGuest* GetFullPageGuest(); |
| 74 | 77 |
| 75 private: | 78 private: |
| 76 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); | 79 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
| 77 | 80 |
| 78 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 81 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
| 79 | 82 |
| 80 void ClearGuestDragStateIfApplicable(); | 83 void ClearGuestDragStateIfApplicable(); |
| 81 | 84 |
| 82 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); | 85 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); |
| 83 | 86 |
| 84 // Notifies a guest that the embedder's screen info has changed. | 87 // Notifies a guest that the embedder's screen info has changed. |
| 85 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); | 88 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); |
| 86 | 89 |
| 90 // Closes modal dialogs in |guest_web_contents|. |
| 91 static bool CancelDialogs(WebContents* guest_web_contents); |
| 92 |
| 87 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 93 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
| 88 WebContents* guest); | 94 WebContents* guest); |
| 89 | 95 |
| 90 // Message handlers. | 96 // Message handlers. |
| 91 | 97 |
| 92 void OnAttach(RenderFrameHost* render_frame_host, | 98 void OnAttach(RenderFrameHost* render_frame_host, |
| 93 int instance_id, | 99 int instance_id, |
| 94 const BrowserPluginHostMsg_Attach_Params& params); | 100 const BrowserPluginHostMsg_Attach_Params& params); |
| 95 void OnUpdateDragCursor(bool* handled); | 101 void OnUpdateDragCursor(bool* handled); |
| 96 | 102 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 bool guest_drag_ending_; | 115 bool guest_drag_ending_; |
| 110 | 116 |
| 111 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 117 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
| 112 | 118 |
| 113 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 119 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
| 114 }; | 120 }; |
| 115 | 121 |
| 116 } // namespace content | 122 } // namespace content |
| 117 | 123 |
| 118 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 124 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
| OLD | NEW |