| 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 "extensions/browser/guest_view/guest_view_base.h" | 5 #include "extensions/browser/guest_view/guest_view_base.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "components/ui/zoom/page_zoom.h" | 9 #include "components/ui/zoom/page_zoom.h" |
| 10 #include "components/ui/zoom/zoom_controller.h" | 10 #include "components/ui/zoom/zoom_controller.h" |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 if (!zoom_controller) | 778 if (!zoom_controller) |
| 779 return 1.0; | 779 return 1.0; |
| 780 | 780 |
| 781 double zoom_factor = | 781 double zoom_factor = |
| 782 content::ZoomLevelToZoomFactor(zoom_controller->GetZoomLevel()); | 782 content::ZoomLevelToZoomFactor(zoom_controller->GetZoomLevel()); |
| 783 return zoom_factor; | 783 return zoom_factor; |
| 784 } | 784 } |
| 785 | 785 |
| 786 void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) { | 786 void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) { |
| 787 // Read the autosize parameters passed in from the embedder. | 787 // Read the autosize parameters passed in from the embedder. |
| 788 bool auto_size_enabled = false; | 788 bool auto_size_enabled = auto_size_enabled_; |
| 789 params.GetBoolean(guestview::kAttributeAutoSize, &auto_size_enabled); | 789 params.GetBoolean(guestview::kAttributeAutoSize, &auto_size_enabled); |
| 790 | 790 |
| 791 int max_height = 0; | 791 int max_height = max_auto_size_.height(); |
| 792 int max_width = 0; | 792 int max_width = max_auto_size_.width(); |
| 793 params.GetInteger(guestview::kAttributeMaxHeight, &max_height); | 793 params.GetInteger(guestview::kAttributeMaxHeight, &max_height); |
| 794 params.GetInteger(guestview::kAttributeMaxWidth, &max_width); | 794 params.GetInteger(guestview::kAttributeMaxWidth, &max_width); |
| 795 | 795 |
| 796 int min_height = 0; | 796 int min_height = min_auto_size_.height(); |
| 797 int min_width = 0; | 797 int min_width = min_auto_size_.width(); |
| 798 params.GetInteger(guestview::kAttributeMinHeight, &min_height); | 798 params.GetInteger(guestview::kAttributeMinHeight, &min_height); |
| 799 params.GetInteger(guestview::kAttributeMinWidth, &min_width); | 799 params.GetInteger(guestview::kAttributeMinWidth, &min_width); |
| 800 | 800 |
| 801 int normal_height = 0; | 801 int normal_height = normal_size_.height(); |
| 802 int normal_width = 0; | 802 int normal_width = normal_size_.width(); |
| 803 if (is_full_page_plugin()) { | 803 if (is_full_page_plugin()) { |
| 804 // The initial size of a full page plugin should be set to fill the | 804 // The initial size of a full page plugin should be set to fill the |
| 805 // owner's visible viewport. | 805 // owner's visible viewport. |
| 806 auto owner_size = owner_web_contents()->GetRenderWidgetHostView()-> | 806 auto owner_size = owner_web_contents()->GetRenderWidgetHostView()-> |
| 807 GetVisibleViewportSize(); | 807 GetVisibleViewportSize(); |
| 808 normal_height = owner_size.height(); | 808 normal_height = owner_size.height(); |
| 809 normal_width = owner_size.width(); | 809 normal_width = owner_size.width(); |
| 810 } else { | 810 } else { |
| 811 // Set the normal size to the element size so that the guestview will fit | 811 // Set the normal size to the element size so that the guestview will fit |
| 812 // the element initially if autosize is disabled. | 812 // the element initially if autosize is disabled. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 void GuestViewBase::RegisterGuestViewTypes() { | 883 void GuestViewBase::RegisterGuestViewTypes() { |
| 884 AppViewGuest::Register(); | 884 AppViewGuest::Register(); |
| 885 ExtensionOptionsGuest::Register(); | 885 ExtensionOptionsGuest::Register(); |
| 886 ExtensionViewGuest::Register(); | 886 ExtensionViewGuest::Register(); |
| 887 MimeHandlerViewGuest::Register(); | 887 MimeHandlerViewGuest::Register(); |
| 888 SurfaceWorkerGuest::Register(); | 888 SurfaceWorkerGuest::Register(); |
| 889 WebViewGuest::Register(); | 889 WebViewGuest::Register(); |
| 890 } | 890 } |
| 891 | 891 |
| 892 } // namespace extensions | 892 } // namespace extensions |
| OLD | NEW |