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

Unified 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: Moved the unit tests to browser_commands_unittest since its independent of ZoomController 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 788e76ce5225aa0b9eeaf9c42b343ea0a71ccc0b..71b810be9b69457ec122d5acff25892c47b652b2 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -53,6 +53,7 @@
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
+#include "chrome/browser/ui/zoom/zoom_controller.h"
#include "chrome/browser/upgrade_detector.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
@@ -585,6 +586,23 @@ void CloseTab(Browser* browser) {
browser->tab_strip_model()->CloseSelectedTabs();
}
+bool CanZoomIn(content::WebContents* contents) {
+ ZoomController* zoom_controller = ZoomController::FromWebContents(contents);
+ return zoom_controller->GetZoomPercent() !=
+ contents->GetMaximumZoomPercent() + 1;
+}
+
+bool CanZoomOut(content::WebContents* contents) {
+ ZoomController* zoom_controller = ZoomController::FromWebContents(contents);
+ return zoom_controller->GetZoomPercent() !=
+ contents->GetMinimumZoomPercent();
+}
+
+bool ActualSize(content::WebContents* contents) {
+ ZoomController* zoom_controller = ZoomController::FromWebContents(contents);
+ return zoom_controller->GetZoomPercent() != 100.0f;
+}
+
void RestoreTab(Browser* browser) {
content::RecordAction(UserMetricsAction("RestoreTab"));
TabRestoreService* service =

Powered by Google App Engine
This is Rietveld 408576698