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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3931 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, | 3941 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, |
3932 enable_extensions); | 3942 enable_extensions); |
3933 | 3943 |
3934 // Initialize other commands based on the window type. | 3944 // Initialize other commands based on the window type. |
3935 bool normal_window = is_type_tabbed(); | 3945 bool normal_window = is_type_tabbed(); |
3936 | 3946 |
3937 // Navigation commands | 3947 // Navigation commands |
3938 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 3948 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
3939 | 3949 |
3940 // Window management commands | 3950 // Window management commands |
| 3951 // TODO(rohitrao): Disable fullscreen on non-Lion? |
3941 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, | 3952 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, |
3942 !(is_type_panel() && is_app())); | 3953 !(is_type_panel() && is_app())); |
3943 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); | 3954 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); |
3944 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, | 3955 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, |
3945 normal_window); | 3956 normal_window); |
3946 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window); | 3957 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window); |
3947 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window); | 3958 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window); |
3948 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window); | 3959 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window); |
3949 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window); | 3960 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window); |
3950 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window); | 3961 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window); |
3951 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window); | 3962 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window); |
3952 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); | 3963 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); |
3953 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); | 3964 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); |
3954 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); | 3965 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); |
3955 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); | 3966 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); |
3956 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); | 3967 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); |
3957 #if defined(OS_MACOSX) | 3968 #if defined(OS_MACOSX) |
3958 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); | 3969 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); |
| 3970 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, |
| 3971 !(is_type_panel() && is_app())); |
3959 #endif | 3972 #endif |
3960 | 3973 |
3961 // Clipboard commands | 3974 // Clipboard commands |
3962 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, !is_devtools()); | 3975 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, !is_devtools()); |
3963 | 3976 |
3964 // Find-in-page | 3977 // Find-in-page |
3965 command_updater_.UpdateCommandEnabled(IDC_FIND, !is_devtools()); | 3978 command_updater_.UpdateCommandEnabled(IDC_FIND, !is_devtools()); |
3966 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, !is_devtools()); | 3979 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, !is_devtools()); |
3967 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools()); | 3980 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools()); |
3968 | 3981 |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4813 window_->BookmarkBarStateChanged(animate_type); | 4826 window_->BookmarkBarStateChanged(animate_type); |
4814 } | 4827 } |
4815 | 4828 |
4816 void Browser::ShowSyncSetup() { | 4829 void Browser::ShowSyncSetup() { |
4817 ProfileSyncService* service = profile()->GetProfileSyncService(); | 4830 ProfileSyncService* service = profile()->GetProfileSyncService(); |
4818 if (service->HasSyncSetupCompleted()) | 4831 if (service->HasSyncSetupCompleted()) |
4819 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4832 ShowOptionsTab(chrome::kSyncSetupSubPage); |
4820 else | 4833 else |
4821 profile()->GetProfileSyncService()->ShowLoginDialog(); | 4834 profile()->GetProfileSyncService()->ShowLoginDialog(); |
4822 } | 4835 } |
OLD | NEW |