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

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: Uploading a clean patch after rebase 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // See http://crbug.com/6380. 578 // See http://crbug.com/6380.
579 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); 579 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus();
580 } 580 }
581 } 581 }
582 582
583 void CloseTab(Browser* browser) { 583 void CloseTab(Browser* browser) {
584 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); 584 content::RecordAction(UserMetricsAction("CloseTab_Accelerator"));
585 browser->tab_strip_model()->CloseSelectedTabs(); 585 browser->tab_strip_model()->CloseSelectedTabs();
586 } 586 }
587 587
588 bool CanZoomIn(content::WebContents* contents) {
589 bool dummy = false;
590 return contents->GetZoomPercent(&dummy, &dummy) !=
591 contents->GetMaximumZoomPercent() + 1;
592 }
593
594 bool CanZoomOut(content::WebContents* contents) {
595 bool dummy = false;
596 return contents->GetZoomPercent(&dummy, &dummy) !=
597 contents->GetMinimumZoomPercent();
598 }
599
600 bool ActualSize(content::WebContents* contents) {
601 bool dummy = false;
602 return contents->GetZoomPercent(&dummy, &dummy) != 100.0f;
603 }
604
588 void RestoreTab(Browser* browser) { 605 void RestoreTab(Browser* browser) {
589 content::RecordAction(UserMetricsAction("RestoreTab")); 606 content::RecordAction(UserMetricsAction("RestoreTab"));
590 TabRestoreService* service = 607 TabRestoreService* service =
591 TabRestoreServiceFactory::GetForProfile(browser->profile()); 608 TabRestoreServiceFactory::GetForProfile(browser->profile());
592 if (service) 609 if (service)
593 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(), 610 service->RestoreMostRecentEntry(browser->tab_restore_service_delegate(),
594 browser->host_desktop_type()); 611 browser->host_desktop_type());
595 } 612 }
596 613
597 TabStripModelDelegate::RestoreTabType GetRestoreTabType( 614 TabStripModelDelegate::RestoreTabType GetRestoreTabType(
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 browser->profile(), 1303 browser->profile(),
1287 browser->host_desktop_type())); 1304 browser->host_desktop_type()));
1288 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1305 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1289 1306
1290 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1307 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1291 contents->GetRenderViewHost()->SyncRendererPrefs(); 1308 contents->GetRenderViewHost()->SyncRendererPrefs();
1292 app_browser->window()->Show(); 1309 app_browser->window()->Show();
1293 } 1310 }
1294 1311
1295 } // namespace chrome 1312 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698