| 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::SetZoomLevelCallback( | |
| 90 double level, WebContents* guest_web_contents) { | |
| 91 double zoom_factor = content::ZoomLevelToZoomFactor(level); | |
| 92 static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()-> | |
| 93 SetZoom(zoom_factor); | |
| 94 // Not handled => Iterate over all guests. | |
| 95 return false; | |
| 96 } | |
| 97 | |
| 98 void BrowserPluginEmbedder::SetZoomLevel(double level) { | |
| 99 GetBrowserPluginGuestManager()->ForEachGuest( | |
| 100 GetWebContents(), base::Bind( | |
| 101 &BrowserPluginEmbedder::SetZoomLevelCallback, | |
| 102 base::Unretained(this), | |
| 103 level)); | |
| 104 } | |
| 105 | |
| 106 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { | 89 bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) { |
| 107 bool handled = true; | 90 bool handled = true; |
| 108 IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) | 91 IPC_BEGIN_MESSAGE_MAP(BrowserPluginEmbedder, message) |
| 109 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, | 92 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, |
| 110 OnAllocateInstanceID) | 93 OnAllocateInstanceID) |
| 111 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach) | 94 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Attach, OnAttach) |
| 112 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor, | 95 IPC_MESSAGE_HANDLER_GENERIC(DragHostMsg_UpdateDragCursor, |
| 113 OnUpdateDragCursor(&handled)); | 96 OnUpdateDragCursor(&handled)); |
| 114 IPC_MESSAGE_UNHANDLED(handled = false) | 97 IPC_MESSAGE_UNHANDLED(handled = false) |
| 115 IPC_END_MESSAGE_MAP() | 98 IPC_END_MESSAGE_MAP() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 177 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( |
| 195 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 178 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), |
| 196 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 179 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, |
| 197 base::Unretained(this), | 180 base::Unretained(this), |
| 198 instance_id, | 181 instance_id, |
| 199 params, | 182 params, |
| 200 &extra_params)); | 183 &extra_params)); |
| 201 } | 184 } |
| 202 | 185 |
| 203 } // namespace content | 186 } // namespace content |
| OLD | NEW |