| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, | 262 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, |
| 263 guest_instance_id_, | 263 guest_instance_id_, |
| 264 auto_size_params, | 264 auto_size_params, |
| 265 resize_guest_params)); | 265 resize_guest_params)); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void BrowserPlugin::Attach(int guest_instance_id, | 268 void BrowserPlugin::Attach(int guest_instance_id, |
| 269 scoped_ptr<base::DictionaryValue> extra_params) { | 269 scoped_ptr<base::DictionaryValue> extra_params) { |
| 270 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); | 270 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); |
| 271 | 271 |
| 272 // If this BrowserPlugin is already attached to a guest, then do nothing. | 272 // If this BrowserPlugin is already attached to a guest, then kill the guest. |
| 273 if (HasGuestInstanceID()) | 273 if (HasGuestInstanceID()) { |
| 274 return; | 274 if (guest_instance_id == guest_instance_id_) |
| 275 return; |
| 276 guest_crashed_ = false; |
| 277 EnableCompositing(false); |
| 278 if (compositing_helper_) { |
| 279 compositing_helper_->OnContainerDestroy(); |
| 280 compositing_helper_ = NULL; |
| 281 } |
| 282 browser_plugin_manager()->RemoveBrowserPlugin(guest_instance_id_); |
| 283 browser_plugin_manager()->Send(new BrowserPluginHostMsg_PluginDestroyed( |
| 284 render_view_routing_id_, guest_instance_id_)); |
| 285 } |
| 275 | 286 |
| 276 // This API may be called directly without setting the src attribute. | 287 // This API may be called directly without setting the src attribute. |
| 277 // In that case, we need to make sure we don't allocate another instance ID. | 288 // In that case, we need to make sure we don't allocate another instance ID. |
| 278 guest_instance_id_ = guest_instance_id; | 289 guest_instance_id_ = guest_instance_id; |
| 279 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); | 290 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); |
| 280 | 291 |
| 281 BrowserPluginHostMsg_Attach_Params attach_params; | 292 BrowserPluginHostMsg_Attach_Params attach_params; |
| 282 attach_params.focused = ShouldGuestBeFocused(); | 293 attach_params.focused = ShouldGuestBeFocused(); |
| 283 attach_params.visible = visible_; | 294 attach_params.visible = visible_; |
| 284 attach_params.opaque = !GetAllowTransparencyAttribute(); | 295 attach_params.opaque = !GetAllowTransparencyAttribute(); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 const blink::WebMouseEvent& event) { | 964 const blink::WebMouseEvent& event) { |
| 954 browser_plugin_manager()->Send( | 965 browser_plugin_manager()->Send( |
| 955 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 966 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
| 956 guest_instance_id_, | 967 guest_instance_id_, |
| 957 plugin_rect_, | 968 plugin_rect_, |
| 958 &event)); | 969 &event)); |
| 959 return true; | 970 return true; |
| 960 } | 971 } |
| 961 | 972 |
| 962 } // namespace content | 973 } // namespace content |
| OLD | NEW |