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

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 310913002: Issue 32919: Update the Zoom NSMenuItems (Zoom-In/Zoom-out/Actual-Size) when the zoom state changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « chrome/browser/ui/browser_commands.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/ui/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 #endif 952 #endif
953 find_helper->StartFinding(find_text, forward_direction, false); 953 find_helper->StartFinding(find_text, forward_direction, false);
954 } 954 }
955 } 955 }
956 956
957 void Zoom(Browser* browser, content::PageZoom zoom) { 957 void Zoom(Browser* browser, content::PageZoom zoom) {
958 chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(), 958 chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(),
959 zoom); 959 zoom);
960 } 960 }
961 961
962 bool CanZoomIn(content::WebContents *contents) {
Ben Goodger (Google) 2014/06/05 15:45:03 nit: WebContents* contents here, and in the subseq
sarka 2014/06/05 19:55:05 Done.
sarka 2014/06/05 19:55:05 Done.
963 bool dummy = false;
964 return contents->GetZoomPercent(&dummy,
965 &dummy) == contents->GetMaximumZoomPercent() + 1 ? false : true;
Ben Goodger (Google) 2014/06/05 15:45:03 I'd write these as: return contents->GetZoomPerce
sarka 2014/06/05 19:55:05 Done.
966 }
967
968 bool CanZoomOut(content::WebContents *contents) {
969 bool dummy = false;
970 return contents->GetZoomPercent(&dummy,
971 &dummy) == contents->GetMinimumZoomPercent() ? false : true;
972 }
973
974 bool ActualSize(content::WebContents *contents) {
975 bool dummy = false;
976 return contents->GetZoomPercent(&dummy,
977 &dummy) == 100 ? false : true;
978 }
979
980
962 void FocusToolbar(Browser* browser) { 981 void FocusToolbar(Browser* browser) {
963 content::RecordAction(UserMetricsAction("FocusToolbar")); 982 content::RecordAction(UserMetricsAction("FocusToolbar"));
964 browser->window()->FocusToolbar(); 983 browser->window()->FocusToolbar();
965 } 984 }
966 985
967 void FocusLocationBar(Browser* browser) { 986 void FocusLocationBar(Browser* browser) {
968 content::RecordAction(UserMetricsAction("FocusLocation")); 987 content::RecordAction(UserMetricsAction("FocusLocation"));
969 browser->window()->SetFocusToLocationBar(true); 988 browser->window()->SetFocusToLocationBar(true);
970 } 989 }
971 990
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 browser->profile(), 1279 browser->profile(),
1261 browser->host_desktop_type())); 1280 browser->host_desktop_type()));
1262 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1281 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1263 1282
1264 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1283 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1265 contents->GetRenderViewHost()->SyncRendererPrefs(); 1284 contents->GetRenderViewHost()->SyncRendererPrefs();
1266 app_browser->window()->Show(); 1285 app_browser->window()->Show();
1267 } 1286 }
1268 1287
1269 } // namespace chrome 1288 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698