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

Unified Diff: ios/chrome/browser/signin/account_tracker_service_factory.cc

Issue 1251463002: iOS factories for ProfileOAuth2TokenService and AccountTrackerService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@componentizeOAuth2
Patch Set: Review comments Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/signin/account_tracker_service_factory.cc
diff --git a/ios/chrome/browser/signin/account_tracker_service_factory.cc b/ios/chrome/browser/signin/account_tracker_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..befb27834dc2222e3e6a4397e9148ee4bfa3b2f1
--- /dev/null
+++ b/ios/chrome/browser/signin/account_tracker_service_factory.cc
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/signin/account_tracker_service_factory.h"
+
+#include "base/memory/singleton.h"
+#include "components/keyed_service/ios/browser_state_dependency_manager.h"
+#include "components/signin/core/browser/account_tracker_service.h"
+#include "ios/chrome/browser/signin/signin_client_factory.h"
+#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
+
+namespace ios {
+
+AccountTrackerServiceFactory::AccountTrackerServiceFactory()
+ : BrowserStateKeyedServiceFactory(
+ "AccountTrackerService",
+ BrowserStateDependencyManager::GetInstance()) {
+ DependsOn(SigninClientFactory::GetInstance());
+}
+
+AccountTrackerServiceFactory::~AccountTrackerServiceFactory() {}
+
+// static
+AccountTrackerService* AccountTrackerServiceFactory::GetForBrowserState(
+ ios::ChromeBrowserState* browser_state) {
+ return static_cast<AccountTrackerService*>(
+ GetInstance()->GetServiceForBrowserState(browser_state, true));
+}
+
+// static
+AccountTrackerServiceFactory* AccountTrackerServiceFactory::GetInstance() {
+ return Singleton<AccountTrackerServiceFactory>::get();
+}
+
+void AccountTrackerServiceFactory::RegisterBrowserStatePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ AccountTrackerService::RegisterPrefs(registry);
+}
+
+scoped_ptr<KeyedService> AccountTrackerServiceFactory::BuildServiceInstanceFor(
+ web::BrowserState* context) const {
+ ios::ChromeBrowserState* chrome_browser_state =
+ ios::ChromeBrowserState::FromBrowserState(context);
+ scoped_ptr<AccountTrackerService> service(new AccountTrackerService());
+ service->Initialize(
+ SigninClientFactory::GetForBrowserState(chrome_browser_state));
+ return service.Pass();
+}
+
+} // namespace ios

Powered by Google App Engine
This is Rietveld 408576698