| 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" |
| 11 #include "chrome/browser/chromeos/camera_detector.h" | 11 #include "chrome/browser/chromeos/camera_detector.h" |
| 12 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 12 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 13 #include "chrome/browser/chromeos/login/screen_manager.h" | 13 #include "chrome/browser/chromeos/login/screen_manager.h" |
| 14 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 14 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 15 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 15 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
| 16 #include "chrome/browser/chromeos/login/signin_specifics.h" | 16 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" | 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" |
| 19 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" | 19 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" |
| 20 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_flow
.h" |
| 20 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" | 21 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
| 21 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 22 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 22 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 23 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 23 #include "chrome/browser/chromeos/login/wizard_controller.h" | 24 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 24 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 25 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 25 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" | 26 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" |
| 26 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" | 27 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" |
| 27 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" | 28 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" |
| 28 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" | 29 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" |
| 29 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return static_cast<SupervisedUserCreationScreen*>( | 93 return static_cast<SupervisedUserCreationScreen*>( |
| 93 manager->GetScreen(WizardController::kSupervisedUserCreationScreenName)); | 94 manager->GetScreen(WizardController::kSupervisedUserCreationScreenName)); |
| 94 } | 95 } |
| 95 | 96 |
| 96 SupervisedUserCreationScreen::SupervisedUserCreationScreen( | 97 SupervisedUserCreationScreen::SupervisedUserCreationScreen( |
| 97 ScreenObserver* observer, | 98 ScreenObserver* observer, |
| 98 SupervisedUserCreationScreenHandler* actor) | 99 SupervisedUserCreationScreenHandler* actor) |
| 99 : WizardScreen(observer), | 100 : WizardScreen(observer), |
| 100 actor_(actor), | 101 actor_(actor), |
| 101 on_error_screen_(false), | 102 on_error_screen_(false), |
| 103 manager_signin_in_progress_(false), |
| 102 last_page_(kNameOfIntroScreen), | 104 last_page_(kNameOfIntroScreen), |
| 103 sync_service_(NULL), | 105 sync_service_(NULL), |
| 104 image_decoder_(NULL), | 106 image_decoder_(NULL), |
| 105 apply_photo_after_decoding_(false), | 107 apply_photo_after_decoding_(false), |
| 106 selected_image_(0), | 108 selected_image_(0), |
| 107 weak_factory_(this) { | 109 weak_factory_(this) { |
| 108 DCHECK(actor_); | 110 DCHECK(actor_); |
| 109 if (actor_) | 111 if (actor_) |
| 110 actor_->SetDelegate(this); | 112 actor_->SetDelegate(this); |
| 111 } | 113 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } else { | 157 } else { |
| 156 on_error_screen_ = true; | 158 on_error_screen_ = true; |
| 157 ErrorScreen* screen = get_screen_observer()->GetErrorScreen(); | 159 ErrorScreen* screen = get_screen_observer()->GetErrorScreen(); |
| 158 ConfigureErrorScreen(screen, network, state.status); | 160 ConfigureErrorScreen(screen, network, state.status); |
| 159 screen->SetUIState(ErrorScreen::UI_STATE_SUPERVISED); | 161 screen->SetUIState(ErrorScreen::UI_STATE_SUPERVISED); |
| 160 get_screen_observer()->ShowErrorScreen(); | 162 get_screen_observer()->ShowErrorScreen(); |
| 161 } | 163 } |
| 162 } | 164 } |
| 163 | 165 |
| 164 void SupervisedUserCreationScreen::ShowManagerInconsistentStateErrorScreen() { | 166 void SupervisedUserCreationScreen::ShowManagerInconsistentStateErrorScreen() { |
| 167 manager_signin_in_progress_ = false; |
| 165 if (!actor_) | 168 if (!actor_) |
| 166 return; | 169 return; |
| 167 actor_->ShowErrorPage( | 170 actor_->ShowErrorPage( |
| 168 l10n_util::GetStringUTF16( | 171 l10n_util::GetStringUTF16( |
| 169 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE_TITLE), | 172 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE_TITLE), |
| 170 l10n_util::GetStringUTF16( | 173 l10n_util::GetStringUTF16( |
| 171 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE), | 174 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE), |
| 172 l10n_util::GetStringUTF16( | 175 l10n_util::GetStringUTF16( |
| 173 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE_BUTTON)); | 176 IDS_CREATE_SUPERVISED_USER_MANAGER_INCONSISTENT_STATE_BUTTON)); |
| 174 } | 177 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 194 controller_->CancelCreation(); | 197 controller_->CancelCreation(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 void SupervisedUserCreationScreen::FinishFlow() { | 200 void SupervisedUserCreationScreen::FinishFlow() { |
| 198 controller_->FinishCreation(); | 201 controller_->FinishCreation(); |
| 199 } | 202 } |
| 200 | 203 |
| 201 void SupervisedUserCreationScreen::AuthenticateManager( | 204 void SupervisedUserCreationScreen::AuthenticateManager( |
| 202 const std::string& manager_id, | 205 const std::string& manager_id, |
| 203 const std::string& manager_password) { | 206 const std::string& manager_password) { |
| 207 if (manager_signin_in_progress_) |
| 208 return; |
| 209 manager_signin_in_progress_ = true; |
| 210 |
| 211 UserFlow* flow = new SupervisedUserCreationFlow(manager_id); |
| 212 ChromeUserManager::Get()->SetUserFlow(manager_id, flow); |
| 213 |
| 204 // Make sure no two controllers exist at the same time. | 214 // Make sure no two controllers exist at the same time. |
| 205 controller_.reset(); | 215 controller_.reset(); |
| 206 | 216 |
| 207 controller_.reset(new SupervisedUserCreationControllerNew(this, manager_id)); | 217 controller_.reset(new SupervisedUserCreationControllerNew(this, manager_id)); |
| 208 | 218 |
| 209 UserContext user_context(manager_id); | 219 UserContext user_context(manager_id); |
| 210 user_context.SetKey(Key(manager_password)); | 220 user_context.SetKey(Key(manager_password)); |
| 211 ExistingUserController::current_controller()->Login(user_context, | 221 ExistingUserController::current_controller()->Login(user_context, |
| 212 SigninSpecifics()); | 222 SigninSpecifics()); |
| 213 } | 223 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 SupervisedUserSyncService::GetAvatarIndex(avatar, &avatar_index); | 336 SupervisedUserSyncService::GetAvatarIndex(avatar, &avatar_index); |
| 327 | 337 |
| 328 controller_->StartImport(display_name, | 338 controller_->StartImport(display_name, |
| 329 password, | 339 password, |
| 330 avatar_index, | 340 avatar_index, |
| 331 user_id, | 341 user_id, |
| 332 master_key); | 342 master_key); |
| 333 } | 343 } |
| 334 | 344 |
| 335 void SupervisedUserCreationScreen::OnManagerLoginFailure() { | 345 void SupervisedUserCreationScreen::OnManagerLoginFailure() { |
| 346 manager_signin_in_progress_ = false; |
| 336 if (actor_) | 347 if (actor_) |
| 337 actor_->ShowManagerPasswordError(); | 348 actor_->ShowManagerPasswordError(); |
| 338 } | 349 } |
| 339 | 350 |
| 340 void SupervisedUserCreationScreen::OnManagerFullyAuthenticated( | 351 void SupervisedUserCreationScreen::OnManagerFullyAuthenticated( |
| 341 Profile* manager_profile) { | 352 Profile* manager_profile) { |
| 353 manager_signin_in_progress_ = false; |
| 342 DCHECK(controller_.get()); | 354 DCHECK(controller_.get()); |
| 343 // For manager user, move desktop to locked container so that windows created | 355 // For manager user, move desktop to locked container so that windows created |
| 344 // during the user image picker step are below it. | 356 // during the user image picker step are below it. |
| 345 ash::Shell::GetInstance()-> | 357 ash::Shell::GetInstance()-> |
| 346 desktop_background_controller()->MoveDesktopToLockedContainer(); | 358 desktop_background_controller()->MoveDesktopToLockedContainer(); |
| 347 | 359 |
| 348 controller_->SetManagerProfile(manager_profile); | 360 controller_->SetManagerProfile(manager_profile); |
| 349 if (actor_) | 361 if (actor_) |
| 350 actor_->ShowUsernamePage(); | 362 actor_->ShowUsernamePage(); |
| 351 | 363 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; | 614 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; |
| 603 } else { | 615 } else { |
| 604 NOTREACHED() << "Unexpected image type: " << image_type; | 616 NOTREACHED() << "Unexpected image type: " << image_type; |
| 605 } | 617 } |
| 606 } | 618 } |
| 607 | 619 |
| 608 void SupervisedUserCreationScreen::OnImageAccepted() { | 620 void SupervisedUserCreationScreen::OnImageAccepted() { |
| 609 } | 621 } |
| 610 | 622 |
| 611 } // namespace chromeos | 623 } // namespace chromeos |
| OLD | NEW |