| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 // static | 130 // static |
| 131 scoped_ptr<ManagedUserRegistrationUtility> | 131 scoped_ptr<ManagedUserRegistrationUtility> |
| 132 ManagedUserRegistrationUtility::Create(Profile* profile) { | 132 ManagedUserRegistrationUtility::Create(Profile* profile) { |
| 133 if (g_instance_for_tests) { | 133 if (g_instance_for_tests) { |
| 134 ManagedUserRegistrationUtility* result = g_instance_for_tests; | 134 ManagedUserRegistrationUtility* result = g_instance_for_tests; |
| 135 g_instance_for_tests = NULL; | 135 g_instance_for_tests = NULL; |
| 136 return make_scoped_ptr(result); | 136 return make_scoped_ptr(result); |
| 137 } | 137 } |
| 138 |
| 139 ProfileOAuth2TokenService* token_service = |
| 140 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
| 138 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = | 141 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = |
| 139 ManagedUserRefreshTokenFetcher::Create( | 142 ManagedUserRefreshTokenFetcher::Create( |
| 140 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 143 token_service, |
| 144 token_service->GetPrimaryAccountId(), |
| 141 profile->GetRequestContext()); | 145 profile->GetRequestContext()); |
| 142 ManagedUserSyncService* managed_user_sync_service = | 146 ManagedUserSyncService* managed_user_sync_service = |
| 143 ManagedUserSyncServiceFactory::GetForProfile(profile); | 147 ManagedUserSyncServiceFactory::GetForProfile(profile); |
| 144 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( | 148 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( |
| 145 profile->GetPrefs(), | 149 profile->GetPrefs(), |
| 146 token_fetcher.Pass(), | 150 token_fetcher.Pass(), |
| 147 managed_user_sync_service)); | 151 managed_user_sync_service)); |
| 148 } | 152 } |
| 149 | 153 |
| 150 // static | 154 // static |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 pending_managed_user_id_); | 311 pending_managed_user_id_); |
| 308 } | 312 } |
| 309 } | 313 } |
| 310 | 314 |
| 311 if (run_callback) | 315 if (run_callback) |
| 312 callback_.Run(error, pending_managed_user_token_); | 316 callback_.Run(error, pending_managed_user_token_); |
| 313 callback_.Reset(); | 317 callback_.Reset(); |
| 314 } | 318 } |
| 315 | 319 |
| 316 } // namespace | 320 } // namespace |
| OLD | NEW |