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

Unified Diff: chrome/browser/ui/browser_commands.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: Rebase Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index c599839c5d205dab81488ef02ac3012f07c0f24b..c0d4f5eee017c4dfb3b139fbcccadb7db163f934 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -579,16 +579,15 @@ void CloseTab(Browser* browser) {
}
bool CanZoomIn(content::WebContents* contents) {
- ui_zoom::ZoomController* zoom_controller =
- ui_zoom::ZoomController::FromWebContents(contents);
- return zoom_controller->GetZoomPercent() != contents->GetMaximumZoomPercent();
+ return contents && !contents->IsCrashed() &&
+ ui_zoom::ZoomController::FromWebContents(contents)->GetZoomPercent() !=
+ contents->GetMaximumZoomPercent();
}
bool CanZoomOut(content::WebContents* contents) {
- ui_zoom::ZoomController* zoom_controller =
- ui_zoom::ZoomController::FromWebContents(contents);
- return zoom_controller->GetZoomPercent() !=
- contents->GetMinimumZoomPercent();
+ return contents && !contents->IsCrashed() &&
+ ui_zoom::ZoomController::FromWebContents(contents)->GetZoomPercent() !=
+ contents->GetMinimumZoomPercent();
}
bool CanResetZoom(content::WebContents* contents) {
« no previous file with comments | « no previous file | chrome/browser/ui/browser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698