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

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, 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
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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 force_immediate_policy_load, 457 force_immediate_policy_load,
458 sequenced_task_runner, 458 sequenced_task_runner,
459 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 459 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
460 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 460 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
461 #endif 461 #endif
462 #endif 462 #endif
463 profile_policy_connector_ = 463 profile_policy_connector_ =
464 policy::ProfilePolicyConnectorFactory::CreateForBrowserContext( 464 policy::ProfilePolicyConnectorFactory::CreateForBrowserContext(
465 this, force_immediate_policy_load); 465 this, force_immediate_policy_load);
466 466
467 #if defined(OS_CHROMEOS)
468 chromeos::UserSessionManager::GetInstance()->OnNewProfileCreating(this);
469 #endif
470
467 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || 471 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS ||
468 create_mode == CREATE_MODE_SYNCHRONOUS); 472 create_mode == CREATE_MODE_SYNCHRONOUS);
469 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; 473 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS;
470 474
471 #if defined(OS_CHROMEOS) 475 #if defined(OS_CHROMEOS)
472 if (chromeos::ProfileHelper::IsSigninProfile(this)) 476 if (chromeos::ProfileHelper::IsSigninProfile(this))
473 chrome::RegisterLoginProfilePrefs(pref_registry_.get()); 477 chrome::RegisterLoginProfilePrefs(pref_registry_.get());
474 else 478 else
475 #endif 479 #endif
476 chrome::RegisterUserProfilePrefs(pref_registry_.get()); 480 chrome::RegisterUserProfilePrefs(pref_registry_.get());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") 842 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy")
839 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( 843 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(
840 CookieSettings::Factory::GetForProfile(this).get()); 844 CookieSettings::Factory::GetForProfile(this).get());
841 } 845 }
842 return extension_special_storage_policy_.get(); 846 return extension_special_storage_policy_.get();
843 #else 847 #else
844 return NULL; 848 return NULL;
845 #endif 849 #endif
846 } 850 }
847 851
848 void ProfileImpl::OnPrefsLoaded(bool success) { 852 void ProfileImpl::OnPrefsLoadedImpl() {
849 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
850 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime"); 853 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. 854 // Migrate obsolete prefs.
858 if (g_browser_process->local_state()) 855 if (g_browser_process->local_state())
859 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state()); 856 chrome::MigrateObsoleteBrowserPrefs(this, g_browser_process->local_state());
860 chrome::MigrateObsoleteProfilePrefs(this); 857 chrome::MigrateObsoleteProfilePrefs(this);
861 858
862 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref 859 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref
863 // value is empty fallback to checking for |kSessionExitedCleanly|. 860 // value is empty fallback to checking for |kSessionExitedCleanly|.
864 const std::string exit_type_pref_value( 861 const std::string exit_type_pref_value(
865 prefs_->GetString(prefs::kSessionExitType)); 862 prefs_->GetString(prefs::kSessionExitType));
866 if (exit_type_pref_value.empty()) { 863 if (exit_type_pref_value.empty()) {
(...skipping 27 matching lines...) Expand all
894 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver") 891 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver")
895 net_pref_observer_.reset(new NetPrefObserver(prefs_.get())); 892 net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
896 } 893 }
897 894
898 chrome_prefs::SchedulePrefsFilePathVerification(path_); 895 chrome_prefs::SchedulePrefsFilePathVerification(path_);
899 896
900 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile()); 897 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile());
901 DoFinalInit(); 898 DoFinalInit();
902 } 899 }
903 900
901 void ProfileImpl::OnPrefsLoaded(bool success) {
902 TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded");
903 if (!success) {
904 if (delegate_)
905 delegate_->OnProfileCreated(this, false, false);
906 return;
907 }
908
909 #if defined(OS_CHROMEOS)
910 if (!on_prefs_loaded_hook_.is_null()) {
911 on_prefs_loaded_hook_.Run(this, base::Bind(&ProfileImpl::OnPrefsLoadedImpl,
912 base::Unretained(this)));
913 return;
914 }
915 #endif
916 OnPrefsLoadedImpl();
917 }
918
904 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { 919 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) {
905 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); 920 Version profile_version(ChromeVersionService::GetVersion(prefs_.get()));
906 Version arg_version(version); 921 Version arg_version(version);
907 return (profile_version.CompareTo(arg_version) >= 0); 922 return (profile_version.CompareTo(arg_version) >= 0);
908 } 923 }
909 924
910 void ProfileImpl::SetExitType(ExitType exit_type) { 925 void ProfileImpl::SetExitType(ExitType exit_type) {
911 #if defined(OS_CHROMEOS) 926 #if defined(OS_CHROMEOS)
912 if (chromeos::ProfileHelper::IsSigninProfile(this)) 927 if (chromeos::ProfileHelper::IsSigninProfile(this))
913 return; 928 return;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this)); 1213 locale_change_guard_.reset(new chromeos::LocaleChangeGuard(this));
1199 locale_change_guard_->OnLogin(); 1214 locale_change_guard_->OnLogin();
1200 } 1215 }
1201 1216
1202 void ProfileImpl::InitChromeOSPreferences() { 1217 void ProfileImpl::InitChromeOSPreferences() {
1203 chromeos_preferences_.reset(new chromeos::Preferences()); 1218 chromeos_preferences_.reset(new chromeos::Preferences());
1204 chromeos_preferences_->Init( 1219 chromeos_preferences_->Init(
1205 this, chromeos::ProfileHelper::Get()->GetUserByProfile(this)); 1220 this, chromeos::ProfileHelper::Get()->GetUserByProfile(this));
1206 } 1221 }
1207 1222
1223 void ProfileImpl::SetOnPrefsLoadedHook(
1224 const base::Callback<void(Profile*, const base::Closure&)>& callback) {
1225 on_prefs_loaded_hook_ = callback;
1226 }
1208 #endif // defined(OS_CHROMEOS) 1227 #endif // defined(OS_CHROMEOS)
1209 1228
1210 PrefProxyConfigTracker* ProfileImpl::GetProxyConfigTracker() { 1229 PrefProxyConfigTracker* ProfileImpl::GetProxyConfigTracker() {
1211 if (!pref_proxy_config_tracker_) 1230 if (!pref_proxy_config_tracker_)
1212 pref_proxy_config_tracker_.reset(CreateProxyConfigTracker()); 1231 pref_proxy_config_tracker_.reset(CreateProxyConfigTracker());
1213 return pref_proxy_config_tracker_.get(); 1232 return pref_proxy_config_tracker_.get();
1214 } 1233 }
1215 1234
1216 chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() { 1235 chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() {
1217 return predictor_; 1236 return predictor_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { 1359 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
1341 domain_reliability::DomainReliabilityService* service = 1360 domain_reliability::DomainReliabilityService* service =
1342 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> 1361 domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
1343 GetForBrowserContext(this); 1362 GetForBrowserContext(this);
1344 if (!service) 1363 if (!service)
1345 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); 1364 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
1346 1365
1347 return service->CreateMonitor( 1366 return service->CreateMonitor(
1348 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1367 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1349 } 1368 }
OLDNEW
« chrome/browser/profiles/profile.h ('K') | « chrome/browser/profiles/profile_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698