| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 // BrowserWindow::SetFullscreen() asks for bookmark_bar_state_, so we let the | 1627 // BrowserWindow::SetFullscreen() asks for bookmark_bar_state_, so we let the |
| 1628 // BrowserWindow invoke WindowFullscreenStateChanged when appropriate. | 1628 // BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
| 1629 | 1629 |
| 1630 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates | 1630 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates |
| 1631 // the necessary state of the frame. | 1631 // the necessary state of the frame. |
| 1632 #if defined(OS_MACOSX) | 1632 #if defined(OS_MACOSX) |
| 1633 WindowFullscreenStateChanged(); | 1633 WindowFullscreenStateChanged(); |
| 1634 #endif | 1634 #endif |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 #if defined(OS_MACOSX) |
| 1638 void Browser::TogglePresentationMode() { |
| 1639 window_->SetPresentationMode(!window_->InPresentationMode()); |
| 1640 WindowFullscreenStateChanged(); |
| 1641 } |
| 1642 #endif |
| 1643 |
| 1637 #if defined(OS_CHROMEOS) | 1644 #if defined(OS_CHROMEOS) |
| 1638 void Browser::Search() { | 1645 void Browser::Search() { |
| 1639 // If the NTP is showing, close it. | 1646 // If the NTP is showing, close it. |
| 1640 const GURL& url = GetSelectedTabContents()->GetURL(); | 1647 const GURL& url = GetSelectedTabContents()->GetURL(); |
| 1641 if (url.SchemeIs(chrome::kChromeUIScheme) && | 1648 if (url.SchemeIs(chrome::kChromeUIScheme) && |
| 1642 url.host() == chrome::kChromeUINewTabHost) { | 1649 url.host() == chrome::kChromeUINewTabHost) { |
| 1643 CloseTab(); | 1650 CloseTab(); |
| 1644 return; | 1651 return; |
| 1645 } | 1652 } |
| 1646 | 1653 |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2374 case IDC_SELECT_TAB_5: | 2381 case IDC_SELECT_TAB_5: |
| 2375 case IDC_SELECT_TAB_6: | 2382 case IDC_SELECT_TAB_6: |
| 2376 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); | 2383 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); |
| 2377 break; | 2384 break; |
| 2378 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 2385 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
| 2379 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 2386 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
| 2380 case IDC_RESTORE_TAB: RestoreTab(); break; | 2387 case IDC_RESTORE_TAB: RestoreTab(); break; |
| 2381 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 2388 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
| 2382 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 2389 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
| 2383 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 2390 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
| 2391 #if defined(OS_MACOSX) |
| 2392 case IDC_PRESENTATION_MODE: TogglePresentationMode(); break; |
| 2393 #endif |
| 2384 case IDC_EXIT: Exit(); break; | 2394 case IDC_EXIT: Exit(); break; |
| 2385 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; | 2395 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; |
| 2386 case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break; | 2396 case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break; |
| 2387 #if defined(OS_CHROMEOS) | 2397 #if defined(OS_CHROMEOS) |
| 2388 case IDC_SEARCH: Search(); break; | 2398 case IDC_SEARCH: Search(); break; |
| 2389 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; | 2399 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; |
| 2390 #endif | 2400 #endif |
| 2391 | 2401 |
| 2392 // Page-related commands | 2402 // Page-related commands |
| 2393 case IDC_SAVE_PAGE: SavePage(); break; | 2403 case IDC_SAVE_PAGE: SavePage(); break; |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3932 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, | 3942 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, |
| 3933 enable_extensions); | 3943 enable_extensions); |
| 3934 | 3944 |
| 3935 // Initialize other commands based on the window type. | 3945 // Initialize other commands based on the window type. |
| 3936 bool normal_window = is_type_tabbed(); | 3946 bool normal_window = is_type_tabbed(); |
| 3937 | 3947 |
| 3938 // Navigation commands | 3948 // Navigation commands |
| 3939 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 3949 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
| 3940 | 3950 |
| 3941 // Window management commands | 3951 // Window management commands |
| 3952 // TODO(rohitrao): Disable fullscreen on non-Lion? |
| 3942 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, | 3953 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, |
| 3943 !(is_type_panel() && is_app())); | 3954 !(is_type_panel() && is_app())); |
| 3944 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); | 3955 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); |
| 3945 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, | 3956 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, |
| 3946 normal_window); | 3957 normal_window); |
| 3947 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window); | 3958 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window); |
| 3948 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window); | 3959 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window); |
| 3949 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window); | 3960 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window); |
| 3950 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window); | 3961 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window); |
| 3951 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window); | 3962 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window); |
| 3952 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window); | 3963 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window); |
| 3953 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); | 3964 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); |
| 3954 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); | 3965 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); |
| 3955 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); | 3966 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); |
| 3956 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); | 3967 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); |
| 3957 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); | 3968 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); |
| 3958 #if defined(OS_MACOSX) | 3969 #if defined(OS_MACOSX) |
| 3959 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); | 3970 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); |
| 3971 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, |
| 3972 !(is_type_panel() && is_app())); |
| 3960 #endif | 3973 #endif |
| 3961 | 3974 |
| 3962 // Clipboard commands | 3975 // Clipboard commands |
| 3963 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, !is_devtools()); | 3976 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, !is_devtools()); |
| 3964 | 3977 |
| 3965 // Find-in-page | 3978 // Find-in-page |
| 3966 command_updater_.UpdateCommandEnabled(IDC_FIND, !is_devtools()); | 3979 command_updater_.UpdateCommandEnabled(IDC_FIND, !is_devtools()); |
| 3967 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, !is_devtools()); | 3980 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, !is_devtools()); |
| 3968 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools()); | 3981 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools()); |
| 3969 | 3982 |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4815 } | 4828 } |
| 4816 | 4829 |
| 4817 void Browser::ShowSyncSetup() { | 4830 void Browser::ShowSyncSetup() { |
| 4818 ProfileSyncService* service = | 4831 ProfileSyncService* service = |
| 4819 profile()->GetOriginalProfile()->GetProfileSyncService(); | 4832 profile()->GetOriginalProfile()->GetProfileSyncService(); |
| 4820 if (service->HasSyncSetupCompleted()) | 4833 if (service->HasSyncSetupCompleted()) |
| 4821 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4834 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 4822 else | 4835 else |
| 4823 service->ShowLoginDialog(); | 4836 service->ShowLoginDialog(); |
| 4824 } | 4837 } |
| OLD | NEW |