| Index: chrome/browser/ui/browser_commands.cc
|
| diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
|
| index e2bd5ce56ce78e40c54b0a6a1fc5eaca0b3e44b7..ff0d782850367031ebed78031a8bab2d075c7393 100644
|
| --- a/chrome/browser/ui/browser_commands.cc
|
| +++ b/chrome/browser/ui/browser_commands.cc
|
| @@ -574,17 +574,25 @@ void CloseTab(Browser* browser) {
|
| browser->tab_strip_model()->CloseSelectedTabs();
|
| }
|
|
|
| -bool CanZoomIn(content::WebContents* contents) {
|
| - ui_zoom::ZoomController* zoom_controller =
|
| +int GetZoomPercent(content::WebContents* contents) {
|
| + int zoom = 100;
|
| + if (contents) {
|
| + auto zoom_controller =
|
| ui_zoom::ZoomController::FromWebContents(contents);
|
| - return zoom_controller->GetZoomPercent() != contents->GetMaximumZoomPercent();
|
| + if (zoom_controller)
|
| + zoom = zoom_controller->GetZoomPercent();
|
| + }
|
| + return zoom;
|
| +}
|
| +
|
| +bool CanZoomIn(content::WebContents* contents) {
|
| + return contents && !contents->IsCrashed() &&
|
| + GetZoomPercent(contents) != 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() &&
|
| + GetZoomPercent(contents) != contents->GetMinimumZoomPercent();
|
| }
|
|
|
| bool CanResetZoom(content::WebContents* contents) {
|
|
|