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

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

Issue 1042743002: Make Edit>Speech>Speak Selection work for PDFs on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 bool event_consumed = false; 174 bool event_consumed = false;
175 GetBrowserPluginGuestManager()->ForEachGuest( 175 GetBrowserPluginGuestManager()->ForEachGuest(
176 web_contents(), 176 web_contents(),
177 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, 177 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
178 &event_consumed)); 178 &event_consumed));
179 179
180 return event_consumed; 180 return event_consumed;
181 } 181 }
182 182
183 bool BrowserPluginEmbedder::Find(int request_id, 183 BrowserPluginGuest* BrowserPluginEmbedder::GetFullPageGuest() {
184 const base::string16& search_text, 184 WebContentsImpl* guest_contents = static_cast<WebContentsImpl*>(
185 const blink::WebFindOptions& options) { 185 GetBrowserPluginGuestManager()->GetFullPageGuest(web_contents()));
186 return GetBrowserPluginGuestManager()->ForEachGuest( 186 return guest_contents->GetBrowserPluginGuest();
Sam McNally 2015/04/01 06:04:49 Check for a null guest_contents?
raymes 2015/04/13 11:00:31 Done.
187 web_contents(),
188 base::Bind(&BrowserPluginEmbedder::FindInGuest,
189 request_id,
190 search_text,
191 options));
192 }
193
194 bool BrowserPluginEmbedder::StopFinding(StopFindAction action) {
195 return GetBrowserPluginGuestManager()->ForEachGuest(
196 web_contents(),
197 base::Bind(&BrowserPluginEmbedder::StopFindingInGuest, action));
198 } 187 }
199 188
200 // static 189 // static
201 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, 190 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
202 WebContents* guest) { 191 WebContents* guest) {
203 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) 192 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest)
204 ->GetBrowserPluginGuest() 193 ->GetBrowserPluginGuest()
205 ->mouse_locked(); 194 ->mouse_locked();
206 guest->GotResponseToLockMouseRequest(false); 195 guest->GotResponseToLockMouseRequest(false);
207 196
208 // Returns false to iterate over all guests. 197 // Returns false to iterate over all guests.
209 return false; 198 return false;
210 } 199 }
211 200
212 // static
213 bool BrowserPluginEmbedder::FindInGuest(int request_id,
214 const base::string16& search_text,
215 const blink::WebFindOptions& options,
216 WebContents* guest) {
217 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find(
218 request_id, search_text, options)) {
219 // There can only ever currently be one browser plugin that handles find so
220 // we can break the iteration at this point.
221 return true;
222 }
223 return false;
224 }
225
226 bool BrowserPluginEmbedder::StopFindingInGuest(StopFindAction action,
227 WebContents* guest) {
228 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()
229 ->StopFinding(action)) {
230 // There can only ever currently be one browser plugin that handles find so
231 // we can break the iteration at this point.
232 return true;
233 }
234 return false;
235 }
236
237 } // namespace content 201 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698