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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // See http://crbug.com/6380. | 591 // See http://crbug.com/6380. |
592 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); | 592 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); |
593 } | 593 } |
594 } | 594 } |
595 | 595 |
596 void CloseTab(Browser* browser) { | 596 void CloseTab(Browser* browser) { |
597 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); | 597 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); |
598 browser->tab_strip_model()->CloseSelectedTabs(); | 598 browser->tab_strip_model()->CloseSelectedTabs(); |
599 } | 599 } |
600 | 600 |
601 bool CanZoomIn(content::WebContents* contents) { | 601 bool IsAtMaximumZoom(content::WebContents* contents) { |
602 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 602 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); |
603 return zoom_controller->GetZoomPercent() != | 603 return zoom_controller->GetZoomPercent() != |
604 contents->GetMaximumZoomPercent() + 1; | 604 contents->GetMaximumZoomPercent() + 1; |
605 } | 605 } |
606 | 606 |
607 bool CanZoomOut(content::WebContents* contents) { | 607 bool IsAtMinimumZoom(content::WebContents* contents) { |
608 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 608 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); |
609 return zoom_controller->GetZoomPercent() != | 609 return zoom_controller->GetZoomPercent() != |
610 contents->GetMinimumZoomPercent(); | 610 contents->GetMinimumZoomPercent(); |
611 } | 611 } |
612 | 612 |
613 bool ActualSize(content::WebContents* contents) { | 613 bool IsAtDefaultZoom(content::WebContents* contents) { |
614 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 614 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); |
615 return zoom_controller->GetZoomPercent() != 100.0f; | 615 return zoom_controller->IsAtDefaultZoom(); |
616 } | 616 } |
617 | 617 |
618 TabStripModelDelegate::RestoreTabType GetRestoreTabType( | 618 TabStripModelDelegate::RestoreTabType GetRestoreTabType( |
619 const Browser* browser) { | 619 const Browser* browser) { |
620 TabRestoreService* service = | 620 TabRestoreService* service = |
621 TabRestoreServiceFactory::GetForProfile(browser->profile()); | 621 TabRestoreServiceFactory::GetForProfile(browser->profile()); |
622 if (!service || service->entries().empty()) | 622 if (!service || service->entries().empty()) |
623 return TabStripModelDelegate::RESTORE_NONE; | 623 return TabStripModelDelegate::RESTORE_NONE; |
624 if (service->entries().front()->type == TabRestoreService::WINDOW) | 624 if (service->entries().front()->type == TabRestoreService::WINDOW) |
625 return TabStripModelDelegate::RESTORE_WINDOW; | 625 return TabStripModelDelegate::RESTORE_WINDOW; |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 browser->host_desktop_type())); | 1290 browser->host_desktop_type())); |
1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1291 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1292 | 1292 |
1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1294 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1294 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1295 app_browser->window()->Show(); | 1295 app_browser->window()->Show(); |
1296 } | 1296 } |
1297 #endif // defined(ENABLE_EXTENSIONS) | 1297 #endif // defined(ENABLE_EXTENSIONS) |
1298 | 1298 |
1299 } // namespace chrome | 1299 } // namespace chrome |
OLD | NEW |