| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #include "components/pref_registry/pref_registry_syncable.h" | 101 #include "components/pref_registry/pref_registry_syncable.h" |
| 102 #include "components/prefs/json_pref_store.h" | 102 #include "components/prefs/json_pref_store.h" |
| 103 #include "components/prefs/scoped_user_pref_update.h" | 103 #include "components/prefs/scoped_user_pref_update.h" |
| 104 #include "components/proxy_config/pref_proxy_config_tracker.h" | 104 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 105 #include "components/signin/core/browser/signin_manager.h" | 105 #include "components/signin/core/browser/signin_manager.h" |
| 106 #include "components/signin/core/common/signin_pref_names.h" | 106 #include "components/signin/core/common/signin_pref_names.h" |
| 107 #include "components/ssl_config/ssl_config_service_manager.h" | 107 #include "components/ssl_config/ssl_config_service_manager.h" |
| 108 #include "components/sync_preferences/pref_service_syncable.h" | 108 #include "components/sync_preferences/pref_service_syncable.h" |
| 109 #include "components/url_formatter/url_fixer.h" | 109 #include "components/url_formatter/url_fixer.h" |
| 110 #include "components/user_prefs/user_prefs.h" | 110 #include "components/user_prefs/user_prefs.h" |
| 111 #include "components/zoom/zoom_event_manager.h" | |
| 112 #include "content/public/browser/browser_thread.h" | 111 #include "content/public/browser/browser_thread.h" |
| 113 #include "content/public/browser/dom_storage_context.h" | 112 #include "content/public/browser/dom_storage_context.h" |
| 114 #include "content/public/browser/notification_service.h" | 113 #include "content/public/browser/notification_service.h" |
| 115 #include "content/public/browser/render_process_host.h" | 114 #include "content/public/browser/render_process_host.h" |
| 116 #include "content/public/browser/storage_partition.h" | 115 #include "content/public/browser/storage_partition.h" |
| 117 #include "content/public/browser/url_data_source.h" | 116 #include "content/public/browser/url_data_source.h" |
| 118 #include "content/public/common/content_constants.h" | 117 #include "content/public/common/content_constants.h" |
| 119 #include "content/public/common/page_zoom.h" | |
| 120 #include "extensions/features/features.h" | 118 #include "extensions/features/features.h" |
| 121 #include "mojo/public/cpp/bindings/strong_binding.h" | 119 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 122 #include "ppapi/features/features.h" | 120 #include "ppapi/features/features.h" |
| 123 #include "printing/features/features.h" | 121 #include "printing/features/features.h" |
| 124 #include "services/identity/identity_service.h" | 122 #include "services/identity/identity_service.h" |
| 125 #include "services/identity/public/interfaces/constants.mojom.h" | 123 #include "services/identity/public/interfaces/constants.mojom.h" |
| 126 #include "services/preferences/public/cpp/pref_service_main.h" | 124 #include "services/preferences/public/cpp/pref_service_main.h" |
| 127 #include "services/preferences/public/interfaces/preferences.mojom.h" | 125 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 128 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" | 126 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" |
| 129 #include "services/service_manager/public/cpp/service.h" | 127 #include "services/service_manager/public/cpp/service.h" |
| 130 #include "ui/base/l10n/l10n_util.h" | 128 #include "ui/base/l10n/l10n_util.h" |
| 131 | 129 |
| 132 #if defined(OS_CHROMEOS) | 130 #if defined(OS_CHROMEOS) |
| 133 #include "chrome/browser/chromeos/locale_change_guard.h" | 131 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 134 #include "chrome/browser/chromeos/preferences.h" | 132 #include "chrome/browser/chromeos/preferences.h" |
| 135 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 133 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 136 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 134 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 137 #include "components/user_manager/user_manager.h" | 135 #include "components/user_manager/user_manager.h" |
| 138 #endif | 136 #endif |
| 139 | 137 |
| 138 #if !defined(OS_ANDROID) |
| 139 #include "components/zoom/zoom_event_manager.h" |
| 140 #include "content/public/common/page_zoom.h" |
| 141 #endif |
| 142 |
| 140 #if BUILDFLAG(ENABLE_BACKGROUND) | 143 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 141 #include "chrome/browser/background/background_mode_manager.h" | 144 #include "chrome/browser/background/background_mode_manager.h" |
| 142 #endif | 145 #endif |
| 143 | 146 |
| 144 #if defined(OS_CHROMEOS) | 147 #if defined(OS_CHROMEOS) |
| 145 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 148 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 146 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 149 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 147 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" | 150 #include "chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.h" |
| 148 #else | 151 #else |
| 149 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 152 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 if (signin_manager) | 767 if (signin_manager) |
| 765 return signin_manager->GetAuthenticatedAccountInfo().email; | 768 return signin_manager->GetAuthenticatedAccountInfo().email; |
| 766 | 769 |
| 767 return std::string(); | 770 return std::string(); |
| 768 } | 771 } |
| 769 | 772 |
| 770 Profile::ProfileType ProfileImpl::GetProfileType() const { | 773 Profile::ProfileType ProfileImpl::GetProfileType() const { |
| 771 return REGULAR_PROFILE; | 774 return REGULAR_PROFILE; |
| 772 } | 775 } |
| 773 | 776 |
| 777 #if !defined(OS_ANDROID) |
| 774 std::unique_ptr<content::ZoomLevelDelegate> | 778 std::unique_ptr<content::ZoomLevelDelegate> |
| 775 ProfileImpl::CreateZoomLevelDelegate(const base::FilePath& partition_path) { | 779 ProfileImpl::CreateZoomLevelDelegate(const base::FilePath& partition_path) { |
| 776 return base::MakeUnique<ChromeZoomLevelPrefs>( | 780 return base::MakeUnique<ChromeZoomLevelPrefs>( |
| 777 GetPrefs(), GetPath(), partition_path, | 781 GetPrefs(), GetPath(), partition_path, |
| 778 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); | 782 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); |
| 779 } | 783 } |
| 784 #endif // !defined(OS_ANDROID) |
| 780 | 785 |
| 781 base::FilePath ProfileImpl::GetPath() const { | 786 base::FilePath ProfileImpl::GetPath() const { |
| 782 return path_; | 787 return path_; |
| 783 } | 788 } |
| 784 | 789 |
| 785 scoped_refptr<base::SequencedTaskRunner> ProfileImpl::GetIOTaskRunner() { | 790 scoped_refptr<base::SequencedTaskRunner> ProfileImpl::GetIOTaskRunner() { |
| 786 return JsonPrefStore::GetTaskRunnerForFile( | 791 return JsonPrefStore::GetTaskRunnerForFile( |
| 787 GetPath(), BrowserThread::GetBlockingPool()); | 792 GetPath(), BrowserThread::GetBlockingPool()); |
| 788 } | 793 } |
| 789 | 794 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 PrefService* ProfileImpl::GetPrefs() { | 960 PrefService* ProfileImpl::GetPrefs() { |
| 956 return const_cast<PrefService*>( | 961 return const_cast<PrefService*>( |
| 957 static_cast<const ProfileImpl*>(this)->GetPrefs()); | 962 static_cast<const ProfileImpl*>(this)->GetPrefs()); |
| 958 } | 963 } |
| 959 | 964 |
| 960 const PrefService* ProfileImpl::GetPrefs() const { | 965 const PrefService* ProfileImpl::GetPrefs() const { |
| 961 DCHECK(prefs_); // Should explicitly be initialized. | 966 DCHECK(prefs_); // Should explicitly be initialized. |
| 962 return prefs_.get(); | 967 return prefs_.get(); |
| 963 } | 968 } |
| 964 | 969 |
| 970 #if !defined(OS_ANDROID) |
| 965 ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { | 971 ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() { |
| 966 return static_cast<ChromeZoomLevelPrefs*>( | 972 return static_cast<ChromeZoomLevelPrefs*>( |
| 967 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); | 973 GetDefaultStoragePartition(this)->GetZoomLevelDelegate()); |
| 968 } | 974 } |
| 975 #endif // !defined(OS_ANDROID) |
| 969 | 976 |
| 970 PrefService* ProfileImpl::GetOffTheRecordPrefs() { | 977 PrefService* ProfileImpl::GetOffTheRecordPrefs() { |
| 971 DCHECK(prefs_); | 978 DCHECK(prefs_); |
| 972 if (!otr_prefs_) { | 979 if (!otr_prefs_) { |
| 973 // The new ExtensionPrefStore is ref_counted and the new PrefService | 980 // The new ExtensionPrefStore is ref_counted and the new PrefService |
| 974 // stores a reference so that we do not leak memory here. | 981 // stores a reference so that we do not leak memory here. |
| 975 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( | 982 otr_prefs_.reset(CreateIncognitoPrefServiceSyncable( |
| 976 prefs_.get(), CreateExtensionPrefStore(this, true))); | 983 prefs_.get(), CreateExtensionPrefStore(this, true))); |
| 977 } | 984 } |
| 978 return otr_prefs_.get(); | 985 return otr_prefs_.get(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1368 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1362 | 1369 |
| 1363 return service->CreateMonitor( | 1370 return service->CreateMonitor( |
| 1364 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1371 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 1365 } | 1372 } |
| 1366 | 1373 |
| 1367 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { | 1374 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { |
| 1368 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); | 1375 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); |
| 1369 return base::MakeUnique<identity::IdentityService>(signin_manager); | 1376 return base::MakeUnique<identity::IdentityService>(signin_manager); |
| 1370 } | 1377 } |
| OLD | NEW |