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

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: Modified zoom_controller_unittests to pass try jobs on bots. Created 6 years, 4 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // See http://crbug.com/6380. 571 // See http://crbug.com/6380.
572 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); 572 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus();
573 } 573 }
574 } 574 }
575 575
576 void CloseTab(Browser* browser) { 576 void CloseTab(Browser* browser) {
577 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); 577 content::RecordAction(UserMetricsAction("CloseTab_Accelerator"));
578 browser->tab_strip_model()->CloseSelectedTabs(); 578 browser->tab_strip_model()->CloseSelectedTabs();
579 } 579 }
580 580
581 bool CanZoomIn(content::WebContents* contents) {
582 bool dummy = false;
583 return contents->GetZoomPercent(&dummy, &dummy) !=
584 contents->GetMaximumZoomPercent() + 1;
585 }
586
587 bool CanZoomOut(content::WebContents* contents) {
588 bool dummy = false;
589 return contents->GetZoomPercent(&dummy, &dummy) !=
590 contents->GetMinimumZoomPercent();
591 }
592
593 bool ActualSize(content::WebContents* contents) {
594 bool dummy = false;
595 return contents->GetZoomPercent(&dummy, &dummy) != 100.0f;
596 }
597
581 void RestoreTab(Browser* browser) { 598 void RestoreTab(Browser* browser) {
582 content::RecordAction(UserMetricsAction("RestoreTab")); 599 content::RecordAction(UserMetricsAction("RestoreTab"));
583 TabRestoreService* service = 600 TabRestoreService* service =
584 TabRestoreServiceFactory::GetForProfile(browser->profile()); 601 TabRestoreServiceFactory::GetForProfile(browser->profile());
585 if (service) 602 if (service)
586 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(), 603 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(),
587 browser->host_desktop_type()); 604 browser->host_desktop_type());
588 } 605 }
589 606
590 TabStripModelDelegate::RestoreTabType GetRestoreTabType( 607 TabStripModelDelegate::RestoreTabType GetRestoreTabType(
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 browser->profile(), 1281 browser->profile(),
1265 browser->host_desktop_type())); 1282 browser->host_desktop_type()));
1266 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1283 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1267 1284
1268 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1285 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1269 contents->GetRenderViewHost()->SyncRendererPrefs(); 1286 contents->GetRenderViewHost()->SyncRendererPrefs();
1270 app_browser->window()->Show(); 1287 app_browser->window()->Show();
1271 } 1288 }
1272 1289
1273 } // namespace chrome 1290 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698