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.h" | 5 #include "content/renderer/browser_plugin/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void BrowserPlugin::LoadGuest( | 116 void BrowserPlugin::LoadGuest( |
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) { |
| 127 // TODO(fsamuel): Uncomment this once http://wkbug.com/88827 lands. |
| 128 // render_view()->GetWebView()->advanceFocus(reverse); |
| 129 } |
| 130 |
126 void BrowserPlugin::Replace( | 131 void BrowserPlugin::Replace( |
127 webkit::ppapi::WebPluginImpl* new_plugin) { | 132 webkit::ppapi::WebPluginImpl* new_plugin) { |
128 WebKit::WebPlugin* current_plugin = | 133 WebKit::WebPlugin* current_plugin = |
129 plugin_ ? static_cast<WebKit::WebPlugin*>(plugin_) : placeholder_; | 134 plugin_ ? static_cast<WebKit::WebPlugin*>(plugin_) : placeholder_; |
130 WebKit::WebPluginContainer* container = current_plugin->container(); | 135 WebKit::WebPluginContainer* container = current_plugin->container(); |
131 if (!new_plugin || !new_plugin->initialize(container)) | 136 if (!new_plugin || !new_plugin->initialize(container)) |
132 return; | 137 return; |
133 | 138 |
134 // Clear the container's backing texture ID. | 139 // Clear the container's backing texture ID. |
135 if (plugin_) | 140 if (plugin_) |
136 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); | 141 plugin_->instance()->BindGraphics(plugin_->instance()->pp_instance(), 0); |
137 | 142 |
138 PP_Instance instance = new_plugin->instance()->pp_instance(); | 143 PP_Instance instance = new_plugin->instance()->pp_instance(); |
139 ppapi::proxy::HostDispatcher* dispatcher = | 144 ppapi::proxy::HostDispatcher* dispatcher = |
140 ppapi::proxy::HostDispatcher::GetForInstance(instance); | 145 ppapi::proxy::HostDispatcher::GetForInstance(instance); |
141 dispatcher->Send(new BrowserPluginMsg_GuestReady(instance, id_)); | 146 dispatcher->Send(new BrowserPluginMsg_GuestReady(instance, id_)); |
142 | 147 |
143 // TODO(fsamuel): We should delay the swapping out of the current plugin | 148 // TODO(fsamuel): We should delay the swapping out of the current plugin |
144 // until after the guest's WebGraphicsContext3D has been initialized. That | 149 // until after the guest's WebGraphicsContext3D has been initialized. That |
145 // way, we immediately have something to render onto the screen. | 150 // way, we immediately have something to render onto the screen. |
146 container->setPlugin(new_plugin); | 151 container->setPlugin(new_plugin); |
147 container->invalidate(); | 152 container->invalidate(); |
148 container->reportGeometry(); | 153 container->reportGeometry(); |
149 if (plugin_) | 154 if (plugin_) |
150 plugin_->destroy(); | 155 plugin_->destroy(); |
151 plugin_ = new_plugin; | 156 plugin_ = new_plugin; |
152 } | 157 } |
OLD | NEW |