| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | 100 #include "chrome/browser/chromeos/enterprise_extension_observer.h" |
| 101 #include "chrome/browser/chromeos/locale_change_guard.h" | 101 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 102 #include "chrome/browser/chromeos/login/user_manager.h" | 102 #include "chrome/browser/chromeos/login/user_manager.h" |
| 103 #include "chrome/browser/chromeos/preferences.h" | 103 #include "chrome/browser/chromeos/preferences.h" |
| 104 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 104 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 using base::Time; | 107 using base::Time; |
| 108 using base::TimeDelta; | 108 using base::TimeDelta; |
| 109 using content::BrowserThread; | 109 using content::BrowserThread; |
| 110 using content::DownloadManager; | 110 using content::DownloadManagerDelegate; |
| 111 using content::HostZoomMap; | 111 using content::HostZoomMap; |
| 112 using content::UserMetricsAction; | 112 using content::UserMetricsAction; |
| 113 | 113 |
| 114 namespace { | 114 namespace { |
| 115 | 115 |
| 116 // Constrict us to a very specific platform and architecture to make sure | 116 // Constrict us to a very specific platform and architecture to make sure |
| 117 // ifdefs don't cause problems with the check. | 117 // ifdefs don't cause problems with the check. |
| 118 #if defined(OS_LINUX) && defined(TOOLKIT_GTK) && defined(ARCH_CPU_X86_64) | 118 #if defined(OS_LINUX) && defined(TOOLKIT_GTK) && defined(ARCH_CPU_X86_64) |
| 119 // Make sure that the ProfileImpl doesn't grow. We're currently trying to drive | 119 // Make sure that the ProfileImpl doesn't grow. We're currently trying to drive |
| 120 // the number of services that are included in ProfileImpl (instead of using | 120 // the number of services that are included in ProfileImpl (instead of using |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 history::ShortcutsBackend* ProfileImpl::GetShortcutsBackend() { | 824 history::ShortcutsBackend* ProfileImpl::GetShortcutsBackend() { |
| 825 // This is called on one thread only - UI, so no magic is needed to protect | 825 // This is called on one thread only - UI, so no magic is needed to protect |
| 826 // against the multiple concurrent calls. | 826 // against the multiple concurrent calls. |
| 827 if (!shortcuts_backend_.get()) { | 827 if (!shortcuts_backend_.get()) { |
| 828 shortcuts_backend_ = new history::ShortcutsBackend(GetPath(), this); | 828 shortcuts_backend_ = new history::ShortcutsBackend(GetPath(), this); |
| 829 CHECK(shortcuts_backend_->Init()); | 829 CHECK(shortcuts_backend_->Init()); |
| 830 } | 830 } |
| 831 return shortcuts_backend_.get(); | 831 return shortcuts_backend_.get(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 DownloadManager* ProfileImpl::GetDownloadManager() { | 834 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { |
| 835 return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager(); | 835 return DownloadServiceFactory::GetForProfile(this)-> |
| 836 GetDownloadManagerDelegate(); |
| 836 } | 837 } |
| 837 | 838 |
| 838 bool ProfileImpl::DidLastSessionExitCleanly() { | 839 bool ProfileImpl::DidLastSessionExitCleanly() { |
| 839 // last_session_exited_cleanly_ is set when the preferences are loaded. Force | 840 // last_session_exited_cleanly_ is set when the preferences are loaded. Force |
| 840 // it to be set by asking for the prefs. | 841 // it to be set by asking for the prefs. |
| 841 GetPrefs(); | 842 GetPrefs(); |
| 842 return last_session_exited_cleanly_; | 843 return last_session_exited_cleanly_; |
| 843 } | 844 } |
| 844 | 845 |
| 845 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { | 846 quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 if (!path.empty()) | 1152 if (!path.empty()) |
| 1152 *cache_path = path; | 1153 *cache_path = path; |
| 1153 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1154 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1154 prefs_->GetInteger(prefs::kDiskCacheSize); | 1155 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1155 } | 1156 } |
| 1156 | 1157 |
| 1157 base::Callback<ChromeURLDataManagerBackend*(void)> | 1158 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1158 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1159 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1159 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1160 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1160 } | 1161 } |
| OLD | NEW |