| 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/screens/error_screen.h" | 13 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 14 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 14 #include "chrome/browser/chromeos/login/screens/screen_observer.h" |
| 15 #include "chrome/browser/chromeos/login/signin_specifics.h" | 15 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" | 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller.h" |
| 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" | 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" |
| 19 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" | 19 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
| 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 20 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 21 #include "chrome/browser/chromeos/login/wizard_controller.h" | 22 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 22 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 23 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 23 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" | 24 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" |
| 24 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" | 25 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
_factory.h" |
| 25 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" | 26 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" |
| 26 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" | 27 #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" |
| 27 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
| 28 #include "chromeos/login/auth/key.h" | 29 #include "chromeos/login/auth/key.h" |
| 29 #include "chromeos/login/auth/user_context.h" | 30 #include "chromeos/login/auth/user_context.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 437 } |
| 437 } | 438 } |
| 438 return false; | 439 return false; |
| 439 } | 440 } |
| 440 | 441 |
| 441 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 442 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
| 442 // It should be removed by issue 251179. | 443 // It should be removed by issue 251179. |
| 443 | 444 |
| 444 void SupervisedUserCreationScreen::ApplyPicture() { | 445 void SupervisedUserCreationScreen::ApplyPicture() { |
| 445 std::string user_id = controller_->GetSupervisedUserId(); | 446 std::string user_id = controller_->GetSupervisedUserId(); |
| 446 UserManager* user_manager = UserManager::Get(); | 447 UserImageManager* image_manager = |
| 447 UserImageManager* image_manager = user_manager->GetUserImageManager(user_id); | 448 ChromeUserManager::Get()->GetUserImageManager(user_id); |
| 448 switch (selected_image_) { | 449 switch (selected_image_) { |
| 449 case user_manager::User::USER_IMAGE_EXTERNAL: | 450 case user_manager::User::USER_IMAGE_EXTERNAL: |
| 450 // Photo decoding may not have been finished yet. | 451 // Photo decoding may not have been finished yet. |
| 451 if (user_photo_.isNull()) { | 452 if (user_photo_.isNull()) { |
| 452 apply_photo_after_decoding_ = true; | 453 apply_photo_after_decoding_ = true; |
| 453 return; | 454 return; |
| 454 } | 455 } |
| 455 image_manager->SaveUserImage( | 456 image_manager->SaveUserImage( |
| 456 user_manager::UserImage::CreateAndEncode(user_photo_)); | 457 user_manager::UserImage::CreateAndEncode(user_photo_)); |
| 457 break; | 458 break; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 476 bool is_camera_present) { | 477 bool is_camera_present) { |
| 477 if (actor_) | 478 if (actor_) |
| 478 actor_->SetCameraPresent(is_camera_present); | 479 actor_->SetCameraPresent(is_camera_present); |
| 479 } | 480 } |
| 480 | 481 |
| 481 void SupervisedUserCreationScreen::OnGetSupervisedUsers( | 482 void SupervisedUserCreationScreen::OnGetSupervisedUsers( |
| 482 const base::DictionaryValue* users) { | 483 const base::DictionaryValue* users) { |
| 483 // Copy for passing to WebUI, contains only id, name and avatar URL. | 484 // Copy for passing to WebUI, contains only id, name and avatar URL. |
| 484 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); | 485 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); |
| 485 SupervisedUserManager* supervised_user_manager = | 486 SupervisedUserManager* supervised_user_manager = |
| 486 UserManager::Get()->GetSupervisedUserManager(); | 487 ChromeUserManager::Get()->GetSupervisedUserManager(); |
| 487 | 488 |
| 488 // Stored copy, contains all necessary information. | 489 // Stored copy, contains all necessary information. |
| 489 existing_users_.reset(new base::DictionaryValue()); | 490 existing_users_.reset(new base::DictionaryValue()); |
| 490 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); | 491 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); |
| 491 it.Advance()) { | 492 it.Advance()) { |
| 492 // Copy that would be stored in this class. | 493 // Copy that would be stored in this class. |
| 493 base::DictionaryValue* local_copy = | 494 base::DictionaryValue* local_copy = |
| 494 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); | 495 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); |
| 495 // Copy that would be passed to WebUI. It has some extra values for | 496 // Copy that would be passed to WebUI. It has some extra values for |
| 496 // displaying, but does not contain sensitive data, such as master password. | 497 // displaying, but does not contain sensitive data, such as master password. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; | 592 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; |
| 592 } else { | 593 } else { |
| 593 NOTREACHED() << "Unexpected image type: " << image_type; | 594 NOTREACHED() << "Unexpected image type: " << image_type; |
| 594 } | 595 } |
| 595 } | 596 } |
| 596 | 597 |
| 597 void SupervisedUserCreationScreen::OnImageAccepted() { | 598 void SupervisedUserCreationScreen::OnImageAccepted() { |
| 598 } | 599 } |
| 599 | 600 |
| 600 } // namespace chromeos | 601 } // namespace chromeos |
| OLD | NEW |