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

Side by Side 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: Update after review. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") 795 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy")
796 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( 796 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(
797 CookieSettings::Factory::GetForProfile(this).get()); 797 CookieSettings::Factory::GetForProfile(this).get());
798 } 798 }
799 return extension_special_storage_policy_.get(); 799 return extension_special_storage_policy_.get();
800 #else 800 #else
801 return NULL; 801 return NULL;
802 #endif 802 #endif
803 } 803 }
804 804
805 void ProfileImpl::OnPrefsLoaded(bool success) { 805 void ProfileImpl::OnLocaleReady() {
806 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded"); 806 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnLocaleReadyTime");
807 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime");
808 if (!success) {
809 if (delegate_)
810 delegate_->OnProfileCreated(this, false, false);
811 return;
812 }
813
814 // Migrate obsolete prefs. 807 // Migrate obsolete prefs.
815 if (g_browser_process->local_state()) 808 if (g_browser_process->local_state())
816 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state()); 809 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state());
817 chrome::MigrateObsoleteProfilePrefs(this); 810 chrome::MigrateObsoleteProfilePrefs(this);
818 811
819 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref 812 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref
820 // value is empty fallback to checking for |kSessionExitedCleanly|. 813 // value is empty fallback to checking for |kSessionExitedCleanly|.
821 const std::string exit_type_pref_value( 814 const std::string exit_type_pref_value(
822 prefs_->GetString(prefs::kSessionExitType)); 815 prefs_->GetString(prefs::kSessionExitType));
823 if (exit_type_pref_value.empty()) { 816 if (exit_type_pref_value.empty()) {
(...skipping 30 matching lines...) Expand all
854 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver") 847 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver")
855 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 848 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
856 } 849 }
857 850
858 chrome_prefs::SchedulePrefsFilePathVerification(path_); 851 chrome_prefs::SchedulePrefsFilePathVerification(path_);
859 852
860 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile()); 853 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile());
861 DoFinalInit(); 854 DoFinalInit();
862 } 855 }
863 856
857 void ProfileImpl::OnPrefsLoaded(bool success) {
858 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
859 if (!success) {
860 if (delegate_)
861 delegate_->OnProfileCreated(this, false, false);
862
863 return;
864 }
865
866 #if defined(OS_CHROMEOS)
867 chromeos::UserSessionManager::GetInstance()->RespectLocalePreferenceWrapper(
868 this, base::Bind(&ProfileImpl::OnLocaleReady, base::Unretained(this)));
869 #else
870 OnLocaleReady();
871 #endif
872 }
873
864 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { 874 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
865 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); 875 Version profile_version(ChromeVersionService::GetVersion(prefs_.get()));
866 Version arg_version(version); 876 Version arg_version(version);
867 return (profile_version.CompareTo(arg_version) >= 0); 877 return (profile_version.CompareTo(arg_version) >= 0);
868 } 878 }
869 879
870 void ProfileImpl::SetExitType(ExitType exit_type) { 880 void ProfileImpl::SetExitType(ExitType exit_type) {
871 #if defined(OS_CHROMEOS) 881 #if defined(OS_CHROMEOS)
872 if (chromeos::ProfileHelper::IsSigninProfile(this)) 882 if (chromeos::ProfileHelper::IsSigninProfile(this))
873 return; 883 return;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { 1306 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
1297 domain_reliability::DomainReliabilityService* service = 1307 domain_reliability::DomainReliabilityService* service =
1298 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1308 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1299 GetForBrowserContext(this); 1309 GetForBrowserContext(this);
1300 if (!service) 1310 if (!service)
1301 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1311 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1302 1312
1303 return service->CreateMonitor( 1313 return service->CreateMonitor(
1304 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1314 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1305 } 1315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698