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

Side by Side Diff: components/guest_view/browser/guest_view_base.cc

Issue 1641563002: Remove linked_ptr usage in //base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase, really Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/guest_view/browser/guest_view_base.h" 5 #include "components/guest_view/browser/guest_view_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 const gfx::Size& new_size) { 259 const gfx::Size& new_size) {
260 if (new_size == old_size) 260 if (new_size == old_size)
261 return; 261 return;
262 262
263 // Dispatch the onResize event. 263 // Dispatch the onResize event.
264 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 264 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
265 args->SetInteger(kOldWidth, old_size.width()); 265 args->SetInteger(kOldWidth, old_size.width());
266 args->SetInteger(kOldHeight, old_size.height()); 266 args->SetInteger(kOldHeight, old_size.height());
267 args->SetInteger(kNewWidth, new_size.width()); 267 args->SetInteger(kNewWidth, new_size.width());
268 args->SetInteger(kNewHeight, new_size.height()); 268 args->SetInteger(kNewHeight, new_size.height());
269 DispatchEventToGuestProxy(new GuestViewEvent(kEventResize, std::move(args))); 269 DispatchEventToGuestProxy(
270 make_scoped_ptr(new GuestViewEvent(kEventResize, std::move(args))));
270 } 271 }
271 272
272 gfx::Size GuestViewBase::GetDefaultSize() const { 273 gfx::Size GuestViewBase::GetDefaultSize() const {
273 if (is_full_page_plugin()) { 274 if (is_full_page_plugin()) {
274 // Full page plugins default to the size of the owner's viewport. 275 // Full page plugins default to the size of the owner's viewport.
275 return owner_web_contents() 276 return owner_web_contents()
276 ->GetRenderWidgetHostView() 277 ->GetRenderWidgetHostView()
277 ->GetVisibleViewportSize(); 278 ->GetVisibleViewportSize();
278 } else { 279 } else {
279 return gfx::Size(kDefaultWidth, kDefaultHeight); 280 return gfx::Size(kDefaultWidth, kDefaultHeight);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 guest_zoom_controller->SetZoomLevel(data.new_zoom_level); 746 guest_zoom_controller->SetZoomLevel(data.new_zoom_level);
746 return; 747 return;
747 } 748 }
748 749
749 if (data.web_contents == web_contents()) { 750 if (data.web_contents == web_contents()) {
750 // The guest's zoom level has changed. 751 // The guest's zoom level has changed.
751 GuestZoomChanged(data.old_zoom_level, data.new_zoom_level); 752 GuestZoomChanged(data.old_zoom_level, data.new_zoom_level);
752 } 753 }
753 } 754 }
754 755
755 void GuestViewBase::DispatchEventToGuestProxy(GuestViewEvent* event) { 756 void GuestViewBase::DispatchEventToGuestProxy(
757 scoped_ptr<GuestViewEvent> event) {
756 event->Dispatch(this, guest_instance_id_); 758 event->Dispatch(this, guest_instance_id_);
757 } 759 }
758 760
759 void GuestViewBase::DispatchEventToView(GuestViewEvent* event) { 761 void GuestViewBase::DispatchEventToView(scoped_ptr<GuestViewEvent> event) {
760 if (!attached() && 762 if (!attached() &&
761 (!CanRunInDetachedState() || !can_owner_receive_events())) { 763 (!CanRunInDetachedState() || !can_owner_receive_events())) {
762 pending_events_.push_back(linked_ptr<GuestViewEvent>(event)); 764 pending_events_.push_back(std::move(event));
763 return; 765 return;
764 } 766 }
765 767
766 event->Dispatch(this, view_instance_id_); 768 event->Dispatch(this, view_instance_id_);
767 } 769 }
768 770
769 void GuestViewBase::SendQueuedEvents() { 771 void GuestViewBase::SendQueuedEvents() {
770 if (!attached()) 772 if (!attached())
771 return; 773 return;
772 while (!pending_events_.empty()) { 774 while (!pending_events_.empty()) {
773 linked_ptr<GuestViewEvent> event_ptr = pending_events_.front(); 775 scoped_ptr<GuestViewEvent> event_ptr = std::move(pending_events_.front());
774 pending_events_.pop_front(); 776 pending_events_.pop_front();
775 event_ptr.release()->Dispatch(this, view_instance_id_); 777 event_ptr->Dispatch(this, view_instance_id_);
776 } 778 }
777 } 779 }
778 780
779 void GuestViewBase::CompleteInit( 781 void GuestViewBase::CompleteInit(
780 scoped_ptr<base::DictionaryValue> create_params, 782 scoped_ptr<base::DictionaryValue> create_params,
781 const WebContentsCreatedCallback& callback, 783 const WebContentsCreatedCallback& callback,
782 WebContents* guest_web_contents) { 784 WebContents* guest_web_contents) {
783 if (!guest_web_contents) { 785 if (!guest_web_contents) {
784 // The derived class did not create a WebContents so this class serves no 786 // The derived class did not create a WebContents so this class serves no
785 // purpose. Let's self-destruct. 787 // purpose. Let's self-destruct.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 890
889 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size, 891 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size,
890 bool due_to_auto_resize) { 892 bool due_to_auto_resize) {
891 if (due_to_auto_resize) 893 if (due_to_auto_resize)
892 GuestSizeChangedDueToAutoSize(guest_size_, new_size); 894 GuestSizeChangedDueToAutoSize(guest_size_, new_size);
893 DispatchOnResizeEvent(guest_size_, new_size); 895 DispatchOnResizeEvent(guest_size_, new_size);
894 guest_size_ = new_size; 896 guest_size_ = new_size;
895 } 897 }
896 898
897 } // namespace guest_view 899 } // namespace guest_view
OLDNEW
« no previous file with comments | « components/guest_view/browser/guest_view_base.h ('k') | components/guest_view/browser/guest_view_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698