| 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/old/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/old/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "content/common/browser_plugin_messages.h" | 15 #include "content/common/old_browser_plugin_messages.h" |
| 16 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 17 #include "content/renderer/render_view_impl.h" | 17 #include "content/renderer/render_view_impl.h" |
| 18 #include "ipc/ipc_channel_handle.h" | 18 #include "ipc/ipc_channel_handle.h" |
| 19 #include "ppapi/proxy/host_dispatcher.h" | 19 #include "ppapi/proxy/host_dispatcher.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 24 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 24 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
| 25 #include "webkit/plugins/webview_plugin.h" | 25 #include "webkit/plugins/webview_plugin.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 plugin_(NULL) { | 76 plugin_(NULL) { |
| 77 id_ = ++g_next_id; | 77 id_ = ++g_next_id; |
| 78 Register(id_, this); | 78 Register(id_, this); |
| 79 | 79 |
| 80 // By default we do not navigate and simply stay with an | 80 // By default we do not navigate and simply stay with an |
| 81 // about:blank placeholder. | 81 // about:blank placeholder. |
| 82 std::string src; | 82 std::string src; |
| 83 ParseSrcAttribute("", &src); | 83 ParseSrcAttribute("", &src); |
| 84 | 84 |
| 85 if (!src.empty()) { | 85 if (!src.empty()) { |
| 86 render_view->Send(new BrowserPluginHostMsg_NavigateFromEmbedder( | 86 render_view->Send(new OldBrowserPluginHostMsg_NavigateFromEmbedder( |
| 87 render_view->GetRoutingID(), | 87 render_view->GetRoutingID(), |
| 88 id_, | 88 id_, |
| 89 frame->identifier(), | 89 frame->identifier(), |
| 90 src)); | 90 src)); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 BrowserPlugin::~BrowserPlugin() { | 94 BrowserPlugin::~BrowserPlugin() { |
| 95 Unregister(id_); | 95 Unregister(id_); |
| 96 } | 96 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!new_plugin || !new_plugin->initialize(container)) | 135 if (!new_plugin || !new_plugin->initialize(container)) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 // Clear the container's backing texture ID. | 138 // Clear the container's backing texture ID. |
| 139 if (plugin_) | 139 if (plugin_) |
| 140 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); | 140 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); |
| 141 | 141 |
| 142 PP_Instance instance = new_plugin->instance()->pp_instance(); | 142 PP_Instance instance = new_plugin->instance()->pp_instance(); |
| 143 ppapi::proxy::HostDispatcher* dispatcher = | 143 ppapi::proxy::HostDispatcher* dispatcher = |
| 144 ppapi::proxy::HostDispatcher::GetForInstance(instance); | 144 ppapi::proxy::HostDispatcher::GetForInstance(instance); |
| 145 dispatcher->Send(new BrowserPluginMsg_GuestReady(instance, id_)); | 145 dispatcher->Send(new OldBrowserPluginMsg_GuestReady(instance, id_)); |
| 146 | 146 |
| 147 // TODO(fsamuel): We should delay the swapping out of the current plugin | 147 // TODO(fsamuel): We should delay the swapping out of the current plugin |
| 148 // until after the guest's WebGraphicsContext3D has been initialized. That | 148 // until after the guest's WebGraphicsContext3D has been initialized. That |
| 149 // way, we immediately have something to render onto the screen. | 149 // way, we immediately have something to render onto the screen. |
| 150 container->setPlugin(new_plugin); | 150 container->setPlugin(new_plugin); |
| 151 container->invalidate(); | 151 container->invalidate(); |
| 152 container->reportGeometry(); | 152 container->reportGeometry(); |
| 153 if (plugin_) | 153 if (plugin_) |
| 154 plugin_->destroy(); | 154 plugin_->destroy(); |
| 155 plugin_ = new_plugin; | 155 plugin_ = new_plugin; |
| 156 } | 156 } |
| OLD | NEW |