| 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); | 572 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 | 575 |
| 576 void CloseTab(Browser* browser) { | 576 void CloseTab(Browser* browser) { |
| 577 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); | 577 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); |
| 578 browser->tab_strip_model()->CloseSelectedTabs(); | 578 browser->tab_strip_model()->CloseSelectedTabs(); |
| 579 } | 579 } |
| 580 | 580 |
| 581 bool CanZoomIn(content::WebContents* contents) { | 581 bool CanZoomIn(content::WebContents* contents) { |
| 582 ui_zoom::ZoomController* zoom_controller = | 582 return contents && !contents->IsCrashed() && |
| 583 ui_zoom::ZoomController::FromWebContents(contents); | 583 ui_zoom::ZoomController::FromWebContents(contents)->GetZoomPercent() != |
| 584 return zoom_controller->GetZoomPercent() != contents->GetMaximumZoomPercent(); | 584 contents->GetMaximumZoomPercent(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 bool CanZoomOut(content::WebContents* contents) { | 587 bool CanZoomOut(content::WebContents* contents) { |
| 588 ui_zoom::ZoomController* zoom_controller = | 588 return contents && !contents->IsCrashed() && |
| 589 ui_zoom::ZoomController::FromWebContents(contents); | 589 ui_zoom::ZoomController::FromWebContents(contents)->GetZoomPercent() != |
| 590 return zoom_controller->GetZoomPercent() != | 590 contents->GetMinimumZoomPercent(); |
| 591 contents->GetMinimumZoomPercent(); | |
| 592 } | 591 } |
| 593 | 592 |
| 594 bool CanResetZoom(content::WebContents* contents) { | 593 bool CanResetZoom(content::WebContents* contents) { |
| 595 ui_zoom::ZoomController* zoom_controller = | 594 ui_zoom::ZoomController* zoom_controller = |
| 596 ui_zoom::ZoomController::FromWebContents(contents); | 595 ui_zoom::ZoomController::FromWebContents(contents); |
| 597 return !zoom_controller->IsAtDefaultZoom() || | 596 return !zoom_controller->IsAtDefaultZoom() || |
| 598 !zoom_controller->PageScaleFactorIsOne(); | 597 !zoom_controller->PageScaleFactorIsOne(); |
| 599 } | 598 } |
| 600 | 599 |
| 601 TabStripModelDelegate::RestoreTabType GetRestoreTabType( | 600 TabStripModelDelegate::RestoreTabType GetRestoreTabType( |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); | 1289 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); |
| 1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1290 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1292 | 1291 |
| 1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1292 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1294 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1293 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1295 app_browser->window()->Show(); | 1294 app_browser->window()->Show(); |
| 1296 } | 1295 } |
| 1297 #endif // defined(ENABLE_EXTENSIONS) | 1296 #endif // defined(ENABLE_EXTENSIONS) |
| 1298 | 1297 |
| 1299 } // namespace chrome | 1298 } // namespace chrome |
| OLD | NEW |