| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/browser_init.h" | 14 #include "chrome/browser/browser_init.h" |
| 15 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
| 18 #include "chrome/browser/browser_window.h" | 18 #include "chrome/browser/browser_window.h" |
| 19 #import "chrome/browser/cocoa/about_window_controller.h" | 19 #import "chrome/browser/cocoa/about_window_controller.h" |
| 20 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" | 20 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" |
| 21 #import "chrome/browser/cocoa/history_menu_bridge.h" | 21 #import "chrome/browser/cocoa/history_menu_bridge.h" |
| 22 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" | 22 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" |
| 23 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" | 23 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" |
| 24 #import "chrome/browser/cocoa/preferences_window_controller.h" | 24 #import "chrome/browser/cocoa/preferences_window_controller.h" |
| 25 #import "chrome/browser/cocoa/tab_strip_controller.h" | 25 #import "chrome/browser/cocoa/tab_strip_controller.h" |
| 26 #import "chrome/browser/cocoa/tab_window_controller.h" | 26 #import "chrome/browser/cocoa/tab_window_controller.h" |
| 27 #import "chrome/browser/cocoa/ui_localizer.h" |
| 27 #include "chrome/browser/command_updater.h" | 28 #include "chrome/browser/command_updater.h" |
| 28 #include "chrome/browser/download/download_manager.h" | 29 #include "chrome/browser/download/download_manager.h" |
| 29 #include "chrome/browser/sessions/tab_restore_service.h" | 30 #include "chrome/browser/sessions/tab_restore_service.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/common/pref_service.h" | 32 #include "chrome/common/pref_service.h" |
| 32 #include "chrome/browser/profile_manager.h" | 33 #include "chrome/browser/profile_manager.h" |
| 33 #include "chrome/common/temp_scaffolding_stubs.h" | 34 #include "chrome/common/temp_scaffolding_stubs.h" |
| 34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 35 #import "xib_localizers/main_menu_localizer.h" | |
| 36 | 36 |
| 37 @interface AppController(PRIVATE) | 37 @interface AppController(PRIVATE) |
| 38 - (void)initMenuState; | 38 - (void)initMenuState; |
| 39 - (void)openURLs:(const std::vector<GURL>&)urls; | 39 - (void)openURLs:(const std::vector<GURL>&)urls; |
| 40 - (void)openPendingURLs; | 40 - (void)openPendingURLs; |
| 41 - (void)getUrl:(NSAppleEventDescriptor*)event | 41 - (void)getUrl:(NSAppleEventDescriptor*)event |
| 42 withReply:(NSAppleEventDescriptor*)reply; | 42 withReply:(NSAppleEventDescriptor*)reply; |
| 43 - (void)openFiles:(NSAppleEventDescriptor*)event | 43 - (void)openFiles:(NSAppleEventDescriptor*)event |
| 44 withReply:(NSAppleEventDescriptor*)reply; | 44 withReply:(NSAppleEventDescriptor*)reply; |
| 45 - (void)windowLayeringDidChange:(NSNotification*)inNotification; | 45 - (void)windowLayeringDidChange:(NSNotification*)inNotification; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // will be the signal to exit. | 221 // will be the signal to exit. |
| 222 DCHECK(g_browser_process); | 222 DCHECK(g_browser_process); |
| 223 g_browser_process->AddRefModule(); | 223 g_browser_process->AddRefModule(); |
| 224 | 224 |
| 225 // TODO: move this into the MainMenu.xib once we clean up the startup order | 225 // TODO: move this into the MainMenu.xib once we clean up the startup order |
| 226 // dependencies so that works. http://crbug.com/17380 | 226 // dependencies so that works. http://crbug.com/17380 |
| 227 // Create the localizer for the main menu. We can't do this in the nib | 227 // Create the localizer for the main menu. We can't do this in the nib |
| 228 // because it's too early. Do it before we create any bookmark menus as well, | 228 // because it's too early. Do it before we create any bookmark menus as well, |
| 229 // just in case one has a title that matches any of our strings (unlikely, | 229 // just in case one has a title that matches any of our strings (unlikely, |
| 230 // but technically possible). | 230 // but technically possible). |
| 231 scoped_nsobject<MainMenuLocalizer> localizer( | 231 scoped_nsobject<ChromeUILocalizer> localizer( |
| 232 [[MainMenuLocalizer alloc] initWithBundle:nil]); | 232 [[ChromeUILocalizer alloc] initWithBundle:nil]); |
| 233 [localizer localizeObject:[NSApplication sharedApplication] | 233 [localizer localizeObject:[NSApplication sharedApplication] |
| 234 recursively:YES]; | 234 recursively:YES]; |
| 235 | 235 |
| 236 bookmarkMenuBridge_.reset(new BookmarkMenuBridge()); | 236 bookmarkMenuBridge_.reset(new BookmarkMenuBridge()); |
| 237 historyMenuBridge_.reset(new HistoryMenuBridge([self defaultProfile])); | 237 historyMenuBridge_.reset(new HistoryMenuBridge([self defaultProfile])); |
| 238 | 238 |
| 239 [self setUpdateCheckInterval]; | 239 [self setUpdateCheckInterval]; |
| 240 | 240 |
| 241 // Build up the encoding menu, the order of the items differs based on the | 241 // Build up the encoding menu, the order of the items differs based on the |
| 242 // current locale (see http://crbug.com/7647 for details). | 242 // current locale (see http://crbug.com/7647 for details). |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 name:kUserClosedAboutNotification | 625 name:kUserClosedAboutNotification |
| 626 object:aboutController_.get()]; | 626 object:aboutController_.get()]; |
| 627 } | 627 } |
| 628 if (![[aboutController_ window] isVisible]) | 628 if (![[aboutController_ window] isVisible]) |
| 629 [[aboutController_ window] center]; | 629 [[aboutController_ window] center]; |
| 630 [aboutController_ showWindow:self]; | 630 [aboutController_ showWindow:self]; |
| 631 #endif | 631 #endif |
| 632 } | 632 } |
| 633 | 633 |
| 634 @end | 634 @end |
| OLD | NEW |