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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void SystemDragEnded(); | 67 void SystemDragEnded(); |
68 | 68 |
69 // The page wants to update the mouse cursor during a drag & drop | 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 | 70 // operation. This update will be suppressed if the cursor is dragging over a |
71 // guest. | 71 // guest. |
72 bool OnUpdateDragCursor(); | 72 bool OnUpdateDragCursor(); |
73 | 73 |
74 // Used to handle special keyboard events. | 74 // Used to handle special keyboard events. |
75 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 75 bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
76 | 76 |
77 // Find the given |search_text| in the page. Returns true if the find request | |
78 // is handled by this browser plugin embedder. | |
79 bool Find(int request_id, | |
80 const base::string16& search_text, | |
81 const blink::WebFindOptions& options); | |
82 bool StopFinding(StopFindAction action); | |
83 | |
84 // Returns the "full page" guest if there is one. That is, if there is a | 77 // Returns the "full page" guest if there is one. That is, if there is a |
85 // single BrowserPlugin in the embedder which takes up the full page, then it | 78 // single BrowserPlugin in the embedder which takes up the full page, then it |
86 // is returned. | 79 // is returned. |
87 BrowserPluginGuest* GetFullPageGuest(); | 80 BrowserPluginGuest* GetFullPageGuest(); |
88 | 81 |
89 // Polls all guests for this web contents and returns true if any of them | 82 // Polls all guests for this web contents and returns true if any of them |
90 // were audible recently. | 83 // were audible recently. |
91 bool WereAnyGuestsRecentlyAudible(); | 84 bool WereAnyGuestsRecentlyAudible(); |
92 | 85 |
93 private: | 86 private: |
94 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); | 87 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
95 | 88 |
96 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 89 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
97 | 90 |
98 void ClearGuestDragStateIfApplicable(); | 91 void ClearGuestDragStateIfApplicable(); |
99 | 92 |
100 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); | 93 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); |
101 | 94 |
102 // Notifies a guest that the embedder's screen info has changed. | 95 // Notifies a guest that the embedder's screen info has changed. |
103 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); | 96 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); |
104 | 97 |
105 // Closes modal dialogs in |guest_web_contents|. | 98 // Closes modal dialogs in |guest_web_contents|. |
106 static bool CancelDialogs(WebContents* guest_web_contents); | 99 static bool CancelDialogs(WebContents* guest_web_contents); |
107 | 100 |
108 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 101 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
109 WebContents* guest); | 102 WebContents* guest); |
110 | 103 |
111 static bool FindInGuest(int request_id, | |
112 const base::string16& search_text, | |
113 const blink::WebFindOptions& options, | |
114 WebContents* guest); | |
115 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); | |
116 | |
117 static bool GuestRecentlyAudibleCallback(WebContents* guest); | 104 static bool GuestRecentlyAudibleCallback(WebContents* guest); |
118 | 105 |
119 // Message handlers. | 106 // Message handlers. |
120 | 107 |
121 void OnAttach(RenderFrameHost* render_frame_host, | 108 void OnAttach(RenderFrameHost* render_frame_host, |
122 int instance_id, | 109 int instance_id, |
123 const BrowserPluginHostMsg_Attach_Params& params); | 110 const BrowserPluginHostMsg_Attach_Params& params); |
124 | 111 |
125 // Used to correctly update the cursor when dragging over a guest, and to | 112 // Used to correctly update the cursor when dragging over a guest, and to |
126 // handle a race condition when dropping onto the guest that started the drag | 113 // handle a race condition when dropping onto the guest that started the drag |
(...skipping 10 matching lines...) Expand all Loading... |
137 bool guest_drag_ending_; | 124 bool guest_drag_ending_; |
138 | 125 |
139 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 126 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
140 | 127 |
141 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 128 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
142 }; | 129 }; |
143 | 130 |
144 } // namespace content | 131 } // namespace content |
145 | 132 |
146 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 133 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |