| 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/renderer/browser_plugin/browser_plugin_manager_impl.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
| 6 | 6 |
| 7 #include "content/common/browser_plugin_messages.h" | 7 #include "content/common/browser_plugin_messages.h" |
| 8 #include "content/renderer/browser_plugin/browser_plugin.h" | 8 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 return new BrowserPlugin(browser_plugin_counter_++, | 23 return new BrowserPlugin(browser_plugin_counter_++, |
| 24 render_view, | 24 render_view, |
| 25 frame, | 25 frame, |
| 26 params); | 26 params); |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) { | 29 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) { |
| 30 return RenderThread::Get()->Send(msg); | 30 return RenderThread::Get()->Send(msg); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void BrowserPluginManagerImpl::SignalTextureProviderIsReady(int instance_id) { |
| 34 GetBrowserPlugin(instance_id)->TextureProviderIsReady(); |
| 35 } |
| 36 |
| 33 bool BrowserPluginManagerImpl::OnControlMessageReceived( | 37 bool BrowserPluginManagerImpl::OnControlMessageReceived( |
| 34 const IPC::Message& message) { | 38 const IPC::Message& message) { |
| 35 DCHECK(CalledOnValidThread()); | 39 DCHECK(CalledOnValidThread()); |
| 36 bool handled = true; | 40 bool handled = true; |
| 37 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) | 41 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) |
| 38 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) | 42 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) |
| 39 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestCrashed,OnGuestCrashed) | 43 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestCrashed,OnGuestCrashed) |
| 40 IPC_MESSAGE_HANDLER(BrowserPluginMsg_DidNavigate, OnDidNavigate) | 44 IPC_MESSAGE_HANDLER(BrowserPluginMsg_DidNavigate, OnDidNavigate) |
| 41 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) | 45 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) |
| 46 IPC_MESSAGE_HANDLER(BrowserPluginMsg_BuffersSwapped, OnBuffersSwapped) |
| 47 IPC_MESSAGE_HANDLER(BrowserPluginMsg_SurfaceResize, OnSurfaceResize) |
| 42 IPC_MESSAGE_UNHANDLED(handled = false) | 48 IPC_MESSAGE_UNHANDLED(handled = false) |
| 43 IPC_END_MESSAGE_MAP() | 49 IPC_END_MESSAGE_MAP() |
| 44 return handled; | 50 return handled; |
| 45 } | 51 } |
| 46 | 52 |
| 47 void BrowserPluginManagerImpl::OnUpdateRect( | 53 void BrowserPluginManagerImpl::OnUpdateRect( |
| 48 int instance_id, | 54 int instance_id, |
| 49 int message_id, | 55 int message_id, |
| 50 const BrowserPluginMsg_UpdateRect_Params& params) { | 56 const BrowserPluginMsg_UpdateRect_Params& params) { |
| 51 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 57 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 if (plugin) | 70 if (plugin) |
| 65 plugin->DidNavigate(url); | 71 plugin->DidNavigate(url); |
| 66 } | 72 } |
| 67 | 73 |
| 68 void BrowserPluginManagerImpl::OnAdvanceFocus(int instance_id, bool reverse) { | 74 void BrowserPluginManagerImpl::OnAdvanceFocus(int instance_id, bool reverse) { |
| 69 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 75 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 70 if (plugin) | 76 if (plugin) |
| 71 plugin->AdvanceFocus(reverse); | 77 plugin->AdvanceFocus(reverse); |
| 72 } | 78 } |
| 73 | 79 |
| 80 void BrowserPluginManagerImpl::OnBuffersSwapped( |
| 81 int instance_id, |
| 82 uint64 surface_handle, |
| 83 const BrowserPlugin_SwapInfo& info) { |
| 84 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 85 if (plugin) |
| 86 plugin->BuffersSwapped(surface_handle, info); |
| 87 } |
| 88 |
| 89 void BrowserPluginManagerImpl::OnSurfaceResize( |
| 90 int instance_id, |
| 91 const gfx::Size& size) { |
| 92 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 93 if (plugin) |
| 94 plugin->SurfaceResize(size); |
| 95 } |
| 96 |
| 74 } // namespace content | 97 } // namespace content |
| OLD | NEW |