| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/managed/locally_managed_user_creation_sc
reen.h" | 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_sc
reen.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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void LocallyManagedUserCreationScreen::FinishFlow() { | 189 void LocallyManagedUserCreationScreen::FinishFlow() { |
| 190 controller_->FinishCreation(); | 190 controller_->FinishCreation(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void LocallyManagedUserCreationScreen::AuthenticateManager( | 193 void LocallyManagedUserCreationScreen::AuthenticateManager( |
| 194 const std::string& manager_id, | 194 const std::string& manager_id, |
| 195 const std::string& manager_password) { | 195 const std::string& manager_password) { |
| 196 // Make sure no two controllers exist at the same time. | 196 // Make sure no two controllers exist at the same time. |
| 197 controller_.reset(); | 197 controller_.reset(); |
| 198 SupervisedUserAuthentication* authentication = | 198 SupervisedUserAuthentication* authentication = |
| 199 UserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 199 GetUserManager()->GetSupervisedUserManager()->GetAuthentication(); |
| 200 | 200 |
| 201 if (authentication->GetStableSchema() == | 201 if (authentication->GetStableSchema() == |
| 202 SupervisedUserAuthentication::SCHEMA_PLAIN) { | 202 SupervisedUserAuthentication::SCHEMA_PLAIN) { |
| 203 controller_.reset(new ManagedUserCreationControllerOld(this, manager_id)); | 203 controller_.reset(new ManagedUserCreationControllerOld(this, manager_id)); |
| 204 } else { | 204 } else { |
| 205 controller_.reset(new ManagedUserCreationControllerNew(this, manager_id)); | 205 controller_.reset(new ManagedUserCreationControllerNew(this, manager_id)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 UserContext user_context(manager_id); | 208 UserContext user_context(manager_id); |
| 209 user_context.SetKey(Key(manager_password)); | 209 user_context.SetKey(Key(manager_password)); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 return false; | 446 return false; |
| 447 } | 447 } |
| 448 | 448 |
| 449 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 449 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
| 450 // It should be removed by issue 251179. | 450 // It should be removed by issue 251179. |
| 451 | 451 |
| 452 void LocallyManagedUserCreationScreen::ApplyPicture() { | 452 void LocallyManagedUserCreationScreen::ApplyPicture() { |
| 453 std::string user_id = controller_->GetManagedUserId(); | 453 std::string user_id = controller_->GetManagedUserId(); |
| 454 UserManager* user_manager = UserManager::Get(); | 454 UserManager* user_manager = GetUserManager(); |
| 455 UserImageManager* image_manager = user_manager->GetUserImageManager(user_id); | 455 UserImageManager* image_manager = user_manager->GetUserImageManager(user_id); |
| 456 switch (selected_image_) { | 456 switch (selected_image_) { |
| 457 case User::kExternalImageIndex: | 457 case User::kExternalImageIndex: |
| 458 // Photo decoding may not have been finished yet. | 458 // Photo decoding may not have been finished yet. |
| 459 if (user_photo_.isNull()) { | 459 if (user_photo_.isNull()) { |
| 460 apply_photo_after_decoding_ = true; | 460 apply_photo_after_decoding_ = true; |
| 461 return; | 461 return; |
| 462 } | 462 } |
| 463 image_manager->SaveUserImage(UserImage::CreateAndEncode(user_photo_)); | 463 image_manager->SaveUserImage(UserImage::CreateAndEncode(user_photo_)); |
| 464 break; | 464 break; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 482 bool is_camera_present) { | 482 bool is_camera_present) { |
| 483 if (actor_) | 483 if (actor_) |
| 484 actor_->SetCameraPresent(is_camera_present); | 484 actor_->SetCameraPresent(is_camera_present); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void LocallyManagedUserCreationScreen::OnGetManagedUsers( | 487 void LocallyManagedUserCreationScreen::OnGetManagedUsers( |
| 488 const base::DictionaryValue* users) { | 488 const base::DictionaryValue* users) { |
| 489 // Copy for passing to WebUI, contains only id, name and avatar URL. | 489 // Copy for passing to WebUI, contains only id, name and avatar URL. |
| 490 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); | 490 scoped_ptr<base::ListValue> ui_users(new base::ListValue()); |
| 491 SupervisedUserManager* supervised_user_manager = | 491 SupervisedUserManager* supervised_user_manager = |
| 492 UserManager::Get()->GetSupervisedUserManager(); | 492 GetUserManager()->GetSupervisedUserManager(); |
| 493 | 493 |
| 494 // Stored copy, contains all necessary information. | 494 // Stored copy, contains all necessary information. |
| 495 existing_users_.reset(new base::DictionaryValue()); | 495 existing_users_.reset(new base::DictionaryValue()); |
| 496 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); | 496 for (base::DictionaryValue::Iterator it(*users); !it.IsAtEnd(); |
| 497 it.Advance()) { | 497 it.Advance()) { |
| 498 // Copy that would be stored in this class. | 498 // Copy that would be stored in this class. |
| 499 base::DictionaryValue* local_copy = | 499 base::DictionaryValue* local_copy = |
| 500 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); | 500 static_cast<base::DictionaryValue*>(it.value().DeepCopy()); |
| 501 // Copy that would be passed to WebUI. It has some extra values for | 501 // Copy that would be passed to WebUI. It has some extra values for |
| 502 // displaying, but does not contain sensitive data, such as master password. | 502 // displaying, but does not contain sensitive data, such as master password. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 selected_image_ = User::kExternalImageIndex; | 595 selected_image_ = User::kExternalImageIndex; |
| 596 } else { | 596 } else { |
| 597 NOTREACHED() << "Unexpected image type: " << image_type; | 597 NOTREACHED() << "Unexpected image type: " << image_type; |
| 598 } | 598 } |
| 599 } | 599 } |
| 600 | 600 |
| 601 void LocallyManagedUserCreationScreen::OnImageAccepted() { | 601 void LocallyManagedUserCreationScreen::OnImageAccepted() { |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |