| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 #include "components/pref_registry/pref_registry_syncable.h" | 103 #include "components/pref_registry/pref_registry_syncable.h" |
| 104 #include "components/prefs/json_pref_store.h" | 104 #include "components/prefs/json_pref_store.h" |
| 105 #include "components/prefs/scoped_user_pref_update.h" | 105 #include "components/prefs/scoped_user_pref_update.h" |
| 106 #include "components/proxy_config/pref_proxy_config_tracker.h" | 106 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 107 #include "components/signin/core/browser/signin_manager.h" | 107 #include "components/signin/core/browser/signin_manager.h" |
| 108 #include "components/signin/core/common/signin_pref_names.h" | 108 #include "components/signin/core/common/signin_pref_names.h" |
| 109 #include "components/ssl_config/ssl_config_service_manager.h" | 109 #include "components/ssl_config/ssl_config_service_manager.h" |
| 110 #include "components/sync_preferences/pref_service_syncable.h" | 110 #include "components/sync_preferences/pref_service_syncable.h" |
| 111 #include "components/url_formatter/url_fixer.h" | 111 #include "components/url_formatter/url_fixer.h" |
| 112 #include "components/user_prefs/user_prefs.h" | 112 #include "components/user_prefs/user_prefs.h" |
| 113 #include "components/zoom/zoom_event_manager.h" | |
| 114 #include "content/public/browser/browser_thread.h" | 113 #include "content/public/browser/browser_thread.h" |
| 115 #include "content/public/browser/dom_storage_context.h" | 114 #include "content/public/browser/dom_storage_context.h" |
| 116 #include "content/public/browser/notification_service.h" | 115 #include "content/public/browser/notification_service.h" |
| 117 #include "content/public/browser/render_process_host.h" | 116 #include "content/public/browser/render_process_host.h" |
| 118 #include "content/public/browser/storage_partition.h" | 117 #include "content/public/browser/storage_partition.h" |
| 119 #include "content/public/browser/url_data_source.h" | 118 #include "content/public/browser/url_data_source.h" |
| 120 #include "content/public/common/content_constants.h" | 119 #include "content/public/common/content_constants.h" |
| 121 #include "content/public/common/page_zoom.h" | |
| 122 #include "extensions/features/features.h" | 120 #include "extensions/features/features.h" |
| 123 #include "mojo/public/cpp/bindings/strong_binding.h" | 121 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 124 #include "ppapi/features/features.h" | 122 #include "ppapi/features/features.h" |
| 125 #include "printing/features/features.h" | 123 #include "printing/features/features.h" |
| 126 #include "services/identity/identity_service.h" | 124 #include "services/identity/identity_service.h" |
| 127 #include "services/identity/public/interfaces/constants.mojom.h" | 125 #include "services/identity/public/interfaces/constants.mojom.h" |
| 128 #include "services/preferences/public/cpp/pref_service_main.h" | 126 #include "services/preferences/public/cpp/pref_service_main.h" |
| 129 #include "services/preferences/public/interfaces/preferences.mojom.h" | 127 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 130 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" | 128 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" |
| 131 #include "services/service_manager/public/cpp/service.h" | 129 #include "services/service_manager/public/cpp/service.h" |
| 132 #include "ui/base/l10n/l10n_util.h" | 130 #include "ui/base/l10n/l10n_util.h" |
| 133 | 131 |
| 134 #if defined(OS_CHROMEOS) | 132 #if defined(OS_CHROMEOS) |
| 135 #include "chrome/browser/chromeos/locale_change_guard.h" | 133 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 136 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 134 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 137 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 135 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 138 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" | 136 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
| 139 #include "chrome/browser/chromeos/preferences.h" | 137 #include "chrome/browser/chromeos/preferences.h" |
| 140 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 138 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 141 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 139 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 142 #include "components/session_manager/core/session_manager.h" | 140 #include "components/session_manager/core/session_manager.h" |
| 143 #include "components/user_manager/user.h" | 141 #include "components/user_manager/user.h" |
| 144 #include "components/user_manager/user_manager.h" | 142 #include "components/user_manager/user_manager.h" |
| 145 #endif | 143 #endif |
| 146 | 144 |
| 145 #if !defined(OS_ANDROID) |
| 146 #include "components/zoom/zoom_event_manager.h" |
| 147 #include "content/public/common/page_zoom.h" |
| 148 #endif |
| 149 |
| 147 #if BUILDFLAG(ENABLE_BACKGROUND) | 150 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 148 #include "chrome/browser/background/background_mode_manager.h" | 151 #include "chrome/browser/background/background_mode_manager.h" |
| 149 #endif | 152 #endif |
| 150 | 153 |
| 151 #if !defined(OS_CHROMEOS) | 154 #if !defined(OS_CHROMEOS) |
| 152 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 155 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 153 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 156 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 154 #endif | 157 #endif |
| 155 | 158 |
| 156 #if BUILDFLAG(ENABLE_EXTENSIONS) | 159 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 if (signin_manager) | 785 if (signin_manager) |
| 783 return signin_manager->GetAuthenticatedAccountInfo().email; | 786 return signin_manager->GetAuthenticatedAccountInfo().email; |
| 784 | 787 |
| 785 return std::string(); | 788 return std::string(); |
| 786 } | 789 } |
| 787 | 790 |
| 788 Profile::ProfileType ProfileImpl::GetProfileType() const { | 791 Profile::ProfileType ProfileImpl::GetProfileType() const { |
| 789 return REGULAR_PROFILE; | 792 return REGULAR_PROFILE; |
| 790 } | 793 } |
| 791 | 794 |
| 795 #if !defined(OS_ANDROID) |
| 792 std::unique_ptr<content::ZoomLevelDelegate> | 796 std::unique_ptr<content::ZoomLevelDelegate> |
| 793 ProfileImpl::CreateZoomLevelDelegate(const base::FilePath& partition_path) { | 797 ProfileImpl::CreateZoomLevelDelegate(const base::FilePath& partition_path) { |
| 794 return base::MakeUnique<ChromeZoomLevelPrefs>( | 798 return base::MakeUnique<ChromeZoomLevelPrefs>( |
| 795 GetPrefs(), GetPath(), partition_path, | 799 GetPrefs(), GetPath(), partition_path, |
| 796 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); | 800 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); |
| 797 } | 801 } |
| 802 #endif // !defined(OS_ANDROID) |
| 798 | 803 |
| 799 base::FilePath ProfileImpl::GetPath() const { | 804 base::FilePath ProfileImpl::GetPath() const { |
| 800 return path_; | 805 return path_; |
| 801 } | 806 } |
| 802 | 807 |
| 803 scoped_refptr<base::SequencedTaskRunner> ProfileImpl::GetIOTaskRunner() { | 808 scoped_refptr<base::SequencedTaskRunner> ProfileImpl::GetIOTaskRunner() { |
| 804 return JsonPrefStore::GetTaskRunnerForFile( | 809 return JsonPrefStore::GetTaskRunnerForFile( |
| 805 GetPath(), BrowserThread::GetBlockingPool()); | 810 GetPath(), BrowserThread::GetBlockingPool()); |
| 806 } | 811 } |
| 807 | 812 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 PrefService* ProfileImpl::GetPrefs() { | 978 PrefService* ProfileImpl::GetPrefs() { |
| 974 return const_cast<PrefService*>( | 979 return const_cast<PrefService*>( |
| 975 static_cast<const ProfileImpl*>(this)->GetPrefs()); | 980 static_cast<const ProfileImpl*>(this)->GetPrefs()); |
| 976 } | 981 } |
| 977 | 982 |
| 978 const PrefService* ProfileImpl::GetPrefs() const { | 983 const PrefService* ProfileImpl::GetPrefs() const { |
| 979 DCHECK(prefs_); // Should explicitly be initialized. | 984 DCHECK(prefs_); // Should explicitly be initialized. |
| 980 return prefs_.get(); | 985 return prefs_.get(); |
| 981 } | 986 } |
| 982 | 987 |
| 988 #if !defined(OS_ANDROID) |
| 983 ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { | 989 ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { |
| 984 return static_cast<ChromeZoomLevelPrefs*>( | 990 return static_cast<ChromeZoomLevelPrefs*>( |
| 985 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); | 991 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 986 } | 992 } |
| 993 #endif // !defined(OS_ANDROID) |
| 987 | 994 |
| 988 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 995 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
| 989 DCHECK(prefs_); | 996 DCHECK(prefs_); |
| 990 if (!otr_prefs_) { | 997 if (!otr_prefs_) { |
| 991 // The new ExtensionPrefStore is ref_counted and the new PrefService | 998 // The new ExtensionPrefStore is ref_counted and the new PrefService |
| 992 // stores a reference so that we do not leak memory here. | 999 // stores a reference so that we do not leak memory here. |
| 993 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( | 1000 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( |
| 994 prefs_.get(), CreateExtensionPrefStore(this, true))); | 1001 prefs_.get(), CreateExtensionPrefStore(this, true))); |
| 995 } | 1002 } |
| 996 return otr_prefs_.get(); | 1003 return otr_prefs_.get(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1386 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1380 | 1387 |
| 1381 return service->CreateMonitor( | 1388 return service->CreateMonitor( |
| 1382 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1389 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 1383 } | 1390 } |
| 1384 | 1391 |
| 1385 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { | 1392 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { |
| 1386 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); | 1393 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); |
| 1387 return base::MakeUnique<identity::IdentityService>(signin_manager); | 1394 return base::MakeUnique<identity::IdentityService>(signin_manager); |
| 1388 } | 1395 } |
| OLD | NEW |