OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
| 6 |
| 7 #include "content/common/browser_plugin_messages.h" |
| 8 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 9 #include "content/renderer/render_thread_impl.h" |
| 10 |
| 11 namespace content { |
| 12 namespace browser_plugin { |
| 13 |
| 14 BrowserPluginManagerImpl::BrowserPluginManagerImpl() { |
| 15 } |
| 16 |
| 17 BrowserPluginManagerImpl::~BrowserPluginManagerImpl() { |
| 18 } |
| 19 |
| 20 BrowserPlugin* BrowserPluginManagerImpl::CreateBrowserPlugin( |
| 21 RenderViewImpl* render_view, |
| 22 WebKit::WebFrame* frame, |
| 23 const WebKit::WebPluginParams& params) { |
| 24 return new BrowserPlugin(browser_plugin_counter_++, |
| 25 render_view, |
| 26 render_view->GetRoutingID(), |
| 27 frame, |
| 28 params); |
| 29 } |
| 30 |
| 31 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) { |
| 32 return RenderThread::Get()->Send(msg); |
| 33 } |
| 34 |
| 35 bool BrowserPluginManagerImpl::OnControlMessageReceived( |
| 36 const IPC::Message& message) { |
| 37 bool handled = true; |
| 38 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) |
| 39 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateRect, OnUpdateRect) |
| 40 IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestCrashed,OnGuestCrashed) |
| 41 IPC_MESSAGE_HANDLER(BrowserPluginMsg_UpdateURL, OnUpdateURL) |
| 42 IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus) |
| 43 IPC_MESSAGE_UNHANDLED(handled = false) |
| 44 IPC_END_MESSAGE_MAP() |
| 45 return handled; |
| 46 } |
| 47 |
| 48 void BrowserPluginManagerImpl::OnUpdateRect( |
| 49 int instance_id, |
| 50 int message_id, |
| 51 const BrowserPluginMsg_UpdateRect_Params& params) { |
| 52 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 53 if (plugin) |
| 54 plugin->UpdateRect(message_id, params); |
| 55 } |
| 56 |
| 57 void BrowserPluginManagerImpl::OnGuestCrashed(int instance_id) { |
| 58 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 59 if (plugin) |
| 60 plugin->GuestCrashed(); |
| 61 } |
| 62 |
| 63 void BrowserPluginManagerImpl::OnUpdateURL(int instance_id, const GURL& url) { |
| 64 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 65 if (plugin) |
| 66 plugin->UpdateURL(url); |
| 67 } |
| 68 |
| 69 void BrowserPluginManagerImpl::OnAdvanceFocus(int instance_id, bool reverse) { |
| 70 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
| 71 if (plugin) |
| 72 plugin->AdvanceFocus(reverse); |
| 73 } |
| 74 |
| 75 } // namespace browser_plugin |
| 76 } // namespace content |
OLD | NEW |