Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_guest_manager.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest_manager.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/browser_plugin/browser_plugin_host_factory.h" | 8 #include "content/browser/browser_plugin/browser_plugin_host_factory.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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 // otherwise the ACK is handled by the guest. | 217 // otherwise the ACK is handled by the guest. |
| 218 void BrowserPluginGuestManager::OnUnhandledSwapBuffersACK( | 218 void BrowserPluginGuestManager::OnUnhandledSwapBuffersACK( |
| 219 int instance_id, | 219 int instance_id, |
| 220 const FrameHostMsg_BuffersSwappedACK_Params& params) { | 220 const FrameHostMsg_BuffersSwappedACK_Params& params) { |
| 221 BrowserPluginGuest::AcknowledgeBufferPresent(params.gpu_route_id, | 221 BrowserPluginGuest::AcknowledgeBufferPresent(params.gpu_route_id, |
| 222 params.gpu_host_id, | 222 params.gpu_host_id, |
| 223 params.mailbox_name, | 223 params.mailbox_name, |
| 224 params.sync_point); | 224 params.sync_point); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void BrowserPluginGuestManager::GetGuests( | |
| 228 WebContentsImpl* embedder_web_contents, | |
| 229 base::Callback<void(BrowserPluginGuest*)> callback) { | |
| 230 for (GuestInstanceMap::iterator it = | |
| 231 guest_web_contents_by_instance_id_.begin(); | |
| 232 it != guest_web_contents_by_instance_id_.end(); ++it) { | |
|
nasko
2014/01/06 21:58:40
nit: indent should match GuestInstanceMap.
Fady Samuel
2014/01/08 19:42:43
Done.
| |
| 233 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); | |
| 234 if (embedder_web_contents != guest->embedder_web_contents()) | |
| 235 continue; | |
| 236 callback.Run(guest); | |
| 237 } | |
| 238 } | |
| 239 | |
| 227 void BrowserPluginGuestManager::DidSendScreenRects( | 240 void BrowserPluginGuestManager::DidSendScreenRects( |
| 228 WebContentsImpl* embedder_web_contents) { | 241 WebContentsImpl* embedder_web_contents) { |
| 229 // TODO(lazyboy): Generalize iterating over guest instances and performing | 242 // TODO(lazyboy): Generalize iterating over guest instances and performing |
| 230 // actions on the guests. | 243 // actions on the guests. |
| 231 for (GuestInstanceMap::iterator it = | 244 for (GuestInstanceMap::iterator it = |
| 232 guest_web_contents_by_instance_id_.begin(); | 245 guest_web_contents_by_instance_id_.begin(); |
| 233 it != guest_web_contents_by_instance_id_.end(); ++it) { | 246 it != guest_web_contents_by_instance_id_.end(); ++it) { |
| 234 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); | 247 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); |
| 235 if (embedder_web_contents == guest->embedder_web_contents()) { | 248 if (embedder_web_contents == guest->embedder_web_contents()) { |
| 236 static_cast<RenderViewHostImpl*>( | 249 static_cast<RenderViewHostImpl*>( |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 256 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); | 269 BrowserPluginGuest* guest = it->second->GetBrowserPluginGuest(); |
| 257 if (embedder_web_contents == guest->embedder_web_contents()) { | 270 if (embedder_web_contents == guest->embedder_web_contents()) { |
| 258 if (guest->UnlockMouseIfNecessary(event)) | 271 if (guest->UnlockMouseIfNecessary(event)) |
| 259 return true; | 272 return true; |
| 260 } | 273 } |
| 261 } | 274 } |
| 262 return false; | 275 return false; |
| 263 } | 276 } |
| 264 | 277 |
| 265 } // namespace content | 278 } // namespace content |
| OLD | NEW |