Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 create_guest_params.src = GetSrcAttribute(); 427 create_guest_params.src = GetSrcAttribute();
428 GetDamageBufferWithSizeParams(&create_guest_params.auto_size_params, 428 GetDamageBufferWithSizeParams(&create_guest_params.auto_size_params,
429 &create_guest_params.resize_guest_params); 429 &create_guest_params.resize_guest_params);
430 430
431 browser_plugin_manager()->Send( 431 browser_plugin_manager()->Send(
432 new BrowserPluginHostMsg_Attach(render_view_routing_id_, 432 new BrowserPluginHostMsg_Attach(render_view_routing_id_,
433 guest_instance_id_, create_guest_params)); 433 guest_instance_id_, create_guest_params));
434 } 434 }
435 435
436 void BrowserPlugin::DidCommitCompositorFrame() { 436 void BrowserPlugin::DidCommitCompositorFrame() {
437 if (compositing_helper_) 437 if (compositing_helper_.get())
438 compositing_helper_->DidCommitCompositorFrame(); 438 compositing_helper_->DidCommitCompositorFrame();
439 } 439 }
440 440
441 void BrowserPlugin::OnAddMessageToConsole( 441 void BrowserPlugin::OnAddMessageToConsole(
442 int guest_instance_id, const base::DictionaryValue& message_info) { 442 int guest_instance_id, const base::DictionaryValue& message_info) {
443 std::map<std::string, base::Value*> props; 443 std::map<std::string, base::Value*> props;
444 // Fill in the info provided by the browser. 444 // Fill in the info provided by the browser.
445 for (DictionaryValue::Iterator iter(message_info); !iter.IsAtEnd(); 445 for (DictionaryValue::Iterator iter(message_info); !iter.IsAtEnd();
446 iter.Advance()) { 446 iter.Advance()) {
447 props[iter.key()] = iter.value().DeepCopy(); 447 props[iter.key()] = iter.value().DeepCopy();
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 void BrowserPlugin::EnableCompositing(bool enable) { 1174 void BrowserPlugin::EnableCompositing(bool enable) {
1175 if (compositing_enabled_ == enable) 1175 if (compositing_enabled_ == enable)
1176 return; 1176 return;
1177 1177
1178 compositing_enabled_ = enable; 1178 compositing_enabled_ = enable;
1179 if (enable) { 1179 if (enable) {
1180 // No need to keep the backing store and damage buffer around if we're now 1180 // No need to keep the backing store and damage buffer around if we're now
1181 // compositing. 1181 // compositing.
1182 backing_store_.reset(); 1182 backing_store_.reset();
1183 current_damage_buffer_.reset(); 1183 current_damage_buffer_.reset();
1184 if (!compositing_helper_) { 1184 if (!compositing_helper_.get()) {
1185 compositing_helper_ = new BrowserPluginCompositingHelper( 1185 compositing_helper_ =
1186 container_, 1186 new BrowserPluginCompositingHelper(container_,
1187 browser_plugin_manager(), 1187 browser_plugin_manager(),
1188 guest_instance_id_, 1188 guest_instance_id_,
1189 render_view_routing_id_); 1189 render_view_routing_id_);
1190 } 1190 }
1191 } else { 1191 } else {
1192 // We're switching back to the software path. We create a new damage 1192 // We're switching back to the software path. We create a new damage
1193 // buffer that can accommodate the current size of the container. 1193 // buffer that can accommodate the current size of the container.
1194 BrowserPluginHostMsg_ResizeGuest_Params params; 1194 BrowserPluginHostMsg_ResizeGuest_Params params;
1195 PopulateResizeGuestParameters(&params, plugin_rect()); 1195 PopulateResizeGuestParameters(&params, plugin_rect());
1196 // Request a full repaint from the guest even if its size is not actually 1196 // Request a full repaint from the guest even if its size is not actually
1197 // changing. 1197 // changing.
1198 params.repaint = true; 1198 params.repaint = true;
1199 resize_ack_received_ = false; 1199 resize_ack_received_ = false;
1200 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest( 1200 browser_plugin_manager()->Send(new BrowserPluginHostMsg_ResizeGuest(
1201 render_view_routing_id_, 1201 render_view_routing_id_,
1202 guest_instance_id_, 1202 guest_instance_id_,
1203 params)); 1203 params));
1204 } 1204 }
1205 compositing_helper_->EnableCompositing(enable); 1205 compositing_helper_->EnableCompositing(enable);
1206 } 1206 }
1207 1207
1208 void BrowserPlugin::destroy() { 1208 void BrowserPlugin::destroy() {
1209 // If the plugin was initialized then it has a valid |npp_| identifier, and 1209 // If the plugin was initialized then it has a valid |npp_| identifier, and
1210 // the |container_| must clear references to the plugin's script objects. 1210 // the |container_| must clear references to the plugin's script objects.
1211 DCHECK(!npp_ || container_); 1211 DCHECK(!npp_ || container_);
1212 if (container_) 1212 if (container_)
1213 container_->clearScriptObjects(); 1213 container_->clearScriptObjects();
1214 1214
1215 // The BrowserPlugin's WebPluginContainer is deleted immediately after this 1215 // The BrowserPlugin's WebPluginContainer is deleted immediately after this
1216 // call returns, so let's not keep a reference to it around. 1216 // call returns, so let's not keep a reference to it around.
1217 g_plugin_container_map.Get().erase(container_); 1217 g_plugin_container_map.Get().erase(container_);
1218 container_ = NULL; 1218 container_ = NULL;
1219 if (compositing_helper_) 1219 if (compositing_helper_.get())
1220 compositing_helper_->OnContainerDestroy(); 1220 compositing_helper_->OnContainerDestroy();
1221 // Will be a no-op if the mouse is not currently locked. 1221 // Will be a no-op if the mouse is not currently locked.
1222 if (render_view_) 1222 if (render_view_)
1223 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(this); 1223 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(this);
1224 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1224 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1225 } 1225 }
1226 1226
1227 NPObject* BrowserPlugin::scriptableObject() { 1227 NPObject* BrowserPlugin::scriptableObject() {
1228 if (!bindings_) 1228 if (!bindings_)
1229 return NULL; 1229 return NULL;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 } 1478 }
1479 1479
1480 void BrowserPlugin::updateVisibility(bool visible) { 1480 void BrowserPlugin::updateVisibility(bool visible) {
1481 if (visible_ == visible) 1481 if (visible_ == visible)
1482 return; 1482 return;
1483 1483
1484 visible_ = visible; 1484 visible_ = visible;
1485 if (!HasGuestInstanceID()) 1485 if (!HasGuestInstanceID())
1486 return; 1486 return;
1487 1487
1488 if (compositing_helper_) 1488 if (compositing_helper_.get())
1489 compositing_helper_->UpdateVisibility(visible); 1489 compositing_helper_->UpdateVisibility(visible);
1490 1490
1491 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility( 1491 browser_plugin_manager()->Send(new BrowserPluginHostMsg_SetVisibility(
1492 render_view_routing_id_, 1492 render_view_routing_id_,
1493 guest_instance_id_, 1493 guest_instance_id_,
1494 visible)); 1494 visible));
1495 } 1495 }
1496 1496
1497 bool BrowserPlugin::acceptsInputEvents() { 1497 bool BrowserPlugin::acceptsInputEvents() {
1498 return true; 1498 return true;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 const WebKit::WebMouseEvent& event) { 1617 const WebKit::WebMouseEvent& event) {
1618 browser_plugin_manager()->Send( 1618 browser_plugin_manager()->Send(
1619 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 1619 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
1620 guest_instance_id_, 1620 guest_instance_id_,
1621 plugin_rect_, 1621 plugin_rect_,
1622 &event)); 1622 &event));
1623 return true; 1623 return true;
1624 } 1624 }
1625 1625
1626 } // namespace content 1626 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.h ('k') | content/renderer/browser_plugin/browser_plugin_compositing_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698