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

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: Cross-platform unittest for Issue 32919 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
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // See http://crbug.com/6380. 567 // See http://crbug.com/6380.
568 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); 568 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus();
569 } 569 }
570 } 570 }
571 571
572 void CloseTab(Browser* browser) { 572 void CloseTab(Browser* browser) {
573 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); 573 content::RecordAction(UserMetricsAction("CloseTab_Accelerator"));
574 browser->tab_strip_model()->CloseSelectedTabs(); 574 browser->tab_strip_model()->CloseSelectedTabs();
575 } 575 }
576 576
577 bool CanZoomIn(content::WebContents* contents) {
578 bool dummy = false;
579 return contents->GetZoomPercent(&dummy, &dummy) !=
580 contents->GetMaximumZoomPercent() + 1;
Alexei Svitkine (slow) 2014/06/16 17:41:46 Nit: indent is wrong, same below.
581 }
582
583 bool CanZoomOut(content::WebContents* contents) {
584 bool dummy = false;
585 return contents->GetZoomPercent(&dummy, &dummy) !=
586 contents->GetMinimumZoomPercent();
587 }
588
589 bool ActualSize(content::WebContents* contents) {
590 bool dummy = false;
591 return contents->GetZoomPercent(&dummy, &dummy) != 100.0f;
592 }
593
577 void RestoreTab(Browser* browser) { 594 void RestoreTab(Browser* browser) {
578 content::RecordAction(UserMetricsAction("RestoreTab")); 595 content::RecordAction(UserMetricsAction("RestoreTab"));
579 TabRestoreService* service = 596 TabRestoreService* service =
580 TabRestoreServiceFactory::GetForProfile(browser->profile()); 597 TabRestoreServiceFactory::GetForProfile(browser->profile());
581 if (service) 598 if (service)
582 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(), 599 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(),
583 browser->host_desktop_type()); 600 browser->host_desktop_type());
584 } 601 }
585 602
586 TabStripModelDelegate::RestoreTabType GetRestoreTabType( 603 TabStripModelDelegate::RestoreTabType GetRestoreTabType(
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 browser->profile(), 1277 browser->profile(),
1261 browser->host_desktop_type())); 1278 browser->host_desktop_type()));
1262 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1279 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1263 1280
1264 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1281 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1265 contents->GetRenderViewHost()->SyncRendererPrefs(); 1282 contents->GetRenderViewHost()->SyncRendererPrefs();
1266 app_browser->window()->Show(); 1283 app_browser->window()->Show();
1267 } 1284 }
1268 1285
1269 } // namespace chrome 1286 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698