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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 1877373003: Disable zoom-in and zoom-out buttons in toolbar menu for a crashed page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid duplicating code Created 4 years, 8 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/views/toolbar/app_menu.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu.cc b/chrome/browser/ui/views/toolbar/app_menu.cc
index 5cee86832ae3396e4b4c76212220bbd13796c8b4..95453a3f360a34b088bb0b0c1514cc95f612192b 100644
--- a/chrome/browser/ui/views/toolbar/app_menu.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
@@ -660,19 +661,11 @@ class AppMenu::ZoomView : public AppMenuView {
void UpdateZoomControls() {
WebContents* selected_tab = GetActiveWebContents();
- int zoom = 100;
- if (selected_tab) {
- auto zoom_controller =
- ui_zoom::ZoomController::FromWebContents(selected_tab);
- if (zoom_controller)
- zoom = zoom_controller->GetZoomPercent();
- increment_button_->SetEnabled(zoom <
- selected_tab->GetMaximumZoomPercent());
- decrement_button_->SetEnabled(zoom >
- selected_tab->GetMinimumZoomPercent());
- }
- zoom_label_->SetText(
- l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, zoom));
+
+ increment_button_->SetEnabled(chrome::CanZoomIn(selected_tab));
+ decrement_button_->SetEnabled(chrome::CanZoomOut(selected_tab));
+ zoom_label_->SetText(l10n_util::GetStringFUTF16Int(
+ IDS_ZOOM_PERCENT, chrome::GetZoomPercent(selected_tab)));
zoom_label_max_width_valid_ = false;
}
« chrome/browser/ui/browser_commands.h ('K') | « chrome/browser/ui/browser_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698