| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/browser_main_posix.h" | 5 #include "chrome/browser/browser_main_posix.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
| 10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // If ui_task is not NULL, the app is actually a browser_test, so startup is | 93 // If ui_task is not NULL, the app is actually a browser_test, so startup is |
| 94 // handled outside of BrowserMain (which is what called this). | 94 // handled outside of BrowserMain (which is what called this). |
| 95 if (!parameters().ui_task) { | 95 if (!parameters().ui_task) { |
| 96 // The browser process only wants to support the language Cocoa will use, | 96 // The browser process only wants to support the language Cocoa will use, |
| 97 // so force the app locale to be overriden with that value. | 97 // so force the app locale to be overriden with that value. |
| 98 l10n_util::OverrideLocaleWithCocoaLocale(); | 98 l10n_util::OverrideLocaleWithCocoaLocale(); |
| 99 | 99 |
| 100 // Before we load the nib, we need to start up the resource bundle so we | 100 // Before we load the nib, we need to start up the resource bundle so we |
| 101 // have the strings avaiable for localization. | 101 // have the strings avaiable for localization. |
| 102 std::string pref_locale; | |
| 103 // TODO(markusheintz): Read preference pref::kApplicationLocale in order | 102 // TODO(markusheintz): Read preference pref::kApplicationLocale in order |
| 104 // to enforce the application locale. | 103 // to enforce the application locale. |
| 105 ResourceBundle::InitSharedInstance(pref_locale); | 104 const std::string loaded_locale = |
| 105 ResourceBundle::InitSharedInstance(std::string()); |
| 106 CHECK(!loaded_locale.empty()) << "Default locale could not be found"; |
| 106 | 107 |
| 107 FilePath resources_pack_path; | 108 FilePath resources_pack_path; |
| 108 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 109 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 109 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); | 110 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); |
| 110 } | 111 } |
| 111 | 112 |
| 112 // Now load the nib (from the right bundle). | 113 // Now load the nib (from the right bundle). |
| 113 scoped_nsobject<NSNib> | 114 scoped_nsobject<NSNib> |
| 114 nib([[NSNib alloc] initWithNibNamed:@"MainMenu" | 115 nib([[NSNib alloc] initWithNibNamed:@"MainMenu" |
| 115 bundle:mac_util::MainAppBundle()]); | 116 bundle:mac_util::MainAppBundle()]); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 141 base::EnsureNSPRInit(); | 142 base::EnsureNSPRInit(); |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 // static | 147 // static |
| 147 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 148 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
| 148 const MainFunctionParams& parameters) { | 149 const MainFunctionParams& parameters) { |
| 149 return new BrowserMainPartsMac(parameters); | 150 return new BrowserMainPartsMac(parameters); |
| 150 } | 151 } |
| OLD | NEW |