Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/plugin_placeholder.h" | 5 #include "components/plugins/renderer/plugin_placeholder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 container->setPlugin(new_plugin); | 77 container->setPlugin(new_plugin); |
| 78 // Save the element in case the plug-in is removed from the page during | 78 // Save the element in case the plug-in is removed from the page during |
| 79 // initialization. | 79 // initialization. |
| 80 WebElement element = container->element(); | 80 WebElement element = container->element(); |
| 81 if (!new_plugin->initialize(container)) { | 81 if (!new_plugin->initialize(container)) { |
| 82 // We couldn't initialize the new plug-in. Restore the old one and abort. | 82 // We couldn't initialize the new plug-in. Restore the old one and abort. |
| 83 container->setPlugin(plugin_); | 83 container->setPlugin(plugin_); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // We need to transfer the |focused_| to new plugin after it loaded. | |
|
Bernhard Bauer
2014/01/25 14:36:37
Move this down. After ReplayReceivedData() seems t
Ruiyi Luo
2014/01/26 09:40:28
Agree with you.
Merging it with ReplayReceivedDat
| |
| 88 if (plugin_->hasFocus()) { | |
| 89 new_plugin->updateFocus(true); | |
| 90 } | |
| 91 | |
| 87 // The plug-in has been removed from the page. Destroy the old plug-in. We | 92 // The plug-in has been removed from the page. Destroy the old plug-in. We |
| 88 // will be destroyed as soon as V8 garbage collects us. | 93 // will be destroyed as soon as V8 garbage collects us. |
| 89 if (!element.pluginContainer()) { | 94 if (!element.pluginContainer()) { |
| 90 plugin_->destroy(); | 95 plugin_->destroy(); |
| 91 return; | 96 return; |
| 92 } | 97 } |
| 93 | 98 |
| 94 // During initialization, the new plug-in might have replaced itself in turn | 99 // During initialization, the new plug-in might have replaced itself in turn |
| 95 // with another plug-in. Make sure not to use the passed in |new_plugin| after | 100 // with another plug-in. Make sure not to use the passed in |new_plugin| after |
| 96 // this point. | 101 // this point. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 identifier_ = identifier; | 248 identifier_ = identifier; |
| 244 } | 249 } |
| 245 | 250 |
| 246 blink::WebFrame* PluginPlaceholder::GetFrame() { return frame_; } | 251 blink::WebFrame* PluginPlaceholder::GetFrame() { return frame_; } |
| 247 | 252 |
| 248 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { | 253 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { |
| 249 return plugin_params_; | 254 return plugin_params_; |
| 250 } | 255 } |
| 251 | 256 |
| 252 } // namespace plugins | 257 } // namespace plugins |
| OLD | NEW |