OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.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 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 void Browser::TogglePresentationMode() { | 1784 void Browser::TogglePresentationMode() { |
1785 fullscreen_controller_->TogglePresentationMode(); | 1785 fullscreen_controller_->TogglePresentationMode(); |
1786 } | 1786 } |
1787 #endif | 1787 #endif |
1788 | 1788 |
1789 void Browser::Exit() { | 1789 void Browser::Exit() { |
1790 content::RecordAction(UserMetricsAction("Exit")); | 1790 content::RecordAction(UserMetricsAction("Exit")); |
1791 BrowserList::AttemptUserExit(); | 1791 BrowserList::AttemptUserExit(); |
1792 } | 1792 } |
1793 | 1793 |
1794 #if defined(OS_CHROMEOS) | |
1795 void Browser::ShowKeyboardOverlay() { | |
1796 window_->ShowKeyboardOverlay(window_->GetNativeHandle()); | |
1797 } | |
1798 #endif | |
1799 | |
1800 void Browser::BookmarkCurrentPage() { | 1794 void Browser::BookmarkCurrentPage() { |
1801 content::RecordAction(UserMetricsAction("Star")); | 1795 content::RecordAction(UserMetricsAction("Star")); |
1802 | 1796 |
1803 BookmarkModel* model = profile()->GetBookmarkModel(); | 1797 BookmarkModel* model = profile()->GetBookmarkModel(); |
1804 if (!model || !model->IsLoaded()) | 1798 if (!model || !model->IsLoaded()) |
1805 return; // Ignore requests until bookmarks are loaded. | 1799 return; // Ignore requests until bookmarks are loaded. |
1806 | 1800 |
1807 GURL url; | 1801 GURL url; |
1808 string16 title; | 1802 string16 title; |
1809 TabContentsWrapper* tab = GetSelectedTabContentsWrapper(); | 1803 TabContentsWrapper* tab = GetSelectedTabContentsWrapper(); |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 2809 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
2816 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 2810 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
2817 case IDC_RESTORE_TAB: RestoreTab(); break; | 2811 case IDC_RESTORE_TAB: RestoreTab(); break; |
2818 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 2812 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
2819 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 2813 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
2820 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 2814 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
2821 #if defined(OS_MACOSX) | 2815 #if defined(OS_MACOSX) |
2822 case IDC_PRESENTATION_MODE: TogglePresentationMode(); break; | 2816 case IDC_PRESENTATION_MODE: TogglePresentationMode(); break; |
2823 #endif | 2817 #endif |
2824 case IDC_EXIT: Exit(); break; | 2818 case IDC_EXIT: Exit(); break; |
2825 #if defined(OS_CHROMEOS) | |
2826 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; | |
2827 #endif | |
2828 | 2819 |
2829 // Page-related commands | 2820 // Page-related commands |
2830 case IDC_SAVE_PAGE: SavePage(); break; | 2821 case IDC_SAVE_PAGE: SavePage(); break; |
2831 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; | 2822 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; |
2832 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; | 2823 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; |
2833 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; | 2824 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; |
2834 case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break; | 2825 case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break; |
2835 case IDC_PRINT: Print(); break; | 2826 case IDC_PRINT: Print(); break; |
2836 case IDC_ADVANCED_PRINT: AdvancedPrint(); break; | 2827 case IDC_ADVANCED_PRINT: AdvancedPrint(); break; |
2837 case IDC_CHROME_TO_MOBILE_PAGE: ShowChromeToMobileBubble(); break; | 2828 case IDC_CHROME_TO_MOBILE_PAGE: ShowChromeToMobileBubble(); break; |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4421 // Show various bits of UI | 4412 // Show various bits of UI |
4422 UpdateOpenFileState(); | 4413 UpdateOpenFileState(); |
4423 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); | 4414 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); |
4424 UpdateCommandsForDevTools(); | 4415 UpdateCommandsForDevTools(); |
4425 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); | 4416 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); |
4426 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 4417 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
4427 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 4418 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
4428 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); | 4419 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); |
4429 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); | 4420 command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true); |
4430 | 4421 |
4431 #if defined(OS_CHROMEOS) | |
4432 command_updater_.UpdateCommandEnabled(IDC_SHOW_KEYBOARD_OVERLAY, true); | |
4433 #endif | |
4434 command_updater_.UpdateCommandEnabled( | 4422 command_updater_.UpdateCommandEnabled( |
4435 IDC_SHOW_SYNC_SETUP, profile_->GetOriginalProfile()->IsSyncAccessible()); | 4423 IDC_SHOW_SYNC_SETUP, profile_->GetOriginalProfile()->IsSyncAccessible()); |
4436 | 4424 |
4437 // Initialize other commands based on the window type. | 4425 // Initialize other commands based on the window type. |
4438 bool normal_window = is_type_tabbed(); | 4426 bool normal_window = is_type_tabbed(); |
4439 | 4427 |
4440 // Navigation commands | 4428 // Navigation commands |
4441 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 4429 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
4442 | 4430 |
4443 // Window management commands | 4431 // Window management commands |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 if (contents && !allow_js_access) { | 5464 if (contents && !allow_js_access) { |
5477 contents->web_contents()->GetController().LoadURL( | 5465 contents->web_contents()->GetController().LoadURL( |
5478 target_url, | 5466 target_url, |
5479 content::Referrer(), | 5467 content::Referrer(), |
5480 content::PAGE_TRANSITION_LINK, | 5468 content::PAGE_TRANSITION_LINK, |
5481 std::string()); // No extra headers. | 5469 std::string()); // No extra headers. |
5482 } | 5470 } |
5483 | 5471 |
5484 return contents != NULL; | 5472 return contents != NULL; |
5485 } | 5473 } |
OLD | NEW |