Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, | 243 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, |
| 244 OnAllocateInstanceID) | 244 OnAllocateInstanceID) |
| 245 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, | 245 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, |
| 246 OnCreateGuest) | 246 OnCreateGuest) |
| 247 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse, | 247 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginAtPositionResponse, |
| 248 OnPluginAtPositionResponse) | 248 OnPluginAtPositionResponse) |
| 249 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginDestroyed, | 249 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_PluginDestroyed, |
| 250 OnPluginDestroyed) | 250 OnPluginDestroyed) |
| 251 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK, | 251 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_BuffersSwappedACK, |
| 252 OnSwapBuffersACK) | 252 OnSwapBuffersACK) |
| 253 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllowMediaAccess, | |
| 254 OnAllowMediaAccess) | |
| 253 IPC_MESSAGE_UNHANDLED(handled = false) | 255 IPC_MESSAGE_UNHANDLED(handled = false) |
| 254 IPC_END_MESSAGE_MAP() | 256 IPC_END_MESSAGE_MAP() |
| 255 return handled; | 257 return handled; |
| 256 } | 258 } |
| 257 | 259 |
| 258 void BrowserPluginEmbedder::Observe(int type, | 260 void BrowserPluginEmbedder::Observe(int type, |
| 259 const NotificationSource& source, | 261 const NotificationSource& source, |
| 260 const NotificationDetails& details) { | 262 const NotificationDetails& details) { |
| 261 switch (type) { | 263 switch (type) { |
| 262 case NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED: { | 264 case NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED: { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 render_view_host = render_view_host_; | 354 render_view_host = render_view_host_; |
| 353 | 355 |
| 354 callback_iter->second.Run(render_view_host, position.x(), position.y()); | 356 callback_iter->second.Run(render_view_host, position.x(), position.y()); |
| 355 pending_get_render_view_callbacks_.erase(callback_iter); | 357 pending_get_render_view_callbacks_.erase(callback_iter); |
| 356 } | 358 } |
| 357 | 359 |
| 358 void BrowserPluginEmbedder::OnPluginDestroyed(int instance_id) { | 360 void BrowserPluginEmbedder::OnPluginDestroyed(int instance_id) { |
| 359 DestroyGuestByInstanceID(instance_id); | 361 DestroyGuestByInstanceID(instance_id); |
| 360 } | 362 } |
| 361 | 363 |
| 364 void BrowserPluginEmbedder::OnAllowMediaAccess(int instance_id, | |
| 365 int request_id, | |
| 366 bool should_allow) { | |
| 367 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | |
|
Fady Samuel
2013/02/05 17:53:27
No need for this. Simply add BrowserPluginHostMsg_
lazyboy
2013/02/07 04:38:42
Yep, we also have embedder_web_contents_ directly
| |
| 368 if (guest) | |
| 369 guest->AllowMediaAccess(web_contents(), request_id, should_allow); | |
| 370 } | |
| 371 | |
| 362 void BrowserPluginEmbedder::OnSwapBuffersACK(int route_id, | 372 void BrowserPluginEmbedder::OnSwapBuffersACK(int route_id, |
| 363 int gpu_host_id, | 373 int gpu_host_id, |
| 364 const std::string& mailbox_name, | 374 const std::string& mailbox_name, |
| 365 uint32 sync_point) { | 375 uint32 sync_point) { |
| 366 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 376 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 367 ack_params.mailbox_name = mailbox_name; | 377 ack_params.mailbox_name = mailbox_name; |
| 368 ack_params.sync_point = sync_point; | 378 ack_params.sync_point = sync_point; |
| 369 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 379 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 370 gpu_host_id, | 380 gpu_host_id, |
| 371 ack_params); | 381 ack_params); |
| 372 } | 382 } |
| 373 | 383 |
| 374 } // namespace content | 384 } // namespace content |
| OLD | NEW |