| 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 pref_proxy_config_tracker_->DetachFromPrefService(); | 747 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 748 | 748 |
| 749 if (host_content_settings_map_.get()) | 749 if (host_content_settings_map_.get()) |
| 750 host_content_settings_map_->ShutdownOnUIThread(); | 750 host_content_settings_map_->ShutdownOnUIThread(); |
| 751 | 751 |
| 752 // This causes the Preferences file to be written to disk. | 752 // This causes the Preferences file to be written to disk. |
| 753 if (prefs_loaded) | 753 if (prefs_loaded) |
| 754 SetExitType(EXIT_NORMAL); | 754 SetExitType(EXIT_NORMAL); |
| 755 } | 755 } |
| 756 | 756 |
| 757 std::string ProfileImpl::GetProfileUserName() { | 757 std::string ProfileImpl::GetProfileUserName() const { |
| 758 SigninManagerBase* signin_manager = | 758 const SigninManagerBase* signin_manager = |
| 759 SigninManagerFactory::GetForProfile(this); | 759 SigninManagerFactory::GetForProfileIfExists(this); |
| 760 if (signin_manager) | 760 if (signin_manager) |
| 761 return signin_manager->GetAuthenticatedUsername(); | 761 return signin_manager->GetAuthenticatedUsername(); |
| 762 | 762 |
| 763 return std::string(); | 763 return std::string(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 Profile::ProfileType ProfileImpl::GetProfileType() const { | 766 Profile::ProfileType ProfileImpl::GetProfileType() const { |
| 767 return REGULAR_PROFILE; | 767 return REGULAR_PROFILE; |
| 768 } | 768 } |
| 769 | 769 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 } | 932 } |
| 933 | 933 |
| 934 Profile::ExitType ProfileImpl::GetLastSessionExitType() { | 934 Profile::ExitType ProfileImpl::GetLastSessionExitType() { |
| 935 // last_session_exited_cleanly_ is set when the preferences are loaded. Force | 935 // last_session_exited_cleanly_ is set when the preferences are loaded. Force |
| 936 // it to be set by asking for the prefs. | 936 // it to be set by asking for the prefs. |
| 937 GetPrefs(); | 937 GetPrefs(); |
| 938 return last_session_exit_type_; | 938 return last_session_exit_type_; |
| 939 } | 939 } |
| 940 | 940 |
| 941 PrefService* ProfileImpl::GetPrefs() { | 941 PrefService* ProfileImpl::GetPrefs() { |
| 942 return const_cast<PrefService*>( |
| 943 static_cast<const ProfileImpl*>(this)->GetPrefs()); |
| 944 } |
| 945 |
| 946 const PrefService* ProfileImpl::GetPrefs() const { |
| 942 DCHECK(prefs_); // Should explicitly be initialized. | 947 DCHECK(prefs_); // Should explicitly be initialized. |
| 943 return prefs_.get(); | 948 return prefs_.get(); |
| 944 } | 949 } |
| 945 | 950 |
| 946 chrome::ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { | 951 chrome::ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { |
| 947 return static_cast<chrome::ChromeZoomLevelPrefs*>( | 952 return static_cast<chrome::ChromeZoomLevelPrefs*>( |
| 948 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); | 953 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 949 } | 954 } |
| 950 | 955 |
| 951 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 956 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1328 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1324 domain_reliability::DomainReliabilityService* service = | 1329 domain_reliability::DomainReliabilityService* service = |
| 1325 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1330 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1326 GetForBrowserContext(this); | 1331 GetForBrowserContext(this); |
| 1327 if (!service) | 1332 if (!service) |
| 1328 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1333 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1329 | 1334 |
| 1330 return service->CreateMonitor( | 1335 return service->CreateMonitor( |
| 1331 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1336 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1332 } | 1337 } |
| OLD | NEW |