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

Unified Diff: chrome/browser/policy/cloud/user_policy_signin_service_android.cc

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 4 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/policy/cloud/user_policy_signin_service_android.cc
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_android.cc b/chrome/browser/policy/cloud/user_policy_signin_service_android.cc
index 1a9faee305fd974e80977754bd313d11d7a78958..c198ad7daf001d1098df2d0a110c26bc48c67ae9 100644
--- a/chrome/browser/policy/cloud/user_policy_signin_service_android.cc
+++ b/chrome/browser/policy/cloud/user_policy_signin_service_android.cc
@@ -39,11 +39,15 @@ enterprise_management::DeviceRegisterRequest::Type GetRegistrationType() {
UserPolicySigninService::UserPolicySigninService(
Profile* profile,
PrefService* local_state,
- DeviceManagementService* device_management_service)
+ DeviceManagementService* device_management_service,
+ SigninManager* signin_manager,
+ AndroidProfileOAuth2TokenService* token_service)
: UserPolicySigninServiceBase(profile,
local_state,
- device_management_service),
- weak_factory_(this) {}
+ device_management_service,
+ signin_manager),
+ weak_factory_(this),
+ oauth2_token_service_(token_service) {}
UserPolicySigninService::~UserPolicySigninService() {}
@@ -68,7 +72,7 @@ void UserPolicySigninService::RegisterPolicyClient(
force_load_policy,
GetRegistrationType()));
registration_helper_->StartRegistration(
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile()),
+ oauth2_token_service_,
username,
base::Bind(&UserPolicySigninService::CallPolicyRegistrationCallback,
base::Unretained(this),
@@ -137,9 +141,7 @@ void UserPolicySigninService::RegisterCloudPolicyService() {
// If the user signed-out while this task was waiting then Shutdown() would
// have been called, which would have invalidated this task. Since we're here
// then the user must still be signed-in.
- SigninManager* signin_manager =
- SigninManagerFactory::GetForProfile(profile());
- const std::string& username = signin_manager->GetAuthenticatedUsername();
+ const std::string& username = signin_manager()->GetAuthenticatedUsername();
DCHECK(!username.empty());
DCHECK(!GetManager()->IsClientRegistered());
DCHECK(GetManager()->core()->client());
@@ -155,7 +157,7 @@ void UserPolicySigninService::RegisterCloudPolicyService() {
force_load_policy,
GetRegistrationType()));
registration_helper_->StartRegistration(
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile()),
+ oauth2_token_service_,
username,
base::Bind(&UserPolicySigninService::OnRegistrationDone,
base::Unretained(this)));

Powered by Google App Engine
This is Rietveld 408576698