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/browser_plugin/browser_plugin_host_factory.h" | 9 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 void BrowserPluginEmbedder::DidSendScreenRects() { | 82 void BrowserPluginEmbedder::DidSendScreenRects() { |
83 GetBrowserPluginGuestManager()->ForEachGuest( | 83 GetBrowserPluginGuestManager()->ForEachGuest( |
84 GetWebContents(), base::Bind( | 84 GetWebContents(), base::Bind( |
85 &BrowserPluginEmbedder::DidSendScreenRectsCallback, | 85 &BrowserPluginEmbedder::DidSendScreenRectsCallback, |
86 base::Unretained(this))); | 86 base::Unretained(this))); |
87 } | 87 } |
88 | 88 |
89 bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback( | |
90 const NativeWebKeyboardEvent& event, | |
91 WebContents* guest_web_contents) { | |
92 return static_cast<WebContentsImpl*>(guest_web_contents)-> | |
93 GetBrowserPluginGuest()->UnlockMouseIfNecessary(event); | |
94 } | |
95 | |
96 bool BrowserPluginEmbedder::HandleKeyboardEvent( | |
97 const NativeWebKeyboardEvent& event) { | |
98 if ((event.type != blink::WebInputEvent::RawKeyDown) || | |
99 (event.windowsKeyCode != ui::VKEY_ESCAPE) || | |
100 (event.modifiers & blink::WebInputEvent::InputModifiers)) { | |
101 return false; | |
102 } | |
103 | |
104 return GetBrowserPluginGuestManager()->ForEachGuest( | |
105 GetWebContents(), | |
106 base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback, | |
107 base::Unretained(this), | |
108 event)); | |
109 } | |
110 | |
111 bool BrowserPluginEmbedder::SetZoomLevelCallback( | 89 bool BrowserPluginEmbedder::SetZoomLevelCallback( |
112 double level, WebContents* guest_web_contents) { | 90 double level, WebContents* guest_web_contents) { |
113 double zoom_factor = content::ZoomLevelToZoomFactor(level); | 91 double zoom_factor = content::ZoomLevelToZoomFactor(level); |
114 static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()-> | 92 static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()-> |
115 SetZoom(zoom_factor); | 93 SetZoom(zoom_factor); |
116 // Not handled => Iterate over all guests. | 94 // Not handled => Iterate over all guests. |
117 return false; | 95 return false; |
118 } | 96 } |
119 | 97 |
120 void BrowserPluginEmbedder::SetZoomLevel(double level) { | 98 void BrowserPluginEmbedder::SetZoomLevel(double level) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 194 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( |
217 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 195 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), |
218 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 196 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, |
219 base::Unretained(this), | 197 base::Unretained(this), |
220 instance_id, | 198 instance_id, |
221 params, | 199 params, |
222 &extra_params)); | 200 &extra_params)); |
223 } | 201 } |
224 | 202 |
225 } // namespace content | 203 } // namespace content |
OLD | NEW |