Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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"); | |
| 807 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime"); | 806 SCOPED_UMA_HISTOGRAM_TIMER("Profile.OnPrefsLoadedTime"); |
|
robliao
2015/04/30 06:50:13
Should this timer label be updated?
Alexander Alekseev
2015/04/30 19:35:26
Done.
| |
| 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 Loading... | |
| 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 return; | |
|
robliao
2015/04/30 06:50:13
This return needs an extra linebreak above it.
Alexander Alekseev
2015/04/30 19:35:26
Done.
| |
| 863 } | |
| 864 | |
| 865 #if defined(OS_CHROMEOS) | |
| 866 chromeos::UserSessionManager::GetInstance()->RespectLocalePreferenceWrapper( | |
| 867 this, base::Bind(&ProfileImpl::OnLocaleReady, base::Unretained(this))); | |
| 868 #else | |
| 869 OnLocaleReady(); | |
| 870 #endif | |
| 871 } | |
| 872 | |
| 864 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { | 873 bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { |
| 865 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); | 874 Version profile_version(ChromeVersionService::GetVersion(prefs_.get())); |
| 866 Version arg_version(version); | 875 Version arg_version(version); |
| 867 return (profile_version.CompareTo(arg_version) >= 0); | 876 return (profile_version.CompareTo(arg_version) >= 0); |
| 868 } | 877 } |
| 869 | 878 |
| 870 void ProfileImpl::SetExitType(ExitType exit_type) { | 879 void ProfileImpl::SetExitType(ExitType exit_type) { |
| 871 #if defined(OS_CHROMEOS) | 880 #if defined(OS_CHROMEOS) |
| 872 if (chromeos::ProfileHelper::IsSigninProfile(this)) | 881 if (chromeos::ProfileHelper::IsSigninProfile(this)) |
| 873 return; | 882 return; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1305 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1297 domain_reliability::DomainReliabilityService* service = | 1306 domain_reliability::DomainReliabilityService* service = |
| 1298 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1307 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1299 GetForBrowserContext(this); | 1308 GetForBrowserContext(this); |
| 1300 if (!service) | 1309 if (!service) |
| 1301 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1310 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1302 | 1311 |
| 1303 return service->CreateMonitor( | 1312 return service->CreateMonitor( |
| 1304 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1313 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1305 } | 1314 } |
| OLD | NEW |