| 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 #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" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const base::string16& search_text, | 167 const base::string16& search_text, |
| 168 const blink::WebFindOptions& options) { | 168 const blink::WebFindOptions& options) { |
| 169 return GetBrowserPluginGuestManager()->ForEachGuest( | 169 return GetBrowserPluginGuestManager()->ForEachGuest( |
| 170 GetWebContents(), | 170 GetWebContents(), |
| 171 base::Bind(&BrowserPluginEmbedder::FindInGuest, | 171 base::Bind(&BrowserPluginEmbedder::FindInGuest, |
| 172 request_id, | 172 request_id, |
| 173 search_text, | 173 search_text, |
| 174 options)); | 174 options)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool BrowserPluginEmbedder::StopFinding(StopFindAction action) { |
| 178 return GetBrowserPluginGuestManager()->ForEachGuest( |
| 179 GetWebContents(), |
| 180 base::Bind(&BrowserPluginEmbedder::StopFindingInGuest, action)); |
| 181 } |
| 182 |
| 177 // static | 183 // static |
| 178 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 184 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
| 179 WebContents* guest) { | 185 WebContents* guest) { |
| 180 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) | 186 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) |
| 181 ->GetBrowserPluginGuest() | 187 ->GetBrowserPluginGuest() |
| 182 ->mouse_locked(); | 188 ->mouse_locked(); |
| 183 guest->GotResponseToLockMouseRequest(false); | 189 guest->GotResponseToLockMouseRequest(false); |
| 184 | 190 |
| 185 // Returns false to iterate over all guests. | 191 // Returns false to iterate over all guests. |
| 186 return false; | 192 return false; |
| 187 } | 193 } |
| 188 | 194 |
| 189 // static | 195 // static |
| 190 bool BrowserPluginEmbedder::FindInGuest(int request_id, | 196 bool BrowserPluginEmbedder::FindInGuest(int request_id, |
| 191 const base::string16& search_text, | 197 const base::string16& search_text, |
| 192 const blink::WebFindOptions& options, | 198 const blink::WebFindOptions& options, |
| 193 WebContents* guest) { | 199 WebContents* guest) { |
| 194 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find( | 200 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest()->Find( |
| 195 request_id, search_text, options)) { | 201 request_id, search_text, options)) { |
| 196 // There can only ever currently be one browser plugin that handles find so | 202 // There can only ever currently be one browser plugin that handles find so |
| 197 // we can break the iteration at this point. | 203 // we can break the iteration at this point. |
| 198 return true; | 204 return true; |
| 199 } | 205 } |
| 200 return false; | 206 return false; |
| 201 } | 207 } |
| 202 | 208 |
| 209 bool BrowserPluginEmbedder::StopFindingInGuest(StopFindAction action, |
| 210 WebContents* guest) { |
| 211 if (static_cast<WebContentsImpl*>(guest)->GetBrowserPluginGuest() |
| 212 ->StopFinding(action)) { |
| 213 // There can only ever currently be one browser plugin that handles find so |
| 214 // we can break the iteration at this point. |
| 215 return true; |
| 216 } |
| 217 return false; |
| 218 } |
| 219 |
| 203 } // namespace content | 220 } // namespace content |
| OLD | NEW |