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

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: Created 5 years, 8 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") 838 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy")
839 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( 839 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(
840 CookieSettings::Factory::GetForProfile(this).get()); 840 CookieSettings::Factory::GetForProfile(this).get());
841 } 841 }
842 return extension_special_storage_policy_.get(); 842 return extension_special_storage_policy_.get();
843 #else 843 #else
844 return NULL; 844 return NULL;
845 #endif 845 #endif
846 } 846 }
847 847
848 void ProfileImpl::OnPrefsLoaded(bool success) { 848 void ProfileImpl::OnLanguageSwitched() {
849 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
850 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime");
851 if (!success) {
852 if (delegate_)
853 delegate_->OnProfileCreated(this, false, false);
854 return;
855 }
856
857 // Migrate obsolete prefs. 849 // Migrate obsolete prefs.
858 if (g_browser_process->local_state()) 850 if (g_browser_process->local_state())
859 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state()); 851 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state());
860 chrome::MigrateObsoleteProfilePrefs(this); 852 chrome::MigrateObsoleteProfilePrefs(this);
861 853
862 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref 854 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref
863 // value is empty fallback to checking for |kSessionExitedCleanly|. 855 // value is empty fallback to checking for |kSessionExitedCleanly|.
864 const std::string exit_type_pref_value( 856 const std::string exit_type_pref_value(
865 prefs_->GetString(prefs::kSessionExitType)); 857 prefs_->GetString(prefs::kSessionExitType));
866 if (exit_type_pref_value.empty()) { 858 if (exit_type_pref_value.empty()) {
(...skipping 27 matching lines...) Expand all
894 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver") 886 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver")
895 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 887 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
896 } 888 }
897 889
898 chrome_prefs::SchedulePrefsFilePathVerification(path_); 890 chrome_prefs::SchedulePrefsFilePathVerification(path_);
899 891
900 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile()); 892 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile());
901 DoFinalInit(); 893 DoFinalInit();
902 } 894 }
903 895
896 void ProfileImpl::SwitchUILanguage() {
897 #if defined(OS_CHROMEOS)
898 chromeos::UserSessionManager::GetInstance()->RespectLocalePreferenceWrapper(
899 this,
900 base::Bind(&ProfileImpl::OnLanguageSwitched, base::Unretained(this)));
901 #else
902 OnLanguageSwitched();
903 #endif
904 }
905
906 void ProfileImpl::OnPrefsLoaded(bool success) {
907 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
Nikita (slow) 2015/04/02 17:37:05 As discussed, move trace event and histogram to On
Alexander Alekseev 2015/04/02 18:47:27 Let's move only histogram, as trace event should b
908 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime");
909 if (!success) {
910 if (delegate_)
911 delegate_->OnProfileCreated(this, false, false);
912 return;
913 }
914
915 SwitchUILanguage();
916 }
917
904 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { 918 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
905 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); 919 Version profile_version(ChromeVersionService::GetVersion(prefs_.get()));
906 Version arg_version(version); 920 Version arg_version(version);
907 return (profile_version.CompareTo(arg_version) >= 0); 921 return (profile_version.CompareTo(arg_version) >= 0);
908 } 922 }
909 923
910 void ProfileImpl::SetExitType(ExitType exit_type) { 924 void ProfileImpl::SetExitType(ExitType exit_type) {
911 #if defined(OS_CHROMEOS) 925 #if defined(OS_CHROMEOS)
912 if (chromeos::ProfileHelper::IsSigninProfile(this)) 926 if (chromeos::ProfileHelper::IsSigninProfile(this))
913 return; 927 return;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { 1354 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
1341 domain_reliability::DomainReliabilityService* service = 1355 domain_reliability::DomainReliabilityService* service =
1342 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1356 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1343 GetForBrowserContext(this); 1357 GetForBrowserContext(this);
1344 if (!service) 1358 if (!service)
1345 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1359 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1346 1360
1347 return service->CreateMonitor( 1361 return service->CreateMonitor(
1348 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1362 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1349 } 1363 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698