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