Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 } | 570 } |
| 571 | 571 |
| 572 void CloseTab(Browser* browser) { | 572 void CloseTab(Browser* browser) { |
| 573 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); | 573 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); |
| 574 browser->tab_strip_model()->CloseSelectedTabs(); | 574 browser->tab_strip_model()->CloseSelectedTabs(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 bool CanZoomIn(content::WebContents* contents) { | 577 bool CanZoomIn(content::WebContents* contents) { |
| 578 ui_zoom::ZoomController* zoom_controller = | 578 ui_zoom::ZoomController* zoom_controller = |
| 579 ui_zoom::ZoomController::FromWebContents(contents); | 579 ui_zoom::ZoomController::FromWebContents(contents); |
| 580 return zoom_controller->GetZoomPercent() != contents->GetMaximumZoomPercent(); | 580 return !contents->IsCrashed() && |
| 581 zoom_controller->GetZoomPercent() != contents->GetMaximumZoomPercent(); | |
|
Peter Kasting
2016/04/12 23:39:56
Nit: Wrong indenting (2 places)
Tom (Use chromium acct)
2016/04/14 19:19:36
Done.
| |
| 581 } | 582 } |
| 582 | 583 |
| 583 bool CanZoomOut(content::WebContents* contents) { | 584 bool CanZoomOut(content::WebContents* contents) { |
| 584 ui_zoom::ZoomController* zoom_controller = | 585 ui_zoom::ZoomController* zoom_controller = |
| 585 ui_zoom::ZoomController::FromWebContents(contents); | 586 ui_zoom::ZoomController::FromWebContents(contents); |
| 586 return zoom_controller->GetZoomPercent() != | 587 return !contents->IsCrashed() && |
| 587 contents->GetMinimumZoomPercent(); | 588 zoom_controller->GetZoomPercent() != contents->GetMinimumZoomPercent(); |
| 588 } | 589 } |
| 589 | 590 |
| 590 bool CanResetZoom(content::WebContents* contents) { | 591 bool CanResetZoom(content::WebContents* contents) { |
| 591 ui_zoom::ZoomController* zoom_controller = | 592 ui_zoom::ZoomController* zoom_controller = |
| 592 ui_zoom::ZoomController::FromWebContents(contents); | 593 ui_zoom::ZoomController::FromWebContents(contents); |
| 593 return !zoom_controller->IsAtDefaultZoom() || | 594 return !zoom_controller->IsAtDefaultZoom() || |
| 594 !zoom_controller->PageScaleFactorIsOne(); | 595 !zoom_controller->PageScaleFactorIsOne(); |
| 595 } | 596 } |
| 596 | 597 |
| 597 TabStripModelDelegate::RestoreTabType GetRestoreTabType( | 598 TabStripModelDelegate::RestoreTabType GetRestoreTabType( |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1287 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
| 1287 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1288 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1288 | 1289 |
| 1289 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1290 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1290 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1291 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1291 app_browser->window()->Show(); | 1292 app_browser->window()->Show(); |
| 1292 } | 1293 } |
| 1293 #endif // defined(ENABLE_EXTENSIONS) | 1294 #endif // defined(ENABLE_EXTENSIONS) |
| 1294 | 1295 |
| 1295 } // namespace chrome | 1296 } // namespace chrome |
| OLD | NEW |