| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 BrowserPluginGuest* BrowserPluginEmbedder::GetFullPageGuest() { | 213 BrowserPluginGuest* BrowserPluginEmbedder::GetFullPageGuest() { |
| 214 WebContentsImpl* guest_contents = static_cast<WebContentsImpl*>( | 214 WebContentsImpl* guest_contents = static_cast<WebContentsImpl*>( |
| 215 GetBrowserPluginGuestManager()->GetFullPageGuest(web_contents())); | 215 GetBrowserPluginGuestManager()->GetFullPageGuest(web_contents())); |
| 216 if (!guest_contents) | 216 if (!guest_contents) |
| 217 return nullptr; | 217 return nullptr; |
| 218 return guest_contents->GetBrowserPluginGuest(); | 218 return guest_contents->GetBrowserPluginGuest(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 // static | 221 // static |
| 222 bool BrowserPluginEmbedder::GuestRecentlyAudibleCallback(WebContents* guest) { |
| 223 return guest->WasRecentlyAudible(); |
| 224 } |
| 225 |
| 226 bool BrowserPluginEmbedder::WereAnyGuestsRecentlyAudible() { |
| 227 return GetBrowserPluginGuestManager()->ForEachGuest( |
| 228 web_contents(), |
| 229 base::Bind(&BrowserPluginEmbedder::GuestRecentlyAudibleCallback)); |
| 230 } |
| 231 |
| 232 // static |
| 222 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 233 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
| 223 WebContents* guest) { | 234 WebContents* guest) { |
| 224 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) | 235 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) |
| 225 ->GetBrowserPluginGuest() | 236 ->GetBrowserPluginGuest() |
| 226 ->mouse_locked(); | 237 ->mouse_locked(); |
| 227 guest->GotResponseToLockMouseRequest(false); | 238 guest->GotResponseToLockMouseRequest(false); |
| 228 | 239 |
| 229 // Returns false to iterate over all guests. | 240 // Returns false to iterate over all guests. |
| 230 return false; | 241 return false; |
| 231 } | 242 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 252 ->GetBrowserPluginGuest() | 263 ->GetBrowserPluginGuest() |
| 253 ->HandleStopFindingForEmbedder(action)) { | 264 ->HandleStopFindingForEmbedder(action)) { |
| 254 // There can only ever currently be one browser plugin that handles find so | 265 // There can only ever currently be one browser plugin that handles find so |
| 255 // we can break the iteration at this point. | 266 // we can break the iteration at this point. |
| 256 return true; | 267 return true; |
| 257 } | 268 } |
| 258 return false; | 269 return false; |
| 259 } | 270 } |
| 260 | 271 |
| 261 } // namespace content | 272 } // namespace content |
| OLD | NEW |