Chromium Code Reviews| 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 case IDC_SHOW_BOOKMARK_MANAGER: | 760 case IDC_SHOW_BOOKMARK_MANAGER: |
| 761 enable = [self keyWindowIsNotModal]; | 761 enable = [self keyWindowIsNotModal]; |
| 762 break; | 762 break; |
| 763 // Browser-level items that open in new windows. | 763 // Browser-level items that open in new windows. |
| 764 case IDC_NEW_WINDOW: | 764 case IDC_NEW_WINDOW: |
| 765 case IDC_TASK_MANAGER: | 765 case IDC_TASK_MANAGER: |
| 766 // Allow the user to open a new window if there's a window-modal | 766 // Allow the user to open a new window if there's a window-modal |
| 767 // dialog. | 767 // dialog. |
| 768 enable = [self keyWindowIsNotModal] || ([NSApp modalWindow] == nil); | 768 enable = [self keyWindowIsNotModal] || ([NSApp modalWindow] == nil); |
| 769 break; | 769 break; |
| 770 case IDC_SYNC_BOOKMARKS: { | 770 case IDC_SHOW_SYNC_SETUP: { |
| 771 Profile* lastProfile = [self lastProfile]; | 771 Profile* lastProfile = [self lastProfile]; |
| 772 // The profile may be NULL during shutdown -- see | 772 // The profile may be NULL during shutdown -- see |
| 773 // http://code.google.com/p/chromium/issues/detail?id=43048 . | 773 // http://code.google.com/p/chromium/issues/detail?id=43048 . |
| 774 // | 774 // |
| 775 // TODO(akalin,viettrungluu): Figure out whether this method | 775 // TODO(akalin,viettrungluu): Figure out whether this method |
| 776 // can be prevented from being called if lastProfile is | 776 // can be prevented from being called if lastProfile is |
| 777 // NULL. | 777 // NULL. |
| 778 if (!lastProfile) { | 778 if (!lastProfile) { |
| 779 LOG(WARNING) | 779 LOG(WARNING) |
| 780 << "NULL lastProfile detected -- not doing anything"; | 780 << "NULL lastProfile detected -- not doing anything"; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 browser->ShowExtensionsTab(); | 899 browser->ShowExtensionsTab(); |
| 900 else | 900 else |
| 901 Browser::OpenExtensionsWindow(lastProfile); | 901 Browser::OpenExtensionsWindow(lastProfile); |
| 902 break; | 902 break; |
| 903 case IDC_HELP_PAGE: | 903 case IDC_HELP_PAGE: |
| 904 if (Browser* browser = ActivateBrowser(lastProfile)) | 904 if (Browser* browser = ActivateBrowser(lastProfile)) |
| 905 browser->ShowHelpTab(); | 905 browser->ShowHelpTab(); |
| 906 else | 906 else |
| 907 Browser::OpenHelpWindow(lastProfile); | 907 Browser::OpenHelpWindow(lastProfile); |
| 908 break; | 908 break; |
| 909 case IDC_SYNC_BOOKMARKS: | 909 case IDC_SHOW_SYNC_SETUP: |
| 910 // The profile may be NULL during shutdown -- see | 910 if (Browser* browser = ActivateBrowser(lastProfile)) |
|
akalin
2012/02/24 01:56:13
almost certain this is against style. what about:
Andrew T Wilson (Slow)
2012/02/24 22:12:11
not changing per our discussion.
| |
| 911 // http://code.google.com/p/chromium/issues/detail?id=43048 . | 911 browser->ShowSyncSetup(); |
| 912 // | 912 else |
| 913 // TODO(akalin,viettrungluu): Figure out whether this method can | 913 Browser::OpenSyncSetupWindow(lastProfile); |
| 914 // be prevented from being called if lastProfile is NULL. | |
| 915 if (!lastProfile) { | |
| 916 LOG(WARNING) << "NULL lastProfile detected -- not doing anything"; | |
| 917 break; | |
| 918 } | |
| 919 // TODO(akalin): Add a constant to denote starting sync from the | |
| 920 // main menu and use that instead of START_FROM_WRENCH. | |
| 921 sync_ui_util::OpenSyncMyBookmarksDialog( | |
| 922 lastProfile, ActivateBrowser(lastProfile), | |
| 923 ProfileSyncService::START_FROM_WRENCH); | |
| 924 break; | 914 break; |
| 925 case IDC_TASK_MANAGER: | 915 case IDC_TASK_MANAGER: |
| 926 content::RecordAction(UserMetricsAction("TaskManager")); | 916 content::RecordAction(UserMetricsAction("TaskManager")); |
| 927 TaskManagerMac::Show(false); | 917 TaskManagerMac::Show(false); |
| 928 break; | 918 break; |
| 929 case IDC_OPTIONS: | 919 case IDC_OPTIONS: |
| 930 [self showPreferences:sender]; | 920 [self showPreferences:sender]; |
| 931 break; | 921 break; |
| 932 default: | 922 default: |
| 933 // Background Applications use dynamic values that must be less than the | 923 // Background Applications use dynamic values that must be less than the |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false); | 1028 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false); |
| 1039 menuState_->UpdateCommandEnabled(IDC_FOCUS_LOCATION, true); | 1029 menuState_->UpdateCommandEnabled(IDC_FOCUS_LOCATION, true); |
| 1040 menuState_->UpdateCommandEnabled(IDC_FOCUS_SEARCH, true); | 1030 menuState_->UpdateCommandEnabled(IDC_FOCUS_SEARCH, true); |
| 1041 menuState_->UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); | 1031 menuState_->UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); |
| 1042 menuState_->UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 1032 menuState_->UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
| 1043 menuState_->UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 1033 menuState_->UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
| 1044 menuState_->UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true); | 1034 menuState_->UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, true); |
| 1045 menuState_->UpdateCommandEnabled(IDC_HELP_PAGE, true); | 1035 menuState_->UpdateCommandEnabled(IDC_HELP_PAGE, true); |
| 1046 menuState_->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); | 1036 menuState_->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); |
| 1047 menuState_->UpdateCommandEnabled(IDC_FEEDBACK, true); | 1037 menuState_->UpdateCommandEnabled(IDC_FEEDBACK, true); |
| 1048 menuState_->UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, true); | 1038 menuState_->UpdateCommandEnabled(IDC_SHOW_SYNC_SETUP, true); |
| 1049 menuState_->UpdateCommandEnabled(IDC_TASK_MANAGER, true); | 1039 menuState_->UpdateCommandEnabled(IDC_TASK_MANAGER, true); |
| 1050 } | 1040 } |
| 1051 | 1041 |
| 1052 // Conditionally adds the Profile menu to the main menu bar. | 1042 // Conditionally adds the Profile menu to the main menu bar. |
| 1053 - (void)initProfileMenu { | 1043 - (void)initProfileMenu { |
| 1054 NSMenu* mainMenu = [NSApp mainMenu]; | 1044 NSMenu* mainMenu = [NSApp mainMenu]; |
| 1055 NSMenuItem* profileMenu = [mainMenu itemWithTag:IDC_PROFILE_MAIN_MENU]; | 1045 NSMenuItem* profileMenu = [mainMenu itemWithTag:IDC_PROFILE_MAIN_MENU]; |
| 1056 | 1046 |
| 1057 // On Leopard, hiding main menubar items does not work. This manifests itself | 1047 // On Leopard, hiding main menubar items does not work. This manifests itself |
| 1058 // in Chromium as squished menu items <http://crbug.com/90753>. To prevent | 1048 // in Chromium as squished menu items <http://crbug.com/90753>. To prevent |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1347 | 1337 |
| 1348 } // namespace browser | 1338 } // namespace browser |
| 1349 | 1339 |
| 1350 namespace app_controller_mac { | 1340 namespace app_controller_mac { |
| 1351 | 1341 |
| 1352 bool IsOpeningNewWindow() { | 1342 bool IsOpeningNewWindow() { |
| 1353 return g_is_opening_new_window; | 1343 return g_is_opening_new_window; |
| 1354 } | 1344 } |
| 1355 | 1345 |
| 1356 } // namespace app_controller_mac | 1346 } // namespace app_controller_mac |
| OLD | NEW |