Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 2753753007: Introduce Identity Service and its initial usage (Closed)
Patch Set: Self-review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_store_manager_impl.h" 123 #include "services/preferences/public/cpp/pref_store_manager_impl.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 "ui/base/l10n/l10n_util.h" 126 #include "ui/base/l10n/l10n_util.h"
125 127
126 #if defined(OS_CHROMEOS) 128 #if defined(OS_CHROMEOS)
127 #include "chrome/browser/chromeos/locale_change_guard.h" 129 #include "chrome/browser/chromeos/locale_change_guard.h"
128 #include "chrome/browser/chromeos/preferences.h" 130 #include "chrome/browser/chromeos/preferences.h"
129 #include "chrome/browser/chromeos/profiles/profile_helper.h" 131 #include "chrome/browser/chromeos/profiles/profile_helper.h"
130 #include "chrome/browser/chromeos/settings/device_settings_service.h" 132 #include "chrome/browser/chromeos/settings/device_settings_service.h"
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 if (base::FeatureList::IsEnabled(features::kPrefService)) { 1070 if (base::FeatureList::IsEnabled(features::kPrefService)) {
1069 content::ServiceInfo info; 1071 content::ServiceInfo info;
1070 info.factory = 1072 info.factory =
1071 base::Bind([]() -> std::unique_ptr<service_manager::Service> { 1073 base::Bind([]() -> std::unique_ptr<service_manager::Service> {
1072 return base::MakeUnique<prefs::PrefStoreManagerImpl>( 1074 return base::MakeUnique<prefs::PrefStoreManagerImpl>(
1073 prefs::PrefStoreManagerImpl::PrefStoreTypes(), 1075 prefs::PrefStoreManagerImpl::PrefStoreTypes(),
1074 content::BrowserThread::GetBlockingPool()); 1076 content::BrowserThread::GetBlockingPool());
1075 }); 1077 });
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698