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

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

Issue 597753003: Implement find in page support for top level BrowserPlugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/common/browser_plugin/browser_plugin_constants.h" 11 #include "content/common/browser_plugin/browser_plugin_constants.h"
12 #include "content/common/browser_plugin/browser_plugin_messages.h" 12 #include "content/common/browser_plugin/browser_plugin_messages.h"
13 #include "content/common/drag_messages.h" 13 #include "content/common/drag_messages.h"
14 #include "content/common/gpu/gpu_messages.h" 14 #include "content/common/gpu/gpu_messages.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_plugin_guest_manager.h" 16 #include "content/public/browser/browser_plugin_guest_manager.h"
17 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 18 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
20 #include "content/public/browser/user_metrics.h" 20 #include "content/public/browser/user_metrics.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "content/public/common/result_codes.h" 22 #include "content/public/common/result_codes.h"
23 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
24 #include "net/base/escape.h" 24 #include "net/base/escape.h"
25 #include "third_party/WebKit/public/web/WebFindOptions.h"
25 #include "ui/events/keycodes/keyboard_codes.h" 26 #include "ui/events/keycodes/keyboard_codes.h"
26 27
27 namespace content { 28 namespace content {
28 29
29 BrowserPluginEmbedder::BrowserPluginEmbedder(WebContentsImpl* web_contents) 30 BrowserPluginEmbedder::BrowserPluginEmbedder(WebContentsImpl* web_contents)
30 : WebContentsObserver(web_contents), 31 : WebContentsObserver(web_contents),
31 guest_drag_ending_(false), 32 guest_drag_ending_(false),
32 weak_ptr_factory_(this) { 33 weak_ptr_factory_(this) {
33 } 34 }
34 35
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 bool event_consumed = false; 156 bool event_consumed = false;
156 GetBrowserPluginGuestManager()->ForEachGuest( 157 GetBrowserPluginGuestManager()->ForEachGuest(
157 GetWebContents(), 158 GetWebContents(),
158 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, 159 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
159 base::Unretained(this), 160 base::Unretained(this),
160 &event_consumed)); 161 &event_consumed));
161 162
162 return event_consumed; 163 return event_consumed;
163 } 164 }
164 165
166 bool BrowserPluginEmbedder::Find(int request_id,
167 const base::string16& search_text,
168 const blink::WebFindOptions& options) {
169 return GetBrowserPluginGuestManager()->ForEachGuest(
170 GetWebContents(),
171 base::Bind(&BrowserPluginEmbedder::FindInGuest,
172 base::Unretained(this),
173 request_id,
174 search_text,
175 options));
176 }
177
165 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, 178 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
166 WebContents* guest) { 179 WebContents* guest) {
167 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) 180 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
168 ->GetBrowserPluginGuest() 181 ->GetBrowserPluginGuest()
169 ->mouse_locked(); 182 ->mouse_locked();
170 guest->GotResponseToLockMouseRequest(false); 183 guest->GotResponseToLockMouseRequest(false);
171 184
172 // Returns false to iterate over all guests. 185 // Returns false to iterate over all guests.
173 return false; 186 return false;
174 } 187 }
175 188
189 bool BrowserPluginEmbedder::FindInGuest(int request_id,
190 const base::string16& search_text,
191 const blink::WebFindOptions& options,
192 WebContents* guest) {
193 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find(
194 request_id, search_text, options)) {
195 // There can only ever currently be one browser plugin that handles find so
196 // we can break the iteration at this point.
197 return true;
198 }
199 return false;
200 }
201
176 } // namespace content 202 } // 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