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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 2700613003: Enable find-in-page across GuestViews. (Closed)
Patch Set: Small fix. Created 3 years, 8 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 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
6 6
7 #include "content/browser/browser_plugin/browser_plugin_guest.h" 7 #include "content/browser/browser_plugin/browser_plugin_guest.h"
8 #include "content/browser/renderer_host/render_view_host_impl.h" 8 #include "content/browser/renderer_host/render_view_host_impl.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/common/browser_plugin/browser_plugin_messages.h" 10 #include "content/common/browser_plugin/browser_plugin_messages.h"
11 #include "content/common/drag_messages.h" 11 #include "content/common/drag_messages.h"
12 #include "content/public/browser/browser_context.h" 12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/browser_plugin_guest_manager.h" 13 #include "content/public/browser/browser_plugin_guest_manager.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 14 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
16 #include "third_party/WebKit/public/web/WebFindOptions.h"
17 #include "ui/events/keycodes/keyboard_codes.h" 16 #include "ui/events/keycodes/keyboard_codes.h"
18 17
19 namespace content { 18 namespace content {
20 19
21 BrowserPluginEmbedder::BrowserPluginEmbedder(WebContentsImpl* web_contents) 20 BrowserPluginEmbedder::BrowserPluginEmbedder(WebContentsImpl* web_contents)
22 : WebContentsObserver(web_contents), 21 : WebContentsObserver(web_contents),
23 guest_drag_ending_(false), 22 guest_drag_ending_(false),
24 weak_ptr_factory_(this) { 23 weak_ptr_factory_(this) {
25 } 24 }
26 25
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 179
181 bool event_consumed = false; 180 bool event_consumed = false;
182 GetBrowserPluginGuestManager()->ForEachGuest( 181 GetBrowserPluginGuestManager()->ForEachGuest(
183 web_contents(), 182 web_contents(),
184 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, 183 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
185 &event_consumed)); 184 &event_consumed));
186 185
187 return event_consumed; 186 return event_consumed;
188 } 187 }
189 188
190 bool BrowserPluginEmbedder::Find(int request_id,
191 const base::string16& search_text,
192 const blink::WebFindOptions& options) {
193 return GetBrowserPluginGuestManager()->ForEachGuest(
194 web_contents(),
195 base::Bind(&BrowserPluginEmbedder::FindInGuest,
196 request_id,
197 search_text,
198 options));
199 }
200
201 bool BrowserPluginEmbedder::StopFinding(StopFindAction action) {
202 return GetBrowserPluginGuestManager()->ForEachGuest(
203 web_contents(),
204 base::Bind(&BrowserPluginEmbedder::StopFindingInGuest, action));
205 }
206
207 BrowserPluginGuest* BrowserPluginEmbedder::GetFullPageGuest() { 189 BrowserPluginGuest* BrowserPluginEmbedder::GetFullPageGuest() {
208 WebContentsImpl* guest_contents = static_cast<WebContentsImpl*>( 190 WebContentsImpl* guest_contents = static_cast<WebContentsImpl*>(
209 GetBrowserPluginGuestManager()->GetFullPageGuest(web_contents())); 191 GetBrowserPluginGuestManager()->GetFullPageGuest(web_contents()));
210 if (!guest_contents) 192 if (!guest_contents)
211 return nullptr; 193 return nullptr;
212 return guest_contents->GetBrowserPluginGuest(); 194 return guest_contents->GetBrowserPluginGuest();
213 } 195 }
214 196
215 // static 197 // static
216 bool BrowserPluginEmbedder::GuestRecentlyAudibleCallback(WebContents* guest) { 198 bool BrowserPluginEmbedder::GuestRecentlyAudibleCallback(WebContents* guest) {
(...skipping 11 matching lines...) Expand all
228 WebContents* guest) { 210 WebContents* guest) {
229 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) 211 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
230 ->GetBrowserPluginGuest() 212 ->GetBrowserPluginGuest()
231 ->mouse_locked(); 213 ->mouse_locked();
232 guest->GotResponseToLockMouseRequest(false); 214 guest->GotResponseToLockMouseRequest(false);
233 215
234 // Returns false to iterate over all guests. 216 // Returns false to iterate over all guests.
235 return false; 217 return false;
236 } 218 }
237 219
238 // static
239 bool BrowserPluginEmbedder::FindInGuest(int request_id,
240 const base::string16& search_text,
241 const blink::WebFindOptions& options,
242 WebContents* guest) {
243 if (static_cast<WebContentsImpl*>(guest)
244 ->GetBrowserPluginGuest()
245 ->HandleFindForEmbedder(request_id, search_text, options)) {
246 // There can only ever currently be one browser plugin that handles find so
247 // we can break the iteration at this point.
248 return true;
249 }
250 return false;
251 }
252
253 // static
254 bool BrowserPluginEmbedder::StopFindingInGuest(StopFindAction action,
255 WebContents* guest) {
256 if (static_cast<WebContentsImpl*>(guest)
257 ->GetBrowserPluginGuest()
258 ->HandleStopFindingForEmbedder(action)) {
259 // There can only ever currently be one browser plugin that handles find so
260 // we can break the iteration at this point.
261 return true;
262 }
263 return false;
264 }
265
266 } // namespace content 220 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.h ('k') | content/browser/browser_plugin/browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698