| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/managed_mode/managed_user_registration_utility.h" | 5 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 | 124 |
| 125 // static | 125 // static |
| 126 scoped_ptr<ManagedUserRegistrationUtility> | 126 scoped_ptr<ManagedUserRegistrationUtility> |
| 127 ManagedUserRegistrationUtility::Create(Profile* profile) { | 127 ManagedUserRegistrationUtility::Create(Profile* profile) { |
| 128 if (g_instance_for_tests) { | 128 if (g_instance_for_tests) { |
| 129 ManagedUserRegistrationUtility* result = g_instance_for_tests; | 129 ManagedUserRegistrationUtility* result = g_instance_for_tests; |
| 130 g_instance_for_tests = NULL; | 130 g_instance_for_tests = NULL; |
| 131 return make_scoped_ptr(result); | 131 return make_scoped_ptr(result); |
| 132 } | 132 } |
| 133 |
| 134 ProfileOAuth2TokenService* token_service = |
| 135 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 133 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = | 136 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = |
| 134 ManagedUserRefreshTokenFetcher::Create( | 137 ManagedUserRefreshTokenFetcher::Create( |
| 135 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 138 token_service, |
| 139 token_service->GetPrimaryAccountId(), |
| 136 profile->GetRequestContext()); | 140 profile->GetRequestContext()); |
| 137 ManagedUserSyncService* managed_user_sync_service = | 141 ManagedUserSyncService* managed_user_sync_service = |
| 138 ManagedUserSyncServiceFactory::GetForProfile(profile); | 142 ManagedUserSyncServiceFactory::GetForProfile(profile); |
| 139 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( | 143 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( |
| 140 profile->GetPrefs(), | 144 profile->GetPrefs(), |
| 141 token_fetcher.Pass(), | 145 token_fetcher.Pass(), |
| 142 managed_user_sync_service)); | 146 managed_user_sync_service)); |
| 143 } | 147 } |
| 144 | 148 |
| 145 // static | 149 // static |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 DCHECK(success); | 295 DCHECK(success); |
| 292 managed_user_sync_service_->DeleteManagedUser(pending_managed_user_id_); | 296 managed_user_sync_service_->DeleteManagedUser(pending_managed_user_id_); |
| 293 } | 297 } |
| 294 | 298 |
| 295 if (run_callback) | 299 if (run_callback) |
| 296 callback_.Run(error, pending_managed_user_token_); | 300 callback_.Run(error, pending_managed_user_token_); |
| 297 callback_.Reset(); | 301 callback_.Reset(); |
| 298 } | 302 } |
| 299 | 303 |
| 300 } // namespace | 304 } // namespace |
| OLD | NEW |