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_scre
en.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre
en.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 216 } |
217 | 217 |
218 void SupervisedUserCreationScreen::AuthenticateManager( | 218 void SupervisedUserCreationScreen::AuthenticateManager( |
219 const std::string& manager_id, | 219 const std::string& manager_id, |
220 const std::string& manager_password) { | 220 const std::string& manager_password) { |
221 if (manager_signin_in_progress_) | 221 if (manager_signin_in_progress_) |
222 return; | 222 return; |
223 manager_signin_in_progress_ = true; | 223 manager_signin_in_progress_ = true; |
224 | 224 |
225 UserFlow* flow = new SupervisedUserCreationFlow(manager_id); | 225 UserFlow* flow = new SupervisedUserCreationFlow(manager_id); |
226 ChromeUserManager::Get()->SetUserFlow(manager_id, flow); | 226 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(manager_id), |
| 227 flow); |
227 | 228 |
228 // Make sure no two controllers exist at the same time. | 229 // Make sure no two controllers exist at the same time. |
229 controller_.reset(); | 230 controller_.reset(); |
230 | 231 |
231 controller_.reset(new SupervisedUserCreationControllerNew(this, manager_id)); | 232 controller_.reset(new SupervisedUserCreationControllerNew(this, manager_id)); |
232 | 233 |
233 UserContext user_context(manager_id); | 234 UserContext user_context(AccountId::FromUserEmail(manager_id)); |
234 user_context.SetKey(Key(manager_password)); | 235 user_context.SetKey(Key(manager_password)); |
235 ExistingUserController::current_controller()->Login(user_context, | 236 ExistingUserController::current_controller()->Login(user_context, |
236 SigninSpecifics()); | 237 SigninSpecifics()); |
237 } | 238 } |
238 | 239 |
239 void SupervisedUserCreationScreen::CreateSupervisedUser( | 240 void SupervisedUserCreationScreen::CreateSupervisedUser( |
240 const base::string16& display_name, | 241 const base::string16& display_name, |
241 const std::string& supervised_user_password) { | 242 const std::string& supervised_user_password) { |
242 DCHECK(controller_.get()); | 243 DCHECK(controller_.get()); |
243 int image; | 244 int image; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 478 } |
478 return false; | 479 return false; |
479 } | 480 } |
480 | 481 |
481 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 482 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
482 // It should be removed by issue 251179. | 483 // It should be removed by issue 251179. |
483 | 484 |
484 void SupervisedUserCreationScreen::ApplyPicture() { | 485 void SupervisedUserCreationScreen::ApplyPicture() { |
485 std::string user_id = controller_->GetSupervisedUserId(); | 486 std::string user_id = controller_->GetSupervisedUserId(); |
486 UserImageManager* image_manager = | 487 UserImageManager* image_manager = |
487 ChromeUserManager::Get()->GetUserImageManager(user_id); | 488 ChromeUserManager::Get()->GetUserImageManager( |
| 489 AccountId::FromUserEmail(user_id)); |
488 switch (selected_image_) { | 490 switch (selected_image_) { |
489 case user_manager::User::USER_IMAGE_EXTERNAL: | 491 case user_manager::User::USER_IMAGE_EXTERNAL: |
490 // Photo decoding may not have been finished yet. | 492 // Photo decoding may not have been finished yet. |
491 if (user_photo_.isNull()) { | 493 if (user_photo_.isNull()) { |
492 apply_photo_after_decoding_ = true; | 494 apply_photo_after_decoding_ = true; |
493 return; | 495 return; |
494 } | 496 } |
495 image_manager->SaveUserImage( | 497 image_manager->SaveUserImage( |
496 user_manager::UserImage::CreateAndEncode(user_photo_)); | 498 user_manager::UserImage::CreateAndEncode(user_photo_)); |
497 break; | 499 break; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; | 624 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; |
623 } else { | 625 } else { |
624 NOTREACHED() << "Unexpected image type: " << image_type; | 626 NOTREACHED() << "Unexpected image type: " << image_type; |
625 } | 627 } |
626 } | 628 } |
627 | 629 |
628 void SupervisedUserCreationScreen::OnImageAccepted() { | 630 void SupervisedUserCreationScreen::OnImageAccepted() { |
629 } | 631 } |
630 | 632 |
631 } // namespace chromeos | 633 } // namespace chromeos |
OLD | NEW |