Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 1055863002: ChromeOS: switch UI language before apps are loaded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed CREATE_MODE_SYNCHRONOUS mode. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index a491300e25d01cb01561cd352e74275adcbc51b3..b35b76343f867c1c07f5ac76a875d9468e4350ec 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -475,11 +475,11 @@ ProfileImpl::ProfileImpl(
// (successfully or not). Note that we can use base::Unretained
// because the PrefService is owned by this class and lives on
// the same thread.
- prefs_->AddPrefInitObserver(base::Bind(&ProfileImpl::OnPrefsLoaded,
- base::Unretained(this)));
+ prefs_->AddPrefInitObserver(base::Bind(
+ &ProfileImpl::OnPrefsLoaded, base::Unretained(this), create_mode));
} else {
// Prefs were loaded synchronously so we can continue directly.
- OnPrefsLoaded(true);
+ OnPrefsLoaded(create_mode, true);
}
}
@@ -802,15 +802,8 @@ ExtensionSpecialStoragePolicy*
#endif
}
-void ProfileImpl::OnPrefsLoaded(bool success) {
- TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
- SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime");
- if (!success) {
- if (delegate_)
- delegate_->OnProfileCreated(this, false, false);
- return;
- }
-
+void ProfileImpl::OnLocaleReady() {
+ SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnLocaleReadyTime");
// Migrate obsolete prefs.
if (g_browser_process->local_state())
chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state());
@@ -861,6 +854,25 @@ void ProfileImpl::OnPrefsLoaded(bool success) {
DoFinalInit();
}
+void ProfileImpl::OnPrefsLoaded(CreateMode create_mode, bool success) {
+ TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
noms (inactive) 2015/05/05 20:53:15 nit: Did you delete `SCOPED_UMA_HISTOGRAM_TIMER("
Alexander Alekseev 2015/05/05 21:00:23 It is now replaced by SCOPED_UMA_HISTOGRAM_TIMER("
rkaplow 2015/05/05 21:07:07 if most of the time is in that (i.e. not on the On
Alexander Alekseev 2015/05/07 15:21:57 Done.
+ if (!success) {
+ if (delegate_)
+ delegate_->OnProfileCreated(this, false, false);
+
noms (inactive) 2015/05/05 20:53:15 nit: remove empty line
Alexander Alekseev 2015/05/07 15:21:57 Done.
+ return;
+ }
+
+#if defined(OS_CHROMEOS)
+ const bool synchronous = (create_mode == CREATE_MODE_SYNCHRONOUS);
+ chromeos::UserSessionManager::GetInstance()->RespectLocalePreferenceWrapper(
+ this, base::Bind(&ProfileImpl::OnLocaleReady, base::Unretained(this)),
+ synchronous);
+#else
+ OnLocaleReady();
+#endif
+}
+
bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
Version profile_version(ChromeVersionService::GetVersion(prefs_.get()));
Version arg_version(version);

Powered by Google App Engine
This is Rietveld 408576698