| OLD | NEW |
| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 264 std::unique_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( | 269 DispatchEventToGuestProxy( |
| 270 base::WrapUnique(new GuestViewEvent(kEventResize, std::move(args)))); | 270 base::MakeUnique<GuestViewEvent>(kEventResize, std::move(args))); |
| 271 } | 271 } |
| 272 | 272 |
| 273 gfx::Size GuestViewBase::GetDefaultSize() const { | 273 gfx::Size GuestViewBase::GetDefaultSize() const { |
| 274 if (is_full_page_plugin()) { | 274 if (is_full_page_plugin()) { |
| 275 // 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. |
| 276 return owner_web_contents() | 276 return owner_web_contents() |
| 277 ->GetRenderWidgetHostView() | 277 ->GetRenderWidgetHostView() |
| 278 ->GetVisibleViewportSize(); | 278 ->GetVisibleViewportSize(); |
| 279 } else { | 279 } else { |
| 280 return gfx::Size(kDefaultWidth, kDefaultHeight); | 280 return gfx::Size(kDefaultWidth, kDefaultHeight); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 885 |
| 886 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size, | 886 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size, |
| 887 bool due_to_auto_resize) { | 887 bool due_to_auto_resize) { |
| 888 if (due_to_auto_resize) | 888 if (due_to_auto_resize) |
| 889 GuestSizeChangedDueToAutoSize(guest_size_, new_size); | 889 GuestSizeChangedDueToAutoSize(guest_size_, new_size); |
| 890 DispatchOnResizeEvent(guest_size_, new_size); | 890 DispatchOnResizeEvent(guest_size_, new_size); |
| 891 guest_size_ = new_size; | 891 guest_size_ = new_size; |
| 892 } | 892 } |
| 893 | 893 |
| 894 } // namespace guest_view | 894 } // namespace guest_view |
| OLD | NEW |