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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 allocate_instance_id_sent_(false), | 99 allocate_instance_id_sent_(false), |
100 browser_plugin_manager_(render_view->browser_plugin_manager()), | 100 browser_plugin_manager_(render_view->browser_plugin_manager()), |
101 current_nav_entry_index_(0), | 101 current_nav_entry_index_(0), |
102 nav_entry_count_(0), | 102 nav_entry_count_(0), |
103 compositing_enabled_(false), | 103 compositing_enabled_(false), |
104 ALLOW_THIS_IN_INITIALIZER_LIST( | 104 ALLOW_THIS_IN_INITIALIZER_LIST( |
105 weak_ptr_factory_(this)) { | 105 weak_ptr_factory_(this)) { |
106 } | 106 } |
107 | 107 |
108 BrowserPlugin::~BrowserPlugin() { | 108 BrowserPlugin::~BrowserPlugin() { |
109 // Will be a no-op if we are not currently locked to. | |
110 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(this); | |
111 | |
112 // If the BrowserPlugin has never navigated then the browser process and | 109 // If the BrowserPlugin has never navigated then the browser process and |
113 // BrowserPluginManager don't know about it and so there is nothing to do | 110 // BrowserPluginManager don't know about it and so there is nothing to do |
114 // here. | 111 // here. |
115 if (!navigate_src_sent_) | 112 if (!navigate_src_sent_) |
116 return; | 113 return; |
117 browser_plugin_manager()->RemoveBrowserPlugin(instance_id_); | 114 browser_plugin_manager()->RemoveBrowserPlugin(instance_id_); |
118 browser_plugin_manager()->Send( | 115 browser_plugin_manager()->Send( |
119 new BrowserPluginHostMsg_PluginDestroyed(render_view_routing_id_, | 116 new BrowserPluginHostMsg_PluginDestroyed(render_view_routing_id_, |
120 instance_id_)); | 117 instance_id_)); |
121 } | 118 } |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 } | 1070 } |
1074 compositing_helper_->EnableCompositing(enable); | 1071 compositing_helper_->EnableCompositing(enable); |
1075 } | 1072 } |
1076 | 1073 |
1077 void BrowserPlugin::destroy() { | 1074 void BrowserPlugin::destroy() { |
1078 // The BrowserPlugin's WebPluginContainer is deleted immediately after this | 1075 // The BrowserPlugin's WebPluginContainer is deleted immediately after this |
1079 // call returns, so let's not keep a reference to it around. | 1076 // call returns, so let's not keep a reference to it around. |
1080 container_ = NULL; | 1077 container_ = NULL; |
1081 if (compositing_helper_) | 1078 if (compositing_helper_) |
1082 compositing_helper_->OnContainerDestroy(); | 1079 compositing_helper_->OnContainerDestroy(); |
| 1080 // Will be a no-op if the mouse is not currently locked. |
| 1081 if (render_view_) |
| 1082 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(this); |
1083 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1083 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
1084 } | 1084 } |
1085 | 1085 |
1086 NPObject* BrowserPlugin::scriptableObject() { | 1086 NPObject* BrowserPlugin::scriptableObject() { |
1087 if (!bindings_.get()) | 1087 if (!bindings_.get()) |
1088 return NULL; | 1088 return NULL; |
1089 | 1089 |
1090 NPObject* browser_plugin_np_object(bindings_->np_object()); | 1090 NPObject* browser_plugin_np_object(bindings_->np_object()); |
1091 // The object is expected to be retained before it is returned. | 1091 // The object is expected to be retained before it is returned. |
1092 WebKit::WebBindings::retainObject(browser_plugin_np_object); | 1092 WebKit::WebBindings::retainObject(browser_plugin_np_object); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 const WebKit::WebMouseEvent& event) { | 1378 const WebKit::WebMouseEvent& event) { |
1379 browser_plugin_manager()->Send( | 1379 browser_plugin_manager()->Send( |
1380 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 1380 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
1381 instance_id_, | 1381 instance_id_, |
1382 plugin_rect_, | 1382 plugin_rect_, |
1383 &event)); | 1383 &event)); |
1384 return true; | 1384 return true; |
1385 } | 1385 } |
1386 | 1386 |
1387 } // namespace content | 1387 } // namespace content |
OLD | NEW |