diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/app_controller_mac.mm | 12 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 21 | ||||
-rw-r--r-- | chrome/browser/browser_main_mac.mm | 13 |
3 files changed, 27 insertions, 19 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 40ccaad..ccec4f9 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -26,7 +26,6 @@ #import "chrome/browser/cocoa/preferences_window_controller.h" #import "chrome/browser/cocoa/tab_strip_controller.h" #import "chrome/browser/cocoa/tab_window_controller.h" -#import "chrome/browser/cocoa/ui_localizer.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -264,17 +263,6 @@ DCHECK(g_browser_process); g_browser_process->AddRefModule(); - // TODO: move this into the MainMenu.xib once we clean up the startup order - // dependencies so that works. http://crbug.com/17380 - // Create the localizer for the main menu. We can't do this in the nib - // because it's too early. Do it before we create any bookmark menus as well, - // just in case one has a title that matches any of our strings (unlikely, - // but technically possible). - scoped_nsobject<ChromeUILocalizer> localizer( - [[ChromeUILocalizer alloc] initWithBundle:nil]); - [localizer localizeObject:[NSApplication sharedApplication] - recursively:YES]; - bookmarkMenuBridge_.reset(new BookmarkMenuBridge()); historyMenuBridge_.reset(new HistoryMenuBridge([self defaultProfile])); diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 560fc54..3501779 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -118,13 +118,13 @@ namespace Platform { -void WillInitializeMainMessageLoop(const CommandLine & command_line); +void WillInitializeMainMessageLoop(const MainFunctionParams& parameters); void WillTerminate(); #if defined(OS_WIN) || defined(OS_LINUX) // Perform any platform-specific work that needs to be done before the main // message loop is created and initialized. -void WillInitializeMainMessageLoop(const CommandLine & command_line) { +void WillInitializeMainMessageLoop(const MainFunctionParams& parameters) { } // Perform platform-specific work that needs to be done after the main event @@ -299,7 +299,7 @@ int BrowserMain(const MainFunctionParams& parameters) { // Do platform-specific things (such as finishing initializing Cocoa) // prior to instantiating the message loop. This could be turned into a // broadcast notification. - Platform::WillInitializeMainMessageLoop(parsed_command_line); + Platform::WillInitializeMainMessageLoop(parameters); MessageLoop main_message_loop(MessageLoop::TYPE_UI); @@ -392,13 +392,17 @@ int BrowserMain(const MainFunctionParams& parameters) { #endif - // During first run we read the google_update registry key to find what - // language the user selected when downloading the installer. This - // becomes our default language in the prefs. if (is_first_run) { +#if !defined(OS_MACOSX) + // During first run we read the google_update registry key to find what + // language the user selected when downloading the installer. This + // becomes our default language in the prefs. + // Mac doesn't need this because it is always using language that Cocoa + // selected from the user's language list (in System Preferences). std::wstring install_lang; if (GoogleUpdateSettings::GetLanguage(&install_lang)) local_state->SetString(prefs::kApplicationLocale, install_lang); +#endif // defined(OS_MACOSX) if (GoogleUpdateSettings::GetCollectStatsConsent()) local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); } @@ -427,12 +431,17 @@ int BrowserMain(const MainFunctionParams& parameters) { // If we're running tests (ui_task is non-null), then the ResourceBundle // has already been initialized. + // Mac starts it earlier in Platform::WillInitializeMainMessageLoop (because + // it is needed when loading the MainMenu.nib and the language doesn't depend + // on anything since it comes from Cocoa. +#if !defined(OS_MACOSX) if (!parameters.ui_task) { ResourceBundle::InitSharedInstance( local_state->GetString(prefs::kApplicationLocale)); // We only load the theme dll in the browser process. ResourceBundle::GetSharedInstance().LoadThemeResources(); } +#endif // !defined(OS_MACOSX) #if defined(OS_WIN) // This is experimental code. See first_run_win.cc for more info. diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm index b532742..d3041cc 100644 --- a/chrome/browser/browser_main_mac.mm +++ b/chrome/browser/browser_main_mac.mm @@ -3,9 +3,11 @@ // found in the LICENSE file. #import <Cocoa/Cocoa.h> +#include "app/resource_bundle.h" #include "base/command_line.h" #import "chrome/app/keystone_glue.h" #include "chrome/browser/browser_main_win.h" +#include "chrome/common/main_function_params.h" #include "chrome/common/result_codes.h" namespace Platform { @@ -20,8 +22,17 @@ namespace Platform { // load the main nib directly. The main event loop is run from common code using // the MessageLoop API, which works out ok for us because it's a wrapper around // CFRunLoop. -void WillInitializeMainMessageLoop(const CommandLine& command_line) { +void WillInitializeMainMessageLoop(const MainFunctionParams& parameters) { [NSApplication sharedApplication]; + // Before we load the nib, we need to start up the resource bundle so we have + // the strings avaiable for localization. + if (!parameters.ui_task) { + ResourceBundle::InitSharedInstance(std::wstring()); + // We only load the theme resources in the browser process, since this is + // the browser process, load them. + ResourceBundle::GetSharedInstance().LoadThemeResources(); + } + // Now load the nib. [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; // This is a no-op if the KeystoneRegistration framework is not present. |