| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/browser/ui/find_bar/find_bar.h" | 43 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 44 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 45 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 46 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 46 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 47 #include "chrome/browser/ui/location_bar/location_bar.h" | 47 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 48 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 49 #include "chrome/browser/ui/search/search_tab_helper.h" | 49 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 50 #include "chrome/browser/ui/status_bubble.h" | 50 #include "chrome/browser/ui/status_bubble.h" |
| 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 51 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 52 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 53 #include "chrome/browser/ui/zoom/zoom_controller.h" | |
| 54 #include "chrome/browser/upgrade_detector.h" | 53 #include "chrome/browser/upgrade_detector.h" |
| 55 #include "chrome/common/chrome_switches.h" | 54 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/chrome_version_info.h" | 55 #include "chrome/common/chrome_version_info.h" |
| 57 #include "chrome/common/content_restriction.h" | 56 #include "chrome/common/content_restriction.h" |
| 58 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
| 59 #include "components/bookmarks/browser/bookmark_model.h" | 58 #include "components/bookmarks/browser/bookmark_model.h" |
| 60 #include "components/bookmarks/browser/bookmark_utils.h" | 59 #include "components/bookmarks/browser/bookmark_utils.h" |
| 61 #include "components/google/core/browser/google_util.h" | 60 #include "components/google/core/browser/google_util.h" |
| 62 #include "components/translate/core/browser/language_state.h" | 61 #include "components/translate/core/browser/language_state.h" |
| 62 #include "components/ui/zoom/zoom_controller.h" |
| 63 #include "components/web_modal/popup_manager.h" | 63 #include "components/web_modal/popup_manager.h" |
| 64 #include "content/public/browser/devtools_agent_host.h" | 64 #include "content/public/browser/devtools_agent_host.h" |
| 65 #include "content/public/browser/navigation_controller.h" | 65 #include "content/public/browser/navigation_controller.h" |
| 66 #include "content/public/browser/navigation_entry.h" | 66 #include "content/public/browser/navigation_entry.h" |
| 67 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 68 #include "content/public/browser/page_navigator.h" | 68 #include "content/public/browser/page_navigator.h" |
| 69 #include "content/public/browser/render_view_host.h" | 69 #include "content/public/browser/render_view_host.h" |
| 70 #include "content/public/browser/render_widget_host_view.h" | 70 #include "content/public/browser/render_widget_host_view.h" |
| 71 #include "content/public/browser/user_metrics.h" | 71 #include "content/public/browser/user_metrics.h" |
| 72 #include "content/public/browser/web_contents.h" | 72 #include "content/public/browser/web_contents.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); | 589 b->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 | 592 |
| 593 void CloseTab(Browser* browser) { | 593 void CloseTab(Browser* browser) { |
| 594 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); | 594 content::RecordAction(UserMetricsAction("CloseTab_Accelerator")); |
| 595 browser->tab_strip_model()->CloseSelectedTabs(); | 595 browser->tab_strip_model()->CloseSelectedTabs(); |
| 596 } | 596 } |
| 597 | 597 |
| 598 bool CanZoomIn(content::WebContents* contents) { | 598 bool CanZoomIn(content::WebContents* contents) { |
| 599 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 599 ui_zoom::ZoomController* zoom_controller = |
| 600 ui_zoom::ZoomController::FromWebContents(contents); |
| 600 return zoom_controller->GetZoomPercent() != | 601 return zoom_controller->GetZoomPercent() != |
| 601 contents->GetMaximumZoomPercent() + 1; | 602 contents->GetMaximumZoomPercent() + 1; |
| 602 } | 603 } |
| 603 | 604 |
| 604 bool CanZoomOut(content::WebContents* contents) { | 605 bool CanZoomOut(content::WebContents* contents) { |
| 605 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 606 ui_zoom::ZoomController* zoom_controller = |
| 607 ui_zoom::ZoomController::FromWebContents(contents); |
| 606 return zoom_controller->GetZoomPercent() != | 608 return zoom_controller->GetZoomPercent() != |
| 607 contents->GetMinimumZoomPercent(); | 609 contents->GetMinimumZoomPercent(); |
| 608 } | 610 } |
| 609 | 611 |
| 610 bool ActualSize(content::WebContents* contents) { | 612 bool ActualSize(content::WebContents* contents) { |
| 611 ZoomController* zoom_controller = ZoomController::FromWebContents(contents); | 613 ui_zoom::ZoomController* zoom_controller = |
| 614 ui_zoom::ZoomController::FromWebContents(contents); |
| 612 return zoom_controller->GetZoomPercent() != 100.0f; | 615 return zoom_controller->GetZoomPercent() != 100.0f; |
| 613 } | 616 } |
| 614 | 617 |
| 615 TabStripModelDelegate::RestoreTabType GetRestoreTabType( | 618 TabStripModelDelegate::RestoreTabType GetRestoreTabType( |
| 616 const Browser* browser) { | 619 const Browser* browser) { |
| 617 TabRestoreService* service = | 620 TabRestoreService* service = |
| 618 TabRestoreServiceFactory::GetForProfile(browser->profile()); | 621 TabRestoreServiceFactory::GetForProfile(browser->profile()); |
| 619 if (!service || service->entries().empty()) | 622 if (!service || service->entries().empty()) |
| 620 return TabStripModelDelegate::RESTORE_NONE; | 623 return TabStripModelDelegate::RESTORE_NONE; |
| 621 if (service->entries().front()->type == TabRestoreService::WINDOW) | 624 if (service->entries().front()->type == TabRestoreService::WINDOW) |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 browser->host_desktop_type())); | 1271 browser->host_desktop_type())); |
| 1269 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1272 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
| 1270 | 1273 |
| 1271 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1274 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
| 1272 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1275 contents->GetRenderViewHost()->SyncRendererPrefs(); |
| 1273 app_browser->window()->Show(); | 1276 app_browser->window()->Show(); |
| 1274 } | 1277 } |
| 1275 #endif // defined(ENABLE_EXTENSIONS) | 1278 #endif // defined(ENABLE_EXTENSIONS) |
| 1276 | 1279 |
| 1277 } // namespace chrome | 1280 } // namespace chrome |
| OLD | NEW |