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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/browser_init.h" | 12 #include "chrome/browser/browser_init.h" |
13 #include "chrome/browser/browser_list.h" | 13 #include "chrome/browser/browser_list.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
17 #import "chrome/browser/cocoa/about_window_controller.h" | 17 #import "chrome/browser/cocoa/about_window_controller.h" |
18 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" | 18 #import "chrome/browser/cocoa/bookmark_menu_bridge.h" |
19 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" | 19 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" |
20 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" | 20 #import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h" |
21 #import "chrome/browser/cocoa/menu_localizer.h" | |
22 #import "chrome/browser/cocoa/preferences_window_controller.h" | 21 #import "chrome/browser/cocoa/preferences_window_controller.h" |
23 #import "chrome/browser/cocoa/tab_strip_controller.h" | 22 #import "chrome/browser/cocoa/tab_strip_controller.h" |
24 #import "chrome/browser/cocoa/tab_window_controller.h" | 23 #import "chrome/browser/cocoa/tab_window_controller.h" |
25 #include "chrome/browser/command_updater.h" | 24 #include "chrome/browser/command_updater.h" |
26 #include "chrome/browser/sessions/tab_restore_service.h" | 25 #include "chrome/browser/sessions/tab_restore_service.h" |
27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/pref_service.h" | 27 #include "chrome/common/pref_service.h" |
29 #include "chrome/browser/profile_manager.h" | 28 #include "chrome/browser/profile_manager.h" |
30 #include "chrome/common/temp_scaffolding_stubs.h" | 29 #include "chrome/common/temp_scaffolding_stubs.h" |
| 30 #import "xib_localizers/main_menu_localizer.h" |
31 | 31 |
32 @interface AppController(PRIVATE) | 32 @interface AppController(PRIVATE) |
33 - (void)initMenuState; | 33 - (void)initMenuState; |
34 - (void)openURLs:(const std::vector<GURL>&)urls; | 34 - (void)openURLs:(const std::vector<GURL>&)urls; |
35 - (void)openPendingURLs; | 35 - (void)openPendingURLs; |
36 - (void)getUrl:(NSAppleEventDescriptor*)event | 36 - (void)getUrl:(NSAppleEventDescriptor*)event |
37 withReply:(NSAppleEventDescriptor*)reply; | 37 withReply:(NSAppleEventDescriptor*)reply; |
38 - (void)openFiles:(NSAppleEventDescriptor*)event | 38 - (void)openFiles:(NSAppleEventDescriptor*)event |
39 withReply:(NSAppleEventDescriptor*)reply; | 39 withReply:(NSAppleEventDescriptor*)reply; |
40 - (void)windowLayeringDidChange:(NSNotification*)inNotification; | 40 - (void)windowLayeringDidChange:(NSNotification*)inNotification; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 // This is called after profiles have been loaded and preferences registered. | 209 // This is called after profiles have been loaded and preferences registered. |
210 // It is safe to access the default profile here. | 210 // It is safe to access the default profile here. |
211 - (void)applicationDidFinishLaunching:(NSNotification*)notify { | 211 - (void)applicationDidFinishLaunching:(NSNotification*)notify { |
212 // Hold an extra ref to the BrowserProcess singleton so it doesn't go away | 212 // Hold an extra ref to the BrowserProcess singleton so it doesn't go away |
213 // when all the browser windows get closed. We'll release it on quit which | 213 // when all the browser windows get closed. We'll release it on quit which |
214 // will be the signal to exit. | 214 // will be the signal to exit. |
215 DCHECK(g_browser_process); | 215 DCHECK(g_browser_process); |
216 g_browser_process->AddRefModule(); | 216 g_browser_process->AddRefModule(); |
217 | 217 |
| 218 // TODO: move this into the MainMenu.xib once we clean up the startup order |
| 219 // dependencies so that works. http://crbug.com/17380 |
218 // Create the localizer for the main menu. We can't do this in the nib | 220 // Create the localizer for the main menu. We can't do this in the nib |
219 // because it's too early. Do it before we create any bookmark menus as well, | 221 // because it's too early. Do it before we create any bookmark menus as well, |
220 // just in case one has a title that matches any of our strings (unlikely, | 222 // just in case one has a title that matches any of our strings (unlikely, |
221 // but technically possible). | 223 // but technically possible). |
222 scoped_nsobject<MenuLocalizer> localizer( | 224 scoped_nsobject<MainMenuLocalizer> localizer( |
223 [[MenuLocalizer alloc] initWithBundle:nil]); | 225 [[MainMenuLocalizer alloc] initWithBundle:nil]); |
224 [localizer localizeObject:[NSApplication sharedApplication] | 226 [localizer localizeObject:[NSApplication sharedApplication] |
225 recursively:YES]; | 227 recursively:YES]; |
226 | 228 |
227 bookmarkMenuBridge_.reset(new BookmarkMenuBridge()); | 229 bookmarkMenuBridge_.reset(new BookmarkMenuBridge()); |
228 | 230 |
229 [self setUpdateCheckInterval]; | 231 [self setUpdateCheckInterval]; |
230 | 232 |
231 // Build up the encoding menu, the order of the items differs based on the | 233 // Build up the encoding menu, the order of the items differs based on the |
232 // current locale (see http://crbug.com/7647 for details). | 234 // current locale (see http://crbug.com/7647 for details). |
233 // We need a valid g_browser_process to get the profile which is why we can't | 235 // We need a valid g_browser_process to get the profile which is why we can't |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 name:kUserClosedAboutNotification | 526 name:kUserClosedAboutNotification |
525 object:aboutController_.get()]; | 527 object:aboutController_.get()]; |
526 } | 528 } |
527 if (![[aboutController_ window] isVisible]) | 529 if (![[aboutController_ window] isVisible]) |
528 [[aboutController_ window] center]; | 530 [[aboutController_ window] center]; |
529 [aboutController_ showWindow:self]; | 531 [aboutController_ showWindow:self]; |
530 #endif | 532 #endif |
531 } | 533 } |
532 | 534 |
533 @end | 535 @end |
OLD | NEW |