| 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/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 #include "chrome/common/chrome_notification_types.h" | 56 #include "chrome/common/chrome_notification_types.h" |
| 57 #include "chrome/common/chrome_paths_internal.h" | 57 #include "chrome/common/chrome_paths_internal.h" |
| 58 #include "chrome/common/chrome_switches.h" | 58 #include "chrome/common/chrome_switches.h" |
| 59 #include "chrome/common/cloud_print/cloud_print_class_mac.h" | 59 #include "chrome/common/cloud_print/cloud_print_class_mac.h" |
| 60 #include "chrome/common/mac/app_mode_common.h" | 60 #include "chrome/common/mac/app_mode_common.h" |
| 61 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
| 62 #include "chrome/common/service_messages.h" | 62 #include "chrome/common/service_messages.h" |
| 63 #include "chrome/common/url_constants.h" | 63 #include "chrome/common/url_constants.h" |
| 64 #include "content/browser/download/download_manager.h" | 64 #include "content/browser/download/download_manager.h" |
| 65 #include "content/browser/tab_contents/tab_contents.h" | 65 #include "content/browser/tab_contents/tab_contents.h" |
| 66 #include "content/browser/user_metrics.h" | |
| 67 #include "content/public/browser/browser_thread.h" | 66 #include "content/public/browser/browser_thread.h" |
| 68 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 69 #include "content/public/browser/notification_types.h" | 68 #include "content/public/browser/notification_types.h" |
| 69 #include "content/public/browser/user_metrics.h" |
| 70 #include "grit/chromium_strings.h" | 70 #include "grit/chromium_strings.h" |
| 71 #include "grit/generated_resources.h" | 71 #include "grit/generated_resources.h" |
| 72 #include "net/base/net_util.h" | 72 #include "net/base/net_util.h" |
| 73 #include "ui/base/accelerators/accelerator_cocoa.h" | 73 #include "ui/base/accelerators/accelerator_cocoa.h" |
| 74 #include "ui/base/l10n/l10n_util.h" | 74 #include "ui/base/l10n/l10n_util.h" |
| 75 #include "ui/base/l10n/l10n_util_mac.h" | 75 #include "ui/base/l10n/l10n_util_mac.h" |
| 76 | 76 |
| 77 using content::BrowserThread; | 77 using content::BrowserThread; |
| 78 using content::UserMetricsAction; |
| 78 | 79 |
| 79 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help | 80 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help |
| 80 // menu. Provide the declaration so it can be called below when building with | 81 // menu. Provide the declaration so it can be called below when building with |
| 81 // the 10.5 SDK. | 82 // the 10.5 SDK. |
| 82 #if !defined(MAC_OS_X_VERSION_10_6) || \ | 83 #if !defined(MAC_OS_X_VERSION_10_6) || \ |
| 83 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | 84 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 84 @interface NSApplication (SnowLeopardSDKDeclarations) | 85 @interface NSApplication (SnowLeopardSDKDeclarations) |
| 85 - (void)setHelpMenu:(NSMenu*)helpMenu; | 86 - (void)setHelpMenu:(NSMenu*)helpMenu; |
| 86 @end | 87 @end |
| 87 #endif | 88 #endif |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 818 } |
| 818 case IDC_IMPORT_SETTINGS: { | 819 case IDC_IMPORT_SETTINGS: { |
| 819 if (Browser* browser = ActivateBrowser(lastProfile)) { | 820 if (Browser* browser = ActivateBrowser(lastProfile)) { |
| 820 browser->OpenImportSettingsDialog(); | 821 browser->OpenImportSettingsDialog(); |
| 821 } else { | 822 } else { |
| 822 Browser::OpenImportSettingsDialogWindow(lastProfile); | 823 Browser::OpenImportSettingsDialogWindow(lastProfile); |
| 823 } | 824 } |
| 824 break; | 825 break; |
| 825 } | 826 } |
| 826 case IDC_SHOW_BOOKMARK_MANAGER: | 827 case IDC_SHOW_BOOKMARK_MANAGER: |
| 827 UserMetrics::RecordAction(UserMetricsAction("ShowBookmarkManager")); | 828 content::RecordAction(UserMetricsAction("ShowBookmarkManager")); |
| 828 if (Browser* browser = ActivateBrowser(lastProfile)) { | 829 if (Browser* browser = ActivateBrowser(lastProfile)) { |
| 829 // Open a bookmark manager tab. | 830 // Open a bookmark manager tab. |
| 830 browser->OpenBookmarkManager(); | 831 browser->OpenBookmarkManager(); |
| 831 } else { | 832 } else { |
| 832 // No browser window, so create one for the bookmark manager tab. | 833 // No browser window, so create one for the bookmark manager tab. |
| 833 Browser::OpenBookmarkManagerWindow(lastProfile); | 834 Browser::OpenBookmarkManagerWindow(lastProfile); |
| 834 } | 835 } |
| 835 break; | 836 break; |
| 836 case IDC_SHOW_HISTORY: | 837 case IDC_SHOW_HISTORY: |
| 837 if (Browser* browser = ActivateBrowser(lastProfile)) | 838 if (Browser* browser = ActivateBrowser(lastProfile)) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 867 LOG(WARNING) << "NULL lastProfile detected -- not doing anything"; | 868 LOG(WARNING) << "NULL lastProfile detected -- not doing anything"; |
| 868 break; | 869 break; |
| 869 } | 870 } |
| 870 // TODO(akalin): Add a constant to denote starting sync from the | 871 // TODO(akalin): Add a constant to denote starting sync from the |
| 871 // main menu and use that instead of START_FROM_WRENCH. | 872 // main menu and use that instead of START_FROM_WRENCH. |
| 872 sync_ui_util::OpenSyncMyBookmarksDialog( | 873 sync_ui_util::OpenSyncMyBookmarksDialog( |
| 873 lastProfile, ActivateBrowser(lastProfile), | 874 lastProfile, ActivateBrowser(lastProfile), |
| 874 ProfileSyncService::START_FROM_WRENCH); | 875 ProfileSyncService::START_FROM_WRENCH); |
| 875 break; | 876 break; |
| 876 case IDC_TASK_MANAGER: | 877 case IDC_TASK_MANAGER: |
| 877 UserMetrics::RecordAction(UserMetricsAction("TaskManager")); | 878 content::RecordAction(UserMetricsAction("TaskManager")); |
| 878 TaskManagerMac::Show(false); | 879 TaskManagerMac::Show(false); |
| 879 break; | 880 break; |
| 880 case IDC_OPTIONS: | 881 case IDC_OPTIONS: |
| 881 [self showPreferences:sender]; | 882 [self showPreferences:sender]; |
| 882 break; | 883 break; |
| 883 default: | 884 default: |
| 884 // Background Applications use dynamic values that must be less than the | 885 // Background Applications use dynamic values that must be less than the |
| 885 // smallest value among the predefined IDC_* labels. | 886 // smallest value among the predefined IDC_* labels. |
| 886 if ([sender tag] < IDC_MinimumLabelValue) | 887 if ([sender tag] < IDC_MinimumLabelValue) |
| 887 [self executeApplication:sender]; | 888 [self executeApplication:sender]; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 | 1280 |
| 1280 } // namespace browser | 1281 } // namespace browser |
| 1281 | 1282 |
| 1282 namespace app_controller_mac { | 1283 namespace app_controller_mac { |
| 1283 | 1284 |
| 1284 bool IsOpeningNewWindow() { | 1285 bool IsOpeningNewWindow() { |
| 1285 return g_is_opening_new_window; | 1286 return g_is_opening_new_window; |
| 1286 } | 1287 } |
| 1287 | 1288 |
| 1288 } // namespace app_controller_mac | 1289 } // namespace app_controller_mac |
| OLD | NEW |