| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 web_contents(), | 150 web_contents(), |
| 151 browser_plugin_instance_id, | 151 browser_plugin_instance_id, |
| 152 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 152 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, |
| 153 base::Unretained(this), | 153 base::Unretained(this), |
| 154 browser_plugin_instance_id, | 154 browser_plugin_instance_id, |
| 155 params)); | 155 params)); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool BrowserPluginEmbedder::HandleKeyboardEvent( | 158 bool BrowserPluginEmbedder::HandleKeyboardEvent( |
| 159 const NativeWebKeyboardEvent& event) { | 159 const NativeWebKeyboardEvent& event) { |
| 160 if (event.windowsKeyCode != ui::VKEY_ESCAPE) | 160 if ((event.windowsKeyCode != ui::VKEY_ESCAPE) || |
| 161 (event.modifiers & blink::WebInputEvent::InputModifiers)) { |
| 161 return false; | 162 return false; |
| 163 } |
| 162 | 164 |
| 163 bool event_consumed = false; | 165 bool event_consumed = false; |
| 164 GetBrowserPluginGuestManager()->ForEachGuest( | 166 GetBrowserPluginGuestManager()->ForEachGuest( |
| 165 GetWebContents(), | 167 GetWebContents(), |
| 166 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, | 168 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, |
| 167 base::Unretained(this), | 169 base::Unretained(this), |
| 168 &event_consumed)); | 170 &event_consumed)); |
| 169 | 171 |
| 170 return event_consumed; | 172 return event_consumed; |
| 171 } | 173 } |
| 172 | 174 |
| 173 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, | 175 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, |
| 174 WebContents* guest) { | 176 WebContents* guest) { |
| 175 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) | 177 *mouse_unlocked |= static_cast<WebContentsImpl*>(guest) |
| 176 ->GetBrowserPluginGuest() | 178 ->GetBrowserPluginGuest() |
| 177 ->mouse_locked(); | 179 ->mouse_locked(); |
| 178 guest->GotResponseToLockMouseRequest(false); | 180 guest->GotResponseToLockMouseRequest(false); |
| 179 | 181 |
| 180 // Returns false to iterate over all guests. | 182 // Returns false to iterate over all guests. |
| 181 return false; | 183 return false; |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace content | 186 } // namespace content |
| OLD | NEW |