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 |
77 // Returns the "full page" guest if there is one. That is, if there is a | 84 // Returns the "full page" guest if there is one. That is, if there is a |
78 // single BrowserPlugin in the embedder which takes up the full page, then it | 85 // single BrowserPlugin in the embedder which takes up the full page, then it |
79 // is returned. | 86 // is returned. |
80 BrowserPluginGuest* GetFullPageGuest(); | 87 BrowserPluginGuest* GetFullPageGuest(); |
81 | 88 |
82 // Polls all guests for this web contents and returns true if any of them | 89 // Polls all guests for this web contents and returns true if any of them |
83 // were audible recently. | 90 // were audible recently. |
84 bool WereAnyGuestsRecentlyAudible(); | 91 bool WereAnyGuestsRecentlyAudible(); |
85 | 92 |
86 private: | 93 private: |
87 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); | 94 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); |
88 | 95 |
89 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 96 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
90 | 97 |
91 void ClearGuestDragStateIfApplicable(); | 98 void ClearGuestDragStateIfApplicable(); |
92 | 99 |
93 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); | 100 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); |
94 | 101 |
95 // Notifies a guest that the embedder's screen info has changed. | 102 // Notifies a guest that the embedder's screen info has changed. |
96 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); | 103 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); |
97 | 104 |
98 // Closes modal dialogs in |guest_web_contents|. | 105 // Closes modal dialogs in |guest_web_contents|. |
99 static bool CancelDialogs(WebContents* guest_web_contents); | 106 static bool CancelDialogs(WebContents* guest_web_contents); |
100 | 107 |
101 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 108 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
102 WebContents* guest); | 109 WebContents* guest); |
103 | 110 |
| 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 |
104 static bool GuestRecentlyAudibleCallback(WebContents* guest); | 117 static bool GuestRecentlyAudibleCallback(WebContents* guest); |
105 | 118 |
106 // Message handlers. | 119 // Message handlers. |
107 | 120 |
108 void OnAttach(RenderFrameHost* render_frame_host, | 121 void OnAttach(RenderFrameHost* render_frame_host, |
109 int instance_id, | 122 int instance_id, |
110 const BrowserPluginHostMsg_Attach_Params& params); | 123 const BrowserPluginHostMsg_Attach_Params& params); |
111 | 124 |
112 // 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 |
113 // 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 |
(...skipping 10 matching lines...) Expand all Loading... |
124 bool guest_drag_ending_; | 137 bool guest_drag_ending_; |
125 | 138 |
126 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; | 139 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; |
127 | 140 |
128 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); | 141 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); |
129 }; | 142 }; |
130 | 143 |
131 } // namespace content | 144 } // namespace content |
132 | 145 |
133 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ | 146 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ |
OLD | NEW |