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 #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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/sync/sync_ui_util.h" | 33 #include "chrome/browser/sync/sync_ui_util.h" |
34 #include "chrome/browser/sync/sync_ui_util_mac.h" | 34 #include "chrome/browser/sync/sync_ui_util_mac.h" |
35 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_init.h" | 36 #include "chrome/browser/ui/browser_init.h" |
37 #include "chrome/browser/ui/browser_list.h" | 37 #include "chrome/browser/ui/browser_list.h" |
38 #include "chrome/browser/ui/browser_window.h" | 38 #include "chrome/browser/ui/browser_window.h" |
39 #import "chrome/browser/ui/cocoa/about_window_controller.h" | 39 #import "chrome/browser/ui/cocoa/about_window_controller.h" |
40 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 40 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
41 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 41 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
42 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 42 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
43 #import "chrome/browser/ui/cocoa/bug_report_window_controller.h" | |
44 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 43 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
45 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | 44 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
46 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 45 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
47 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" | 46 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" |
48 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 47 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
49 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 48 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
50 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 49 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
51 #include "chrome/common/chrome_notification_types.h" | 50 #include "chrome/common/chrome_notification_types.h" |
52 #include "chrome/common/chrome_paths_internal.h" | 51 #include "chrome/common/chrome_paths_internal.h" |
53 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 if (!lastProfile) { | 735 if (!lastProfile) { |
737 LOG(WARNING) | 736 LOG(WARNING) |
738 << "NULL lastProfile detected -- not doing anything"; | 737 << "NULL lastProfile detected -- not doing anything"; |
739 break; | 738 break; |
740 } | 739 } |
741 enable = lastProfile->IsSyncAccessible() && | 740 enable = lastProfile->IsSyncAccessible() && |
742 [self keyWindowIsNotModal]; | 741 [self keyWindowIsNotModal]; |
743 sync_ui_util::UpdateSyncItem(item, enable, lastProfile); | 742 sync_ui_util::UpdateSyncItem(item, enable, lastProfile); |
744 break; | 743 break; |
745 } | 744 } |
| 745 case IDC_FEEDBACK: |
| 746 enable = NO; |
| 747 break; |
746 default: | 748 default: |
747 enable = menuState_->IsCommandEnabled(tag) ? | 749 enable = menuState_->IsCommandEnabled(tag) ? |
748 [self keyWindowIsNotModal] : NO; | 750 [self keyWindowIsNotModal] : NO; |
749 } | 751 } |
750 } | 752 } |
751 } else if (action == @selector(terminate:)) { | 753 } else if (action == @selector(terminate:)) { |
752 enable = YES; | 754 enable = YES; |
753 } else if (action == @selector(showPreferences:)) { | 755 } else if (action == @selector(showPreferences:)) { |
754 enable = YES; | 756 enable = YES; |
755 } else if (action == @selector(orderFrontStandardAboutPanel:)) { | 757 } else if (action == @selector(orderFrontStandardAboutPanel:)) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 browser->ShowExtensionsTab(); | 856 browser->ShowExtensionsTab(); |
855 else | 857 else |
856 Browser::OpenExtensionsWindow(lastProfile); | 858 Browser::OpenExtensionsWindow(lastProfile); |
857 break; | 859 break; |
858 case IDC_HELP_PAGE: | 860 case IDC_HELP_PAGE: |
859 if (Browser* browser = ActivateBrowser(lastProfile)) | 861 if (Browser* browser = ActivateBrowser(lastProfile)) |
860 browser->ShowHelpTab(); | 862 browser->ShowHelpTab(); |
861 else | 863 else |
862 Browser::OpenHelpWindow(lastProfile); | 864 Browser::OpenHelpWindow(lastProfile); |
863 break; | 865 break; |
864 case IDC_FEEDBACK: { | |
865 Browser* browser = BrowserList::GetLastActive(); | |
866 TabContents* currentTab = | |
867 browser ? browser->GetSelectedTabContents() : NULL; | |
868 BugReportWindowController* controller = | |
869 [[BugReportWindowController alloc] | |
870 initWithTabContents:currentTab | |
871 profile:[self lastProfile]]; | |
872 [controller runModalDialog]; | |
873 break; | |
874 } | |
875 case IDC_SYNC_BOOKMARKS: | 866 case IDC_SYNC_BOOKMARKS: |
876 // The profile may be NULL during shutdown -- see | 867 // The profile may be NULL during shutdown -- see |
877 // http://code.google.com/p/chromium/issues/detail?id=43048 . | 868 // http://code.google.com/p/chromium/issues/detail?id=43048 . |
878 // | 869 // |
879 // TODO(akalin,viettrungluu): Figure out whether this method can | 870 // TODO(akalin,viettrungluu): Figure out whether this method can |
880 // be prevented from being called if lastProfile is NULL. | 871 // be prevented from being called if lastProfile is NULL. |
881 if (!lastProfile) { | 872 if (!lastProfile) { |
882 LOG(WARNING) << "NULL lastProfile detected -- not doing anything"; | 873 LOG(WARNING) << "NULL lastProfile detected -- not doing anything"; |
883 break; | 874 break; |
884 } | 875 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 | 1278 |
1288 } // namespace browser | 1279 } // namespace browser |
1289 | 1280 |
1290 namespace app_controller_mac { | 1281 namespace app_controller_mac { |
1291 | 1282 |
1292 bool IsOpeningNewWindow() { | 1283 bool IsOpeningNewWindow() { |
1293 return g_is_opening_new_window; | 1284 return g_is_opening_new_window; |
1294 } | 1285 } |
1295 | 1286 |
1296 } // namespace app_controller_mac | 1287 } // namespace app_controller_mac |
OLD | NEW |