| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "app/animation.h" | 7 #include "app/animation.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/gfx/point.h" | 11 #include "base/gfx/point.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/extensions/crashed_extension_infobar.h" | 30 #include "chrome/browser/extensions/crashed_extension_infobar.h" |
| 31 #include "chrome/browser/extensions/extension_browser_event_router.h" | 31 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 32 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 32 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
| 33 #include "chrome/browser/extensions/extension_shelf_model.h" | 33 #include "chrome/browser/extensions/extension_shelf_model.h" |
| 34 #include "chrome/browser/extensions/extension_tabs_module.h" | 34 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 35 #include "chrome/browser/extensions/extensions_service.h" | 35 #include "chrome/browser/extensions/extensions_service.h" |
| 36 #include "chrome/browser/find_bar.h" | 36 #include "chrome/browser/find_bar.h" |
| 37 #include "chrome/browser/find_bar_controller.h" | 37 #include "chrome/browser/find_bar_controller.h" |
| 38 #include "chrome/browser/google_url_tracker.h" | 38 #include "chrome/browser/google_url_tracker.h" |
| 39 #include "chrome/browser/google_util.h" | 39 #include "chrome/browser/google_util.h" |
| 40 #include "chrome/browser/host_zoom_map.h" |
| 40 #include "chrome/browser/location_bar.h" | 41 #include "chrome/browser/location_bar.h" |
| 41 #include "chrome/browser/metrics/user_metrics.h" | 42 #include "chrome/browser/metrics/user_metrics.h" |
| 42 #include "chrome/browser/net/browser_url_util.h" | 43 #include "chrome/browser/net/browser_url_util.h" |
| 43 #include "chrome/browser/net/url_fixer_upper.h" | 44 #include "chrome/browser/net/url_fixer_upper.h" |
| 44 #include "chrome/browser/options_window.h" | 45 #include "chrome/browser/options_window.h" |
| 45 #include "chrome/browser/profile.h" | 46 #include "chrome/browser/profile.h" |
| 46 #include "chrome/browser/renderer_host/site_instance.h" | 47 #include "chrome/browser/renderer_host/site_instance.h" |
| 47 #include "chrome/browser/sessions/session_service.h" | 48 #include "chrome/browser/sessions/session_service.h" |
| 48 #include "chrome/browser/sessions/session_types.h" | 49 #include "chrome/browser/sessions/session_types.h" |
| 49 #include "chrome/browser/sessions/tab_restore_service.h" | 50 #include "chrome/browser/sessions/tab_restore_service.h" |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 void Browser::FindNext() { | 1114 void Browser::FindNext() { |
| 1114 UserMetrics::RecordAction("FindNext", profile_); | 1115 UserMetrics::RecordAction("FindNext", profile_); |
| 1115 FindInPage(true, true); | 1116 FindInPage(true, true); |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 void Browser::FindPrevious() { | 1119 void Browser::FindPrevious() { |
| 1119 UserMetrics::RecordAction("FindPrevious", profile_); | 1120 UserMetrics::RecordAction("FindPrevious", profile_); |
| 1120 FindInPage(true, false); | 1121 FindInPage(true, false); |
| 1121 } | 1122 } |
| 1122 | 1123 |
| 1123 void Browser::ZoomIn() { | 1124 void Browser::Zoom(PageZoom::Function zoom_function) { |
| 1124 UserMetrics::RecordAction("ZoomPlus", profile_); | 1125 static const char* kActions[] = { "ZoomMinus", "ZoomNormal", "ZoomPlus" }; |
| 1125 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::LARGER); | 1126 UserMetrics::RecordComputedAction( |
| 1126 } | 1127 kActions[zoom_function - PageZoom::ZOOM_OUT], profile_); |
| 1127 | 1128 TabContents* tab_contents = GetSelectedTabContents(); |
| 1128 void Browser::ZoomReset() { | 1129 tab_contents->render_view_host()->Zoom(zoom_function); |
| 1129 UserMetrics::RecordAction("ZoomNormal", profile_); | |
| 1130 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::STANDARD); | |
| 1131 } | |
| 1132 | |
| 1133 void Browser::ZoomOut() { | |
| 1134 UserMetrics::RecordAction("ZoomMinus", profile_); | |
| 1135 GetSelectedTabContents()->render_view_host()->Zoom(PageZoom::SMALLER); | |
| 1136 } | 1130 } |
| 1137 | 1131 |
| 1138 void Browser::FocusToolbar() { | 1132 void Browser::FocusToolbar() { |
| 1139 UserMetrics::RecordAction("FocusToolbar", profile_); | 1133 UserMetrics::RecordAction("FocusToolbar", profile_); |
| 1140 window_->FocusToolbar(); | 1134 window_->FocusToolbar(); |
| 1141 } | 1135 } |
| 1142 | 1136 |
| 1143 void Browser::FocusLocationBar() { | 1137 void Browser::FocusLocationBar() { |
| 1144 UserMetrics::RecordAction("FocusLocation", profile_); | 1138 UserMetrics::RecordAction("FocusLocation", profile_); |
| 1145 window_->SetFocusToLocationBar(); | 1139 window_->SetFocusToLocationBar(); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 case IDC_COPY: Copy(); break; | 1504 case IDC_COPY: Copy(); break; |
| 1511 case IDC_PASTE: Paste(); break; | 1505 case IDC_PASTE: Paste(); break; |
| 1512 #endif | 1506 #endif |
| 1513 | 1507 |
| 1514 // Find-in-page | 1508 // Find-in-page |
| 1515 case IDC_FIND: Find(); break; | 1509 case IDC_FIND: Find(); break; |
| 1516 case IDC_FIND_NEXT: FindNext(); break; | 1510 case IDC_FIND_NEXT: FindNext(); break; |
| 1517 case IDC_FIND_PREVIOUS: FindPrevious(); break; | 1511 case IDC_FIND_PREVIOUS: FindPrevious(); break; |
| 1518 | 1512 |
| 1519 // Zoom | 1513 // Zoom |
| 1520 case IDC_ZOOM_PLUS: ZoomIn(); break; | 1514 case IDC_ZOOM_PLUS: Zoom(PageZoom::ZOOM_IN); break; |
| 1521 case IDC_ZOOM_NORMAL: ZoomReset(); break; | 1515 case IDC_ZOOM_NORMAL: Zoom(PageZoom::RESET); break; |
| 1522 case IDC_ZOOM_MINUS: ZoomOut(); break; | 1516 case IDC_ZOOM_MINUS: Zoom(PageZoom::ZOOM_OUT); break; |
| 1523 | 1517 |
| 1524 // Focus various bits of UI | 1518 // Focus various bits of UI |
| 1525 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break; | 1519 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break; |
| 1526 case IDC_FOCUS_LOCATION: FocusLocationBar(); break; | 1520 case IDC_FOCUS_LOCATION: FocusLocationBar(); break; |
| 1527 case IDC_FOCUS_SEARCH: FocusSearch(); break; | 1521 case IDC_FOCUS_SEARCH: FocusSearch(); break; |
| 1528 | 1522 |
| 1529 // Show various bits of UI | 1523 // Show various bits of UI |
| 1530 case IDC_OPEN_FILE: OpenFile(); break; | 1524 case IDC_OPEN_FILE: OpenFile(); break; |
| 1531 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break; | 1525 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break; |
| 1532 case IDC_DEV_TOOLS: ToggleDevToolsWindow(false); break; | 1526 case IDC_DEV_TOOLS: ToggleDevToolsWindow(false); break; |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3068 /////////////////////////////////////////////////////////////////////////////// | 3062 /////////////////////////////////////////////////////////////////////////////// |
| 3069 // BrowserToolbarModel (private): | 3063 // BrowserToolbarModel (private): |
| 3070 | 3064 |
| 3071 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 3065 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 3072 // This |current_tab| can be NULL during the initialization of the | 3066 // This |current_tab| can be NULL during the initialization of the |
| 3073 // toolbar during window creation (i.e. before any tabs have been added | 3067 // toolbar during window creation (i.e. before any tabs have been added |
| 3074 // to the window). | 3068 // to the window). |
| 3075 TabContents* current_tab = browser_->GetSelectedTabContents(); | 3069 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 3076 return current_tab ? ¤t_tab->controller() : NULL; | 3070 return current_tab ? ¤t_tab->controller() : NULL; |
| 3077 } | 3071 } |
| OLD | NEW |