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