| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 void Browser::ToggleFullscreenMode() { | 886 void Browser::ToggleFullscreenMode() { |
| 887 UserMetrics::RecordAction(L"ToggleFullscreen", profile_); | 887 UserMetrics::RecordAction(L"ToggleFullscreen", profile_); |
| 888 window_->SetFullscreen(!window_->IsFullscreen()); | 888 window_->SetFullscreen(!window_->IsFullscreen()); |
| 889 // On Linux, setting fullscreen mode is an async call to the X server, which | 889 // On Linux, setting fullscreen mode is an async call to the X server, which |
| 890 // may or may not support fullscreen mode. | 890 // may or may not support fullscreen mode. |
| 891 #if !defined(OS_LINUX) | 891 #if !defined(OS_LINUX) |
| 892 UpdateCommandsForFullscreenMode(window_->IsFullscreen()); | 892 UpdateCommandsForFullscreenMode(window_->IsFullscreen()); |
| 893 #endif | 893 #endif |
| 894 } | 894 } |
| 895 | 895 |
| 896 #if defined(TOOLKIT_VIEWS) |
| 897 void Browser::ToggleCompactNavigationBar() { |
| 898 UserMetrics::RecordAction(L"ToggleCompactNavigationBar", profile_); |
| 899 window_->ToggleCompactNavigationBar(); |
| 900 } |
| 901 #endif |
| 902 |
| 896 void Browser::Exit() { | 903 void Browser::Exit() { |
| 897 UserMetrics::RecordAction(L"Exit", profile_); | 904 UserMetrics::RecordAction(L"Exit", profile_); |
| 898 BrowserList::CloseAllBrowsersAndExit(); | 905 BrowserList::CloseAllBrowsersAndExit(); |
| 899 } | 906 } |
| 900 | 907 |
| 901 void Browser::BookmarkCurrentPage() { | 908 void Browser::BookmarkCurrentPage() { |
| 902 UserMetrics::RecordAction(L"Star", profile_); | 909 UserMetrics::RecordAction(L"Star", profile_); |
| 903 | 910 |
| 904 BookmarkModel* model = profile()->GetBookmarkModel(); | 911 BookmarkModel* model = profile()->GetBookmarkModel(); |
| 905 if (!model || !model->IsLoaded()) | 912 if (!model || !model->IsLoaded()) |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 case IDC_SELECT_TAB_6: | 1360 case IDC_SELECT_TAB_6: |
| 1354 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); | 1361 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); |
| 1355 break; | 1362 break; |
| 1356 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 1363 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
| 1357 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 1364 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
| 1358 case IDC_RESTORE_TAB: RestoreTab(); break; | 1365 case IDC_RESTORE_TAB: RestoreTab(); break; |
| 1359 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 1366 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
| 1360 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 1367 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
| 1361 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 1368 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
| 1362 case IDC_EXIT: Exit(); break; | 1369 case IDC_EXIT: Exit(); break; |
| 1370 #if defined(TOOLKIT_VIEWS) |
| 1371 case IDC_COMPACT_NAVBAR: ToggleCompactNavigationBar(); break; |
| 1372 #endif |
| 1363 | 1373 |
| 1364 // Page-related commands | 1374 // Page-related commands |
| 1365 case IDC_SAVE_PAGE: SavePage(); break; | 1375 case IDC_SAVE_PAGE: SavePage(); break; |
| 1366 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; | 1376 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; |
| 1367 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; | 1377 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; |
| 1368 case IDC_VIEW_SOURCE: ViewSource(); break; | 1378 case IDC_VIEW_SOURCE: ViewSource(); break; |
| 1369 #if defined(OS_WIN) | 1379 #if defined(OS_WIN) |
| 1370 case IDC_CLOSE_POPUPS: ClosePopups(); break; | 1380 case IDC_CLOSE_POPUPS: ClosePopups(); break; |
| 1371 #endif | 1381 #endif |
| 1372 case IDC_PRINT: Print(); break; | 1382 case IDC_PRINT: Print(); break; |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_5, true); | 2271 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_5, true); |
| 2262 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_6, true); | 2272 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_6, true); |
| 2263 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_7, true); | 2273 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_7, true); |
| 2264 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_8, true); | 2274 command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW_PROFILE_8, true); |
| 2265 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); | 2275 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true); |
| 2266 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); | 2276 command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true); |
| 2267 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); | 2277 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true); |
| 2268 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); | 2278 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true); |
| 2269 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, true); | 2279 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, true); |
| 2270 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); | 2280 command_updater_.UpdateCommandEnabled(IDC_EXIT, true); |
| 2281 #if defined(TOOLKIT_VIEWS) |
| 2282 command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true); |
| 2283 #endif |
| 2271 | 2284 |
| 2272 // Page-related commands | 2285 // Page-related commands |
| 2273 command_updater_.UpdateCommandEnabled(IDC_CLOSE_POPUPS, true); | 2286 command_updater_.UpdateCommandEnabled(IDC_CLOSE_POPUPS, true); |
| 2274 command_updater_.UpdateCommandEnabled(IDC_PRINT, true); | 2287 command_updater_.UpdateCommandEnabled(IDC_PRINT, true); |
| 2275 command_updater_.UpdateCommandEnabled(IDC_ENCODING_AUTO_DETECT, true); | 2288 command_updater_.UpdateCommandEnabled(IDC_ENCODING_AUTO_DETECT, true); |
| 2276 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF8, true); | 2289 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF8, true); |
| 2277 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF16LE, true); | 2290 command_updater_.UpdateCommandEnabled(IDC_ENCODING_UTF16LE, true); |
| 2278 command_updater_.UpdateCommandEnabled(IDC_ENCODING_ISO88591, true); | 2291 command_updater_.UpdateCommandEnabled(IDC_ENCODING_ISO88591, true); |
| 2279 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1252, true); | 2292 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1252, true); |
| 2280 command_updater_.UpdateCommandEnabled(IDC_ENCODING_GBK, true); | 2293 command_updater_.UpdateCommandEnabled(IDC_ENCODING_GBK, true); |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 /////////////////////////////////////////////////////////////////////////////// | 2959 /////////////////////////////////////////////////////////////////////////////// |
| 2947 // BrowserToolbarModel (private): | 2960 // BrowserToolbarModel (private): |
| 2948 | 2961 |
| 2949 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2962 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
| 2950 // This |current_tab| can be NULL during the initialization of the | 2963 // This |current_tab| can be NULL during the initialization of the |
| 2951 // toolbar during window creation (i.e. before any tabs have been added | 2964 // toolbar during window creation (i.e. before any tabs have been added |
| 2952 // to the window). | 2965 // to the window). |
| 2953 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2966 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 2954 return current_tab ? ¤t_tab->controller() : NULL; | 2967 return current_tab ? ¤t_tab->controller() : NULL; |
| 2955 } | 2968 } |
| OLD | NEW |