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

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

Issue 1033373003: GuestView: Lazily push attributes to the browser process on attach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_sizing
Patch Set: Removed more unnecessary changes Created 5 years, 8 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
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/guest_view_attributes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/resources/guest_view/guest_view_attributes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698