| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/managed/locally_managed_user_creation_co
ntroller.h" | 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_co
ntroller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 ManagedUserRegistrationUtility::Create( | 160 ManagedUserRegistrationUtility::Create( |
| 161 creation_context_->manager_profile); | 161 creation_context_->manager_profile); |
| 162 | 162 |
| 163 VLOG(1) << "Creating user on server"; | 163 VLOG(1) << "Creating user on server"; |
| 164 ManagedUserRegistrationInfo info(creation_context_->display_name, | 164 ManagedUserRegistrationInfo info(creation_context_->display_name, |
| 165 kDummyAvatarIndex); | 165 kDummyAvatarIndex); |
| 166 info.master_key = creation_context_->master_key; | 166 info.master_key = creation_context_->master_key; |
| 167 creation_context_->registration_utility->Register( | 167 creation_context_->registration_utility->Register( |
| 168 creation_context_->sync_user_id, | 168 creation_context_->sync_user_id, |
| 169 info, | 169 info, |
| 170 false, |
| 170 base::Bind(&LocallyManagedUserCreationController::RegistrationCallback, | 171 base::Bind(&LocallyManagedUserCreationController::RegistrationCallback, |
| 171 weak_factory_.GetWeakPtr())); | 172 weak_factory_.GetWeakPtr())); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void LocallyManagedUserCreationController::RegistrationCallback( | 175 void LocallyManagedUserCreationController::RegistrationCallback( |
| 175 const GoogleServiceAuthError& error, | 176 const GoogleServiceAuthError& error, |
| 176 const std::string& token) { | 177 const std::string& token) { |
| 177 if (error.state() == GoogleServiceAuthError::NONE) { | 178 if (error.state() == GoogleServiceAuthError::NONE) { |
| 178 TokenFetched(token); | 179 TokenFetched(token); |
| 179 } else { | 180 } else { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Assume that new token is valid. It will be automatically invalidated if | 236 // Assume that new token is valid. It will be automatically invalidated if |
| 236 // sync service fails to use it. | 237 // sync service fails to use it. |
| 237 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, | 238 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, |
| 238 User::OAUTH2_TOKEN_STATUS_VALID); | 239 User::OAUTH2_TOKEN_STATUS_VALID); |
| 239 UserManager::Get()->CommitLocallyManagedUserCreationTransaction(); | 240 UserManager::Get()->CommitLocallyManagedUserCreationTransaction(); |
| 240 if (consumer_) | 241 if (consumer_) |
| 241 consumer_->OnCreationSuccess(); | 242 consumer_->OnCreationSuccess(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace chromeos | 245 } // namespace chromeos |
| OLD | NEW |