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

Side by Side Diff: components/ui/zoom/page_zoom.cc

Issue 1408393003: Propagate pageScaleFactor to GuestViews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant initialization of AwLayoutSizer's page scale factor in tests Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/zoom/page_zoom.h" 5 #include "components/ui/zoom/page_zoom.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ui_zoom::ZoomController* zoom_controller = 76 ui_zoom::ZoomController* zoom_controller =
77 ui_zoom::ZoomController::FromWebContents(web_contents); 77 ui_zoom::ZoomController::FromWebContents(web_contents);
78 if (!zoom_controller) 78 if (!zoom_controller)
79 return; 79 return;
80 80
81 double current_zoom_level = zoom_controller->GetZoomLevel(); 81 double current_zoom_level = zoom_controller->GetZoomLevel();
82 double default_zoom_level = zoom_controller->GetDefaultZoomLevel(); 82 double default_zoom_level = zoom_controller->GetDefaultZoomLevel();
83 83
84 if (zoom == content::PAGE_ZOOM_RESET) { 84 if (zoom == content::PAGE_ZOOM_RESET) {
85 zoom_controller->SetZoomLevel(default_zoom_level); 85 zoom_controller->SetZoomLevel(default_zoom_level);
86 web_contents->ResetPageScale(); 86 web_contents->SetPageScale(1.f);
87 content::RecordAction(UserMetricsAction("ZoomNormal")); 87 content::RecordAction(UserMetricsAction("ZoomNormal"));
88 return; 88 return;
89 } 89 }
90 90
91 // Generate a vector of zoom levels from an array of known presets along with 91 // Generate a vector of zoom levels from an array of known presets along with
92 // the default level added if necessary. 92 // the default level added if necessary.
93 std::vector<double> zoom_levels = PresetZoomLevels(default_zoom_level); 93 std::vector<double> zoom_levels = PresetZoomLevels(default_zoom_level);
94 94
95 if (zoom == content::PAGE_ZOOM_OUT) { 95 if (zoom == content::PAGE_ZOOM_OUT) {
96 // Iterate through the zoom levels in reverse order to find the next 96 // Iterate through the zoom levels in reverse order to find the next
(...skipping 22 matching lines...) Expand all
119 zoom_controller->SetZoomLevel(zoom_level); 119 zoom_controller->SetZoomLevel(zoom_level);
120 content::RecordAction(UserMetricsAction("ZoomPlus")); 120 content::RecordAction(UserMetricsAction("ZoomPlus"));
121 return; 121 return;
122 } 122 }
123 } 123 }
124 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum")); 124 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum"));
125 } 125 }
126 } 126 }
127 127
128 } // namespace ui_zoom 128 } // namespace ui_zoom
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698