| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised/supervised_user_creation_cont
roller_new.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 base::FilePath token_file = base_path.Append(kSupervisedUserTokenFilename); | 50 base::FilePath token_file = base_path.Append(kSupervisedUserTokenFilename); |
| 51 int bytes = base::WriteFile(token_file, token.c_str(), token.length()); | 51 int bytes = base::WriteFile(token_file, token.c_str(), token.length()); |
| 52 return bytes >= 0; | 52 return bytes >= 0; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 SupervisedUserCreationControllerNew::SupervisedUserCreationControllerNew( | 57 SupervisedUserCreationControllerNew::SupervisedUserCreationControllerNew( |
| 58 SupervisedUserCreationControllerNew::StatusConsumer* consumer, | 58 SupervisedUserCreationControllerNew::StatusConsumer* consumer, |
| 59 const std::string& manager_id) | 59 const AccountId& manager_id) |
| 60 : SupervisedUserCreationController(consumer), | 60 : SupervisedUserCreationController(consumer), |
| 61 stage_(STAGE_INITIAL), | 61 stage_(STAGE_INITIAL), |
| 62 weak_factory_(this) { | 62 weak_factory_(this) { |
| 63 creation_context_.reset( | 63 creation_context_.reset( |
| 64 new SupervisedUserCreationControllerNew::UserCreationContext()); | 64 new SupervisedUserCreationControllerNew::UserCreationContext()); |
| 65 creation_context_->manager_id = manager_id; | 65 creation_context_->manager_id = manager_id; |
| 66 } | 66 } |
| 67 | 67 |
| 68 SupervisedUserCreationControllerNew::~SupervisedUserCreationControllerNew() {} | 68 SupervisedUserCreationControllerNew::~SupervisedUserCreationControllerNew() {} |
| 69 | 69 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 creation_context_->local_user_id = manager->GenerateUserId(); | 156 creation_context_->local_user_id = manager->GenerateUserId(); |
| 157 if (creation_context_->creation_type == NEW_USER) { | 157 if (creation_context_->creation_type == NEW_USER) { |
| 158 creation_context_->sync_user_id = | 158 creation_context_->sync_user_id = |
| 159 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(); | 159 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 manager->SetCreationTransactionUserId(creation_context_->local_user_id); | 162 manager->SetCreationTransactionUserId(creation_context_->local_user_id); |
| 163 | 163 |
| 164 stage_ = TRANSACTION_STARTED; | 164 stage_ = TRANSACTION_STARTED; |
| 165 | 165 |
| 166 manager->CreateUserRecord(creation_context_->manager_id, | 166 manager->CreateUserRecord(creation_context_->manager_id.GetUserEmail(), |
| 167 creation_context_->local_user_id, | 167 creation_context_->local_user_id, |
| 168 creation_context_->sync_user_id, | 168 creation_context_->sync_user_id, |
| 169 creation_context_->display_name); | 169 creation_context_->display_name); |
| 170 | 170 |
| 171 SupervisedUserAuthentication* authentication = | 171 SupervisedUserAuthentication* authentication = |
| 172 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 172 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| 173 | 173 |
| 174 // When importing M35+ users we need only to store data, for all other cases | 174 // When importing M35+ users we need only to store data, for all other cases |
| 175 // we need to create some keys. | 175 // we need to create some keys. |
| 176 if (creation_context_->creation_type != USER_IMPORT_NEW) { | 176 if (creation_context_->creation_type != USER_IMPORT_NEW) { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 creation_context_->registration_utility.reset(); | 415 creation_context_->registration_utility.reset(); |
| 416 chrome::AttemptUserExit(); | 416 chrome::AttemptUserExit(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { | 419 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { |
| 420 DCHECK(creation_context_); | 420 DCHECK(creation_context_); |
| 421 return creation_context_->local_user_id; | 421 return creation_context_->local_user_id; |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace chromeos | 424 } // namespace chromeos |
| OLD | NEW |