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

Unified Diff: chrome/browser/signin/profile_oauth2_token_service_factory.cc

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 8 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: chrome/browser/signin/profile_oauth2_token_service_factory.cc
diff --git a/chrome/browser/signin/oauth2_token_service_factory.cc b/chrome/browser/signin/profile_oauth2_token_service_factory.cc
similarity index 38%
rename from chrome/browser/signin/oauth2_token_service_factory.cc
rename to chrome/browser/signin/profile_oauth2_token_service_factory.cc
index c0ca0be9672ea065e22c8668b0f99f6d397645e9..f9fb6478b58b947fbb2f5f60961e0ba8d6b1e066 100644
--- a/chrome/browser/signin/oauth2_token_service_factory.cc
+++ b/chrome/browser/signin/profile_oauth2_token_service_factory.cc
@@ -2,37 +2,49 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/signin/oauth2_token_service_factory.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
-#include "chrome/browser/signin/oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/token_service_factory.h"
-OAuth2TokenServiceFactory::OAuth2TokenServiceFactory()
- : ProfileKeyedServiceFactory("OAuth2TokenService",
+#if defined(OS_ANDROID)
+#include "chrome/browser/signin/android_profile_oauth2_token_service.h"
+#endif
+
+ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory()
+ : ProfileKeyedServiceFactory("ProfileOAuth2TokenService",
ProfileDependencyManager::GetInstance()) {
DependsOn(SigninManagerFactory::GetInstance());
DependsOn(TokenServiceFactory::GetInstance());
}
-OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() {
+ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() {
}
// static
-OAuth2TokenService* OAuth2TokenServiceFactory::GetForProfile(Profile* profile) {
- return static_cast<OAuth2TokenService*>(
+ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<ProfileOAuth2TokenService*>(
GetInstance()->GetServiceForProfile(profile, true));
}
// static
-OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() {
- return Singleton<OAuth2TokenServiceFactory>::get();
+ProfileOAuth2TokenServiceFactory*
+ ProfileOAuth2TokenServiceFactory::GetInstance() {
+ return Singleton<ProfileOAuth2TokenServiceFactory>::get();
}
-ProfileKeyedService* OAuth2TokenServiceFactory::BuildServiceInstanceFor(
+ProfileKeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor(
Profile* profile) const {
- OAuth2TokenService* service = new OAuth2TokenService();
+ ProfileOAuth2TokenService* service;
+#if defined(OS_ANDROID)
+ service = new AndroidProfileOAuth2TokenService(profile->GetRequestContext());
+#else
+ service = new ProfileOAuth2TokenService(profile->GetRequestContext());
+#endif
service->Initialize(profile);
return service;
}

Powered by Google App Engine
This is Rietveld 408576698