Chromium Code Reviews| 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.h" | 5 #include "chrome/browser/browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 bool local_state_file_exists = file_util::PathExists(local_state_path); | 607 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 608 | 608 |
| 609 // Load local state. This includes the application locale so we know which | 609 // Load local state. This includes the application locale so we know which |
| 610 // locale dll to load. | 610 // locale dll to load. |
| 611 PrefService* local_state = g_browser_process->local_state(); | 611 PrefService* local_state = g_browser_process->local_state(); |
| 612 DCHECK(local_state); | 612 DCHECK(local_state); |
| 613 | 613 |
| 614 // Initialize ResourceBundle which handles files loaded from external | 614 // Initialize ResourceBundle which handles files loaded from external |
| 615 // sources. This has to be done before uninstall code path and before prefs | 615 // sources. This has to be done before uninstall code path and before prefs |
| 616 // are registered. | 616 // are registered. |
| 617 local_state->RegisterStringPref(prefs::kApplicationLocale, ""); | 617 local_state->RegisterStringPref(prefs::kApplicationLocale, |
| 618 std::string()); | |
| 618 #if !defined(OS_CHROMEOS) | 619 #if !defined(OS_CHROMEOS) |
| 619 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, | 620 local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled, |
| 620 GoogleUpdateSettings::GetCollectStatsConsent()); | 621 GoogleUpdateSettings::GetCollectStatsConsent()); |
| 621 #endif // !defined(OS_CHROMEOS) | 622 #endif // !defined(OS_CHROMEOS) |
| 622 | 623 |
| 623 if (is_first_run) { | 624 if (is_first_run) { |
| 624 #if defined(OS_WIN) | 625 #if defined(OS_WIN) |
| 625 // During first run we read the google_update registry key to find what | 626 // During first run we read the google_update registry key to find what |
| 626 // language the user selected when downloading the installer. This | 627 // language the user selected when downloading the installer. This |
| 627 // becomes our default language in the prefs. | 628 // becomes our default language in the prefs. |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1143 g_browser_process->SetApplicationLocale("en-US"); | 1144 g_browser_process->SetApplicationLocale("en-US"); |
| 1144 } else { | 1145 } else { |
| 1145 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is | 1146 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is |
| 1146 // needed when loading the MainMenu.nib and the language doesn't depend on | 1147 // needed when loading the MainMenu.nib and the language doesn't depend on |
| 1147 // anything since it comes from Cocoa. | 1148 // anything since it comes from Cocoa. |
| 1148 #if defined(OS_MACOSX) | 1149 #if defined(OS_MACOSX) |
| 1149 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride()); | 1150 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride()); |
| 1150 #else | 1151 #else |
| 1151 // On a POSIX OS other than ChromeOS, the parameter that is passed to the | 1152 // On a POSIX OS other than ChromeOS, the parameter that is passed to the |
| 1152 // method InitSharedInstance is ignored. | 1153 // method InitSharedInstance is ignored. |
| 1153 std::string app_locale = ResourceBundle::InitSharedInstance( | 1154 std::string locale = local_state->GetString(prefs::kApplicationLocale); |
| 1154 local_state->GetString(prefs::kApplicationLocale)); | 1155 const std::string res = ResourceBundle::InitSharedInstance(locale); |
|
Peter Kasting
2010/12/21 18:35:58
Nit: Same nits
glotov
2010/12/21 20:33:34
Done.
| |
| 1155 g_browser_process->SetApplicationLocale(app_locale); | 1156 CHECK(!res.empty()) << "Locale could not be found for " << locale; |
| 1157 g_browser_process->SetApplicationLocale(res); | |
| 1156 | 1158 |
| 1157 FilePath resources_pack_path; | 1159 FilePath resources_pack_path; |
| 1158 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 1160 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| 1159 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); | 1161 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); |
| 1160 #endif // !defined(OS_MACOSX) | 1162 #endif // !defined(OS_MACOSX) |
| 1161 } | 1163 } |
| 1162 | 1164 |
| 1163 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 1165 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 1164 // gdk_pixbuf_loader_write always fails on chromeos device. | 1166 // gdk_pixbuf_loader_write always fails on chromeos device. |
| 1165 // Disabling for chromeos as well because chromeos is not using them. | 1167 // Disabling for chromeos as well because chromeos is not using them. |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1724 #if defined(OS_CHROMEOS) | 1726 #if defined(OS_CHROMEOS) |
| 1725 // To be precise, logout (browser shutdown) is not yet done, but the | 1727 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1726 // remaining work is negligible, hence we say LogoutDone here. | 1728 // remaining work is negligible, hence we say LogoutDone here. |
| 1727 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1729 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1728 false); | 1730 false); |
| 1729 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1731 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1730 #endif | 1732 #endif |
| 1731 TRACE_EVENT_END("BrowserMain", 0, 0); | 1733 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1732 return result_code; | 1734 return result_code; |
| 1733 } | 1735 } |
| OLD | NEW |