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" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 int guest_process_id, | 117 int guest_process_id, |
118 const IPC::ChannelHandle& channel_handle) { | 118 const IPC::ChannelHandle& channel_handle) { |
119 webkit::ppapi::WebPluginImpl* new_guest = | 119 webkit::ppapi::WebPluginImpl* new_guest = |
120 render_view()->CreateBrowserPlugin(channel_handle, | 120 render_view()->CreateBrowserPlugin(channel_handle, |
121 guest_process_id, | 121 guest_process_id, |
122 plugin_params()); | 122 plugin_params()); |
123 Replace(new_guest); | 123 Replace(new_guest); |
124 } | 124 } |
125 | 125 |
126 void BrowserPlugin::AdvanceFocus(bool reverse) { | 126 void BrowserPlugin::AdvanceFocus(bool reverse) { |
127 // TODO(fsamuel): Uncomment this once http://wkbug.com/88827 lands. | 127 render_view()->GetWebView()->advanceFocus(reverse); |
128 // render_view()->GetWebView()->advanceFocus(reverse); | |
129 } | 128 } |
130 | 129 |
131 void BrowserPlugin::Replace( | 130 void BrowserPlugin::Replace( |
132 webkit::ppapi::WebPluginImpl* new_plugin) { | 131 webkit::ppapi::WebPluginImpl* new_plugin) { |
133 WebKit::WebPlugin* current_plugin = | 132 WebKit::WebPlugin* current_plugin = |
134 plugin_ ? static_cast<WebKit::WebPlugin*>(plugin_) : placeholder_; | 133 plugin_ ? static_cast<WebKit::WebPlugin*>(plugin_) : placeholder_; |
135 WebKit::WebPluginContainer* container = current_plugin->container(); | 134 WebKit::WebPluginContainer* container = current_plugin->container(); |
136 if (!new_plugin || !new_plugin->initialize(container)) | 135 if (!new_plugin || !new_plugin->initialize(container)) |
137 return; | 136 return; |
138 | 137 |
139 // Clear the container's backing texture ID. | 138 // Clear the container's backing texture ID. |
140 if (plugin_) | 139 if (plugin_) |
141 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); | 140 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); |
142 | 141 |
143 PP_Instance instance = new_plugin->instance()->pp_instance(); | 142 PP_Instance instance = new_plugin->instance()->pp_instance(); |
144 ppapi::proxy::HostDispatcher* dispatcher = | 143 ppapi::proxy::HostDispatcher* dispatcher = |
145 ppapi::proxy::HostDispatcher::GetForInstance(instance); | 144 ppapi::proxy::HostDispatcher::GetForInstance(instance); |
146 dispatcher->Send(new BrowserPluginMsg_GuestReady(instance, id_)); | 145 dispatcher->Send(new BrowserPluginMsg_GuestReady(instance, id_)); |
147 | 146 |
148 // 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 |
149 // until after the guest's WebGraphicsContext3D has been initialized. That | 148 // until after the guest's WebGraphicsContext3D has been initialized. That |
150 // way, we immediately have something to render onto the screen. | 149 // way, we immediately have something to render onto the screen. |
151 container->setPlugin(new_plugin); | 150 container->setPlugin(new_plugin); |
152 container->invalidate(); | 151 container->invalidate(); |
153 container->reportGeometry(); | 152 container->reportGeometry(); |
154 if (plugin_) | 153 if (plugin_) |
155 plugin_->destroy(); | 154 plugin_->destroy(); |
156 plugin_ = new_plugin; | 155 plugin_ = new_plugin; |
157 } | 156 } |
OLD | NEW |