| 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 "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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 bool BrowserPluginEmbedder::GuestRecentlyAudibleCallback(WebContents* guest) { | 216 bool BrowserPluginEmbedder::GuestRecentlyAudibleCallback(WebContents* guest) { |
| 217 return guest->WasRecentlyAudible(); | 217 return guest->WasRecentlyAudible(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 bool BrowserPluginEmbedder::WereAnyGuestsRecentlyAudible() { | 220 bool BrowserPluginEmbedder::WereAnyGuestsRecentlyAudible() { |
| 221 return GetBrowserPluginGuestManager()->ForEachGuest( | 221 return GetBrowserPluginGuestManager()->ForEachGuest( |
| 222 web_contents(), | 222 web_contents(), |
| 223 base::Bind(&BrowserPluginEmbedder::GuestRecentlyAudibleCallback)); | 223 base::Bind(&BrowserPluginEmbedder::GuestRecentlyAudibleCallback)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool BrowserPluginEmbedder::AreAnyGuestsFocused() { |
| 227 BrowserPluginGuestManager::GuestCallback callback = |
| 228 base::Bind([](WebContents* guest) { |
| 229 return static_cast<WebContentsImpl*>(guest) |
| 230 ->GetBrowserPluginGuest() |
| 231 ->focused(); |
| 232 }); |
| 233 return GetBrowserPluginGuestManager()->ForEachGuest(web_contents(), callback); |
| 234 } |
| 235 |
| 226 // static | 236 // static |
| 227 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 237 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
| 228 WebContents* guest) { | 238 WebContents* guest) { |
| 229 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) | 239 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) |
| 230 ->GetBrowserPluginGuest() | 240 ->GetBrowserPluginGuest() |
| 231 ->mouse_locked(); | 241 ->mouse_locked(); |
| 232 guest->GotResponseToLockMouseRequest(false); | 242 guest->GotResponseToLockMouseRequest(false); |
| 233 | 243 |
| 234 // Returns false to iterate over all guests. | 244 // Returns false to iterate over all guests. |
| 235 return false; | 245 return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 257 ->GetBrowserPluginGuest() | 267 ->GetBrowserPluginGuest() |
| 258 ->HandleStopFindingForEmbedder(action)) { | 268 ->HandleStopFindingForEmbedder(action)) { |
| 259 // There can only ever currently be one browser plugin that handles find so | 269 // There can only ever currently be one browser plugin that handles find so |
| 260 // we can break the iteration at this point. | 270 // we can break the iteration at this point. |
| 261 return true; | 271 return true; |
| 262 } | 272 } |
| 263 return false; | 273 return false; |
| 264 } | 274 } |
| 265 | 275 |
| 266 } // namespace content | 276 } // namespace content |
| OLD | NEW |