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

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

Issue 954923005: Make command-zero reset page scale in addition to zoom level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again again Created 5 years, 9 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 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 content::RecordAction(UserMetricsAction("ZoomNormal")); 87 content::RecordAction(UserMetricsAction("ZoomNormal"));
87 return; 88 return;
88 } 89 }
89 90
90 // 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
91 // the default level added if necessary. 92 // the default level added if necessary.
92 std::vector<double> zoom_levels = PresetZoomLevels(default_zoom_level); 93 std::vector<double> zoom_levels = PresetZoomLevels(default_zoom_level);
93 94
94 if (zoom == content::PAGE_ZOOM_OUT) { 95 if (zoom == content::PAGE_ZOOM_OUT) {
95 // 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
118 zoom_controller->SetZoomLevel(zoom_level); 119 zoom_controller->SetZoomLevel(zoom_level);
119 content::RecordAction(UserMetricsAction("ZoomPlus")); 120 content::RecordAction(UserMetricsAction("ZoomPlus"));
120 return; 121 return;
121 } 122 }
122 } 123 }
123 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum")); 124 content::RecordAction(UserMetricsAction("ZoomPlus_AtMaximum"));
124 } 125 }
125 } 126 }
126 127
127 } // namespace ui_zoom 128 } // namespace ui_zoom
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/content_settings_handler.cc ('k') | components/ui/zoom/zoom_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698