| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 // static | 127 // static |
| 128 scoped_ptr<ManagedUserRegistrationUtility> | 128 scoped_ptr<ManagedUserRegistrationUtility> |
| 129 ManagedUserRegistrationUtility::Create(Profile* profile) { | 129 ManagedUserRegistrationUtility::Create(Profile* profile) { |
| 130 if (g_instance_for_tests) { | 130 if (g_instance_for_tests) { |
| 131 ManagedUserRegistrationUtility* result = g_instance_for_tests; | 131 ManagedUserRegistrationUtility* result = g_instance_for_tests; |
| 132 g_instance_for_tests = NULL; | 132 g_instance_for_tests = NULL; |
| 133 return make_scoped_ptr(result); | 133 return make_scoped_ptr(result); |
| 134 } | 134 } |
| 135 |
| 136 ProfileOAuth2TokenService* token_service = |
| 137 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 135 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = | 138 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = |
| 136 ManagedUserRefreshTokenFetcher::Create( | 139 ManagedUserRefreshTokenFetcher::Create( |
| 137 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 140 token_service, |
| 141 token_service->GetPrimaryAccountId(), |
| 138 profile->GetRequestContext()); | 142 profile->GetRequestContext()); |
| 139 ManagedUserSyncService* managed_user_sync_service = | 143 ManagedUserSyncService* managed_user_sync_service = |
| 140 ManagedUserSyncServiceFactory::GetForProfile(profile); | 144 ManagedUserSyncServiceFactory::GetForProfile(profile); |
| 141 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( | 145 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( |
| 142 profile->GetPrefs(), | 146 profile->GetPrefs(), |
| 143 token_fetcher.Pass(), | 147 token_fetcher.Pass(), |
| 144 managed_user_sync_service)); | 148 managed_user_sync_service)); |
| 145 } | 149 } |
| 146 | 150 |
| 147 // static | 151 // static |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 DCHECK(success); | 298 DCHECK(success); |
| 295 managed_user_sync_service_->DeleteManagedUser(pending_managed_user_id_); | 299 managed_user_sync_service_->DeleteManagedUser(pending_managed_user_id_); |
| 296 } | 300 } |
| 297 | 301 |
| 298 if (run_callback) | 302 if (run_callback) |
| 299 callback_.Run(error, pending_managed_user_token_); | 303 callback_.Run(error, pending_managed_user_token_); |
| 300 callback_.Reset(); | 304 callback_.Reset(); |
| 301 } | 305 } |
| 302 | 306 |
| 303 } // namespace | 307 } // namespace |
| OLD | NEW |