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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #include "content/public/browser/notification_service.h" | 111 #include "content/public/browser/notification_service.h" |
112 #include "content/public/browser/render_process_host.h" | 112 #include "content/public/browser/render_process_host.h" |
113 #include "content/public/browser/storage_partition.h" | 113 #include "content/public/browser/storage_partition.h" |
114 #include "content/public/browser/url_data_source.h" | 114 #include "content/public/browser/url_data_source.h" |
115 #include "content/public/browser/user_metrics.h" | 115 #include "content/public/browser/user_metrics.h" |
116 #include "content/public/common/content_constants.h" | 116 #include "content/public/common/content_constants.h" |
117 #include "content/public/common/page_zoom.h" | 117 #include "content/public/common/page_zoom.h" |
118 #include "extensions/features/features.h" | 118 #include "extensions/features/features.h" |
119 #include "ppapi/features/features.h" | 119 #include "ppapi/features/features.h" |
120 #include "printing/features/features.h" | 120 #include "printing/features/features.h" |
| 121 #include "services/identity/identity_service.h" |
| 122 #include "services/identity/public/interfaces/constants.mojom.h" |
121 #include "services/preferences/public/cpp/pref_service_main.h" | 123 #include "services/preferences/public/cpp/pref_service_main.h" |
122 #include "services/preferences/public/interfaces/preferences.mojom.h" | 124 #include "services/preferences/public/interfaces/preferences.mojom.h" |
123 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" | 125 #include "services/preferences/public/interfaces/tracked_preference_validation_d
elegate.mojom.h" |
124 #include "services/service_manager/public/cpp/service.h" | 126 #include "services/service_manager/public/cpp/service.h" |
125 #include "ui/base/l10n/l10n_util.h" | 127 #include "ui/base/l10n/l10n_util.h" |
126 | 128 |
127 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
128 #include "chrome/browser/chromeos/locale_change_guard.h" | 130 #include "chrome/browser/chromeos/locale_change_guard.h" |
129 #include "chrome/browser/chromeos/preferences.h" | 131 #include "chrome/browser/chromeos/preferences.h" |
130 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 132 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void ProfileImpl::RegisterInProcessServices(StaticServiceMap* services) { | 1070 void ProfileImpl::RegisterInProcessServices(StaticServiceMap* services) { |
1069 if (base::FeatureList::IsEnabled(features::kPrefService)) { | 1071 if (base::FeatureList::IsEnabled(features::kPrefService)) { |
1070 content::ServiceInfo info; | 1072 content::ServiceInfo info; |
1071 info.factory = base::Bind( | 1073 info.factory = base::Bind( |
1072 &prefs::CreatePrefService, std::set<PrefValueStore::PrefStoreType>(), | 1074 &prefs::CreatePrefService, std::set<PrefValueStore::PrefStoreType>(), |
1073 make_scoped_refptr(content::BrowserThread::GetBlockingPool())); | 1075 make_scoped_refptr(content::BrowserThread::GetBlockingPool())); |
1074 info.task_runner = content::BrowserThread::GetTaskRunnerForThread( | 1076 info.task_runner = content::BrowserThread::GetTaskRunnerForThread( |
1075 content::BrowserThread::IO); | 1077 content::BrowserThread::IO); |
1076 services->insert(std::make_pair(prefs::mojom::kPrefStoreServiceName, info)); | 1078 services->insert(std::make_pair(prefs::mojom::kPrefStoreServiceName, info)); |
1077 } | 1079 } |
| 1080 |
| 1081 content::ServiceInfo identity_service_info; |
| 1082 |
| 1083 // The Identity Service must run on the UI thread. |
| 1084 identity_service_info.task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 1085 |
| 1086 // NOTE: The dependencies of the Identity Service have not yet been created, |
| 1087 // so it is not possible to bind them here. Instead, bind them at the time |
| 1088 // of the actual request to create the Identity Service. |
| 1089 identity_service_info.factory = |
| 1090 base::Bind(&ProfileImpl::CreateIdentityService, base::Unretained(this)); |
| 1091 services->insert( |
| 1092 std::make_pair(identity::mojom::kServiceName, identity_service_info)); |
1078 } | 1093 } |
1079 | 1094 |
1080 bool ProfileImpl::IsSameProfile(Profile* profile) { | 1095 bool ProfileImpl::IsSameProfile(Profile* profile) { |
1081 if (profile == static_cast<Profile*>(this)) | 1096 if (profile == static_cast<Profile*>(this)) |
1082 return true; | 1097 return true; |
1083 Profile* otr_profile = off_the_record_profile_.get(); | 1098 Profile* otr_profile = off_the_record_profile_.get(); |
1084 return otr_profile && profile == otr_profile; | 1099 return otr_profile && profile == otr_profile; |
1085 } | 1100 } |
1086 | 1101 |
1087 Time ProfileImpl::GetStartTime() const { | 1102 Time ProfileImpl::GetStartTime() const { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1341 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1327 domain_reliability::DomainReliabilityService* service = | 1342 domain_reliability::DomainReliabilityService* service = |
1328 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1343 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1329 GetForBrowserContext(this); | 1344 GetForBrowserContext(this); |
1330 if (!service) | 1345 if (!service) |
1331 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1346 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1332 | 1347 |
1333 return service->CreateMonitor( | 1348 return service->CreateMonitor( |
1334 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1349 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
1335 } | 1350 } |
| 1351 |
| 1352 std::unique_ptr<service_manager::Service> ProfileImpl::CreateIdentityService() { |
| 1353 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(this); |
| 1354 return base::MakeUnique<identity::IdentityService>(signin_manager); |
| 1355 } |
OLD | NEW |