| Index: chrome/browser/app_controller_mac.mm
|
| diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
|
| index bde0867539e61cab5632574f5851f19c46d14e7f..acd7a72b2df47edcb826274a2293783c008a231a 100644
|
| --- a/chrome/browser/app_controller_mac.mm
|
| +++ b/chrome/browser/app_controller_mac.mm
|
| @@ -17,6 +17,7 @@
|
| #include "chrome/browser/browser_shutdown.h"
|
| #include "chrome/browser/command_updater.h"
|
| #include "chrome/browser/download/download_manager.h"
|
| +#include "chrome/browser/fonts_languages_window.h"
|
| #include "chrome/browser/metrics/user_metrics.h"
|
| #include "chrome/browser/printing/print_job_manager.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| @@ -33,12 +34,10 @@
|
| #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
|
| #import "chrome/browser/ui/cocoa/browser_window_controller.h"
|
| #import "chrome/browser/ui/cocoa/bug_report_window_controller.h"
|
| -#import "chrome/browser/ui/cocoa/clear_browsing_data_controller.h"
|
| #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h"
|
| #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h"
|
| #import "chrome/browser/ui/cocoa/history_menu_bridge.h"
|
| #import "chrome/browser/ui/cocoa/importer/import_dialog_cocoa.h"
|
| -#import "chrome/browser/ui/cocoa/options/preferences_window_controller.h"
|
| #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
|
| #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h"
|
| #include "chrome/browser/ui/cocoa/task_manager_mac.h"
|
| @@ -151,9 +150,6 @@ void RecordLastRunAppBundlePath() {
|
| - (void)checkForAnyKeyWindows;
|
| - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount;
|
| - (BOOL)shouldQuitWithInProgressDownloads;
|
| -- (void)showPreferencesWindow:(id)sender
|
| - page:(OptionsPage)page
|
| - profile:(Profile*)profile;
|
| - (void)executeApplication:(id)sender;
|
| @end
|
|
|
| @@ -762,32 +758,18 @@ void RecordLastRunAppBundlePath() {
|
| break;
|
| case IDC_CLEAR_BROWSING_DATA: {
|
| // There may not be a browser open, so use the default profile.
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableTabbedOptions)) {
|
| - [ClearBrowsingDataController
|
| - showClearBrowsingDialogForProfile:defaultProfile];
|
| + if (Browser* browser = ActivateBrowser(defaultProfile)) {
|
| + browser->OpenClearBrowsingDataDialog();
|
| } else {
|
| - if (Browser* browser = ActivateBrowser(defaultProfile)) {
|
| - browser->OpenClearBrowsingDataDialog();
|
| - } else {
|
| - Browser::OpenClearBrowingDataDialogWindow(defaultProfile);
|
| - }
|
| + Browser::OpenClearBrowingDataDialogWindow(defaultProfile);
|
| }
|
| break;
|
| }
|
| case IDC_IMPORT_SETTINGS: {
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableTabbedOptions)) {
|
| - UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg"),
|
| - defaultProfile);
|
| - [ImportDialogController
|
| - showImportSettingsDialogForProfile:defaultProfile];
|
| + if (Browser* browser = ActivateBrowser(defaultProfile)) {
|
| + browser->OpenImportSettingsDialog();
|
| } else {
|
| - if (Browser* browser = ActivateBrowser(defaultProfile)) {
|
| - browser->OpenImportSettingsDialog();
|
| - } else {
|
| - Browser::OpenImportSettingsDialogWindow(defaultProfile);
|
| - }
|
| + Browser::OpenImportSettingsDialogWindow(defaultProfile);
|
| }
|
| break;
|
| }
|
| @@ -1033,57 +1015,16 @@ void RecordLastRunAppBundlePath() {
|
| [sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
|
| }
|
|
|
| -// Called when the preferences window is closed. We use this to release the
|
| -// window controller.
|
| -- (void)prefsWindowClosed:(NSNotification*)notification {
|
| - NSWindow* window = [prefsController_ window];
|
| - DCHECK_EQ([notification object], window);
|
| - NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
|
| - [defaultCenter removeObserver:self
|
| - name:NSWindowWillCloseNotification
|
| - object:window];
|
| - // PreferencesWindowControllers are autoreleased in
|
| - // -[PreferencesWindowController windowWillClose:].
|
| - prefsController_ = nil;
|
| -}
|
| -
|
| // Show the preferences window, or bring it to the front if it's already
|
| // visible.
|
| - (IBAction)showPreferences:(id)sender {
|
| - const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
|
| - if (!parsed_command_line.HasSwitch(switches::kDisableTabbedOptions)) {
|
| - if (Browser* browser = ActivateBrowser([self defaultProfile])) {
|
| - // Show options tab in the active browser window.
|
| - browser->OpenOptionsDialog();
|
| - } else {
|
| - // No browser window, so create one for the options tab.
|
| - Browser::OpenOptionsWindow([self defaultProfile]);
|
| - }
|
| - } else {
|
| - [self showPreferencesWindow:sender
|
| - page:OPTIONS_PAGE_DEFAULT
|
| - profile:[self defaultProfile]];
|
| - }
|
| -}
|
| -
|
| -- (void)showPreferencesWindow:(id)sender
|
| - page:(OptionsPage)page
|
| - profile:(Profile*)profile {
|
| - if (prefsController_) {
|
| - [prefsController_ switchToPage:page animate:YES];
|
| + if (Browser* browser = ActivateBrowser([self defaultProfile])) {
|
| + // Show options tab in the active browser window.
|
| + browser->OpenOptionsDialog();
|
| } else {
|
| - prefsController_ =
|
| - [[PreferencesWindowController alloc] initWithProfile:profile
|
| - initialPage:page];
|
| - // Watch for a notification of when it goes away so that we can destroy
|
| - // the controller.
|
| - [[NSNotificationCenter defaultCenter]
|
| - addObserver:self
|
| - selector:@selector(prefsWindowClosed:)
|
| - name:NSWindowWillCloseNotification
|
| - object:[prefsController_ window]];
|
| + // No browser window, so create one for the options tab.
|
| + Browser::OpenOptionsWindow([self defaultProfile]);
|
| }
|
| - [prefsController_ showPreferences:sender];
|
| }
|
|
|
| // Called when the about window is closed. We use this to release the
|
| @@ -1198,9 +1139,28 @@ void RecordLastRunAppBundlePath() {
|
| void ShowOptionsWindow(OptionsPage page,
|
| OptionsGroup highlight_group,
|
| Profile* profile) {
|
| + const char* theSwitch = switches::kDisableTabbedOptions;
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(theSwitch)) {
|
| + NSRunCriticalAlertPanel(
|
| + @"Ooops! No preferences!",
|
| + [NSString stringWithFormat:@"You launched chrome with --%s, which "
|
| + @"disables the Preferences system. Did you really mean to do that? "
|
| + @"You should relaunch without that flag if you want to change "
|
| + @"settings.", theSwitch],
|
| + @"OK",
|
| + nil,
|
| + nil);
|
| + return;
|
| + }
|
| // TODO(akalin): Use highlight_group.
|
| AppController* appController = [NSApp delegate];
|
| - [appController showPreferencesWindow:nil page:page profile:profile];
|
| + [appController showPreferences:nil];
|
| +}
|
| +
|
| +void ShowFontsLanguagesWindow(gfx::NativeWindow window,
|
| + FontsLanguagesPage page,
|
| + Profile* profile) {
|
| + NOTIMPLEMENTED();
|
| }
|
|
|
| namespace app_controller_mac {
|
|
|