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