Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_guest_manager.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc |
| index 8fb51b664a83b1bb6bb5bbec053a8bf9d05efff5..c37bf3bf5569c3a36f15d25d57c76faff5915030 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc |
| @@ -17,7 +17,6 @@ |
| #include "content/public/common/url_constants.h" |
| #include "content/public/common/url_utils.h" |
| #include "net/base/escape.h" |
| -#include "ui/events/keycodes/keyboard_codes.h" |
| namespace content { |
| @@ -224,40 +223,18 @@ void BrowserPluginGuestManager::OnUnhandledSwapBuffersACK( |
| params.sync_point); |
| } |
| -void BrowserPluginGuestManager::DidSendScreenRects( |
| - WebContentsImpl* embedder_web_contents) { |
| - // TODO(lazyboy): Generalize iterating over guest instances and performing |
| - // actions on the guests. |
| - for (GuestInstanceMap::iterator it = |
| - guest_web_contents_by_instance_id_.begin(); |
| - it != guest_web_contents_by_instance_id_.end(); ++it) { |
| - BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); |
| - if (embedder_web_contents == guest->embedder_web_contents()) { |
| - static_cast<RenderViewHostImpl*>( |
| - guest->GetWebContents()->GetRenderViewHost())->SendScreenRects(); |
| - } |
| - } |
| -} |
| - |
| -bool BrowserPluginGuestManager::UnlockMouseIfNecessary( |
| +bool BrowserPluginGuestManager::ForEachGuest( |
| WebContentsImpl* embedder_web_contents, |
| - const NativeWebKeyboardEvent& event) { |
| - if ((event.type != blink::WebInputEvent::RawKeyDown) || |
| - (event.windowsKeyCode != ui::VKEY_ESCAPE) || |
| - (event.modifiers & blink::WebInputEvent::InputModifiers)) { |
| - return false; |
| - } |
| - |
| - // TODO(lazyboy): Generalize iterating over guest instances and performing |
| - // actions on the guests. |
| + base::Callback<bool(BrowserPluginGuest*)> callback) { |
| for (GuestInstanceMap::iterator it = |
| guest_web_contents_by_instance_id_.begin(); |
| it != guest_web_contents_by_instance_id_.end(); ++it) { |
| BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); |
| - if (embedder_web_contents == guest->embedder_web_contents()) { |
| - if (guest->UnlockMouseIfNecessary(event)) |
| - return true; |
| - } |
| + if (embedder_web_contents != guest->embedder_web_contents()) |
| + continue; |
| + |
| + if (callback.Run(guest)) |
|
nasko
2014/01/08 17:58:42
nit: I see that this fits in how HandleInputEvent
Fady Samuel
2014/01/08 18:22:40
Agreed, but I can't think of a better way to do th
|
| + return true; |
| } |
| return false; |
| } |