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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 439 } |
439 } | 440 } |
440 return false; | 441 return false; |
441 } | 442 } |
442 | 443 |
443 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 444 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
444 // It should be removed by issue 251179. | 445 // It should be removed by issue 251179. |
445 | 446 |
446 void SupervisedUserCreationScreen::ApplyPicture() { | 447 void SupervisedUserCreationScreen::ApplyPicture() { |
447 std::string user_id = controller_->GetSupervisedUserId(); | 448 std::string user_id = controller_->GetSupervisedUserId(); |
448 UserManager* user_manager = UserManager::Get(); | 449 UserImageManager* image_manager = |
449 UserImageManager* image_manager = user_manager->GetUserImageManager(user_id); | 450 ChromeUserManager::Get()->GetUserImageManager(user_id); |
450 switch (selected_image_) { | 451 switch (selected_image_) { |
451 case user_manager::User::USER_IMAGE_EXTERNAL: | 452 case user_manager::User::USER_IMAGE_EXTERNAL: |
452 // Photo decoding may not have been finished yet. | 453 // Photo decoding may not have been finished yet. |
453 if (user_photo_.isNull()) { | 454 if (user_photo_.isNull()) { |
454 apply_photo_after_decoding_ = true; | 455 apply_photo_after_decoding_ = true; |
455 return; | 456 return; |
456 } | 457 } |
457 image_manager->SaveUserImage( | 458 image_manager->SaveUserImage( |
458 user_manager::UserImage::CreateAndEncode(user_photo_)); | 459 user_manager::UserImage::CreateAndEncode(user_photo_)); |
459 break; | 460 break; |
(...skipping 18 matching lines...) Expand all Loading... |
478 bool is_camera_present) { | 479 bool is_camera_present) { |
479 if (actor_) | 480 if (actor_) |
480 actor_->SetCameraPresent(is_camera_present); | 481 actor_->SetCameraPresent(is_camera_present); |
481 } | 482 } |
482 | 483 |
483 void SupervisedUserCreationScreen::OnGetSupervisedUsers( | 484 void SupervisedUserCreationScreen::OnGetSupervisedUsers( |
484 const base::DictionaryValue* users) { | 485 const base::DictionaryValue* users) { |
485 // Copy for passing to WebUI, contains only id, name and avatar URL. | 486 // Copy for passing to WebUI, contains only id, name and avatar URL. |
486 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); | 487 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); |
487 SupervisedUserManager* supervised_user_manager = | 488 SupervisedUserManager* supervised_user_manager = |
488 UserManager::Get()->GetSupervisedUserManager(); | 489 ChromeUserManager::Get()->GetSupervisedUserManager(); |
489 | 490 |
490 // Stored copy, contains all necessary information. | 491 // Stored copy, contains all necessary information. |
491 existing_users_.reset(new base::DictionaryValue()); | 492 existing_users_.reset(new base::DictionaryValue()); |
492 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); | 493 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); |
493 it.Advance()) { | 494 it.Advance()) { |
494 // Copy that would be stored in this class. | 495 // Copy that would be stored in this class. |
495 base::DictionaryValue* local_copy = | 496 base::DictionaryValue* local_copy = |
496 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); | 497 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); |
497 // Copy that would be passed to WebUI. It has some extra values for | 498 // Copy that would be passed to WebUI. It has some extra values for |
498 // displaying, but does not contain sensitive data, such as master password. | 499 // displaying, but does not contain sensitive data, such as master password. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; | 594 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; |
594 } else { | 595 } else { |
595 NOTREACHED() << "Unexpected image type: " << image_type; | 596 NOTREACHED() << "Unexpected image type: " << image_type; |
596 } | 597 } |
597 } | 598 } |
598 | 599 |
599 void SupervisedUserCreationScreen::OnImageAccepted() { | 600 void SupervisedUserCreationScreen::OnImageAccepted() { |
600 } | 601 } |
601 | 602 |
602 } // namespace chromeos | 603 } // namespace chromeos |
OLD | NEW |