| 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/browser_plugin_constants.h" | 7 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 8 #include "content/common/browser_plugin/browser_plugin_messages.h" | 8 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 9 #include "content/common/cursors/webcursor.h" | 9 #include "content/common/cursors/webcursor.h" |
| 10 #include "content/renderer/browser_plugin/browser_plugin.h" | 10 #include "content/renderer/browser_plugin/browser_plugin.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 BrowserPlugin* BrowserPluginManagerImpl::CreateBrowserPlugin( | 25 BrowserPlugin* BrowserPluginManagerImpl::CreateBrowserPlugin( |
| 26 RenderViewImpl* render_view, | 26 RenderViewImpl* render_view, |
| 27 blink::WebFrame* frame, | 27 blink::WebFrame* frame, |
| 28 bool auto_navigate) { | 28 bool auto_navigate) { |
| 29 return new BrowserPlugin(render_view, frame, auto_navigate); | 29 return new BrowserPlugin(render_view, frame, auto_navigate); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void BrowserPluginManagerImpl::AllocateInstanceID( | 32 void BrowserPluginManagerImpl::AllocateInstanceID( |
| 33 const base::WeakPtr<BrowserPlugin>& browser_plugin) { | 33 const base::WeakPtr<BrowserPlugin>& browser_plugin, |
| 34 const std::string& src) { |
| 34 int request_id = ++request_id_counter_; | 35 int request_id = ++request_id_counter_; |
| 35 pending_allocate_guest_instance_id_requests_.insert( | 36 pending_allocate_guest_instance_id_requests_.insert( |
| 36 std::make_pair(request_id, browser_plugin)); | 37 std::make_pair(request_id, browser_plugin)); |
| 37 Send(new BrowserPluginHostMsg_AllocateInstanceID( | 38 Send(new BrowserPluginHostMsg_AllocateInstanceID( |
| 38 browser_plugin->render_view_routing_id(), request_id)); | 39 browser_plugin->render_view_routing_id(), request_id, src)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) { | 42 bool BrowserPluginManagerImpl::Send(IPC::Message* msg) { |
| 42 return RenderThread::Get()->Send(msg); | 43 return RenderThread::Get()->Send(msg); |
| 43 } | 44 } |
| 44 | 45 |
| 45 bool BrowserPluginManagerImpl::OnMessageReceived( | 46 bool BrowserPluginManagerImpl::OnMessageReceived( |
| 46 const IPC::Message& message) { | 47 const IPC::Message& message) { |
| 47 if (BrowserPlugin::ShouldForwardToBrowserPlugin(message)) { | 48 if (BrowserPlugin::ShouldForwardToBrowserPlugin(message)) { |
| 48 int guest_instance_id = browser_plugin::kInstanceIDNone; | 49 int guest_instance_id = browser_plugin::kInstanceIDNone; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return; | 84 return; |
| 84 | 85 |
| 85 const base::WeakPtr<BrowserPlugin> plugin(it->second); | 86 const base::WeakPtr<BrowserPlugin> plugin(it->second); |
| 86 if (!plugin) | 87 if (!plugin) |
| 87 return; | 88 return; |
| 88 pending_allocate_guest_instance_id_requests_.erase(request_id); | 89 pending_allocate_guest_instance_id_requests_.erase(request_id); |
| 89 plugin->OnInstanceIDAllocated(guest_instance_id); | 90 plugin->OnInstanceIDAllocated(guest_instance_id); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace content | 93 } // namespace content |
| OLD | NEW |