Chromium Code Reviews| 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/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h" |
| 6 | 6 |
| 7 #include "ash/audio/sounds.h" | 7 #include "ash/audio/sounds.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/user_selection_screen.h" |
| 11 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_flow .h" | 11 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_flow .h" |
| 12 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 13 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 13 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 15 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 16 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 16 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "chromeos/audio/chromeos_sounds.h" | 19 #include "chromeos/audio/chromeos_sounds.h" |
| 20 #include "components/login/localized_values_builder.h" | 20 #include "components/login/localized_values_builder.h" |
| 21 #include "components/signin/core/account_id/account_id.h" | |
| 21 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
| 22 #include "components/user_manager/user_type.h" | 23 #include "components/user_manager/user_type.h" |
| 23 #include "google_apis/gaia/gaia_auth_util.h" | 24 #include "google_apis/gaia/gaia_auth_util.h" |
| 24 #include "grit/browser_resources.h" | 25 #include "grit/browser_resources.h" |
| 25 #include "net/base/data_url.h" | 26 #include "net/base/data_url.h" |
| 26 #include "net/base/escape.h" | 27 #include "net/base/escape.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 | 30 |
| 30 const char kJsScreenPath[] = "login.SupervisedUserCreationScreen"; | 31 const char kJsScreenPath[] = "login.SupervisedUserCreationScreen"; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 if (!delegate_) | 386 if (!delegate_) |
| 386 return; | 387 return; |
| 387 | 388 |
| 388 ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( | 389 ShowStatusMessage(true /* progress */, l10n_util::GetStringUTF16( |
| 389 IDS_CREATE_SUPERVISED_USER_CREATION_CREATION_PROGRESS_MESSAGE)); | 390 IDS_CREATE_SUPERVISED_USER_CREATION_CREATION_PROGRESS_MESSAGE)); |
| 390 | 391 |
| 391 delegate_->ImportSupervisedUserWithPassword(user_id, password); | 392 delegate_->ImportSupervisedUserWithPassword(user_id, password); |
| 392 } | 393 } |
| 393 | 394 |
| 394 void SupervisedUserCreationScreenHandler::HandleAuthenticateManager( | 395 void SupervisedUserCreationScreenHandler::HandleAuthenticateManager( |
| 395 const std::string& raw_manager_username, | 396 const AccountId& manager_raw_account_id, |
| 396 const std::string& manager_password) { | 397 const std::string& manager_password) { |
| 397 const std::string manager_username = | 398 const AccountId manager_account_id = AccountId::FromUserEmailGaiaId( |
| 398 gaia::SanitizeEmail(raw_manager_username); | 399 gaia::SanitizeEmail(manager_raw_account_id.GetUserEmail()), |
| 399 delegate_->AuthenticateManager(manager_username, manager_password); | 400 manager_raw_account_id.GetGaiaId()); |
| 401 ; | |
|
dzhioev (left Google)
2015/11/13 23:17:37
nit: remove ;
Alexander Alekseev
2015/11/14 00:27:42
Done.
| |
| 402 delegate_->AuthenticateManager(manager_account_id.GetUserEmail(), | |
| 403 manager_password); | |
| 400 } | 404 } |
| 401 | 405 |
| 402 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. | 406 // TODO(antrim) : this is an explicit code duplications with UserImageScreen. |
| 403 // It should be removed by issue 251179. | 407 // It should be removed by issue 251179. |
| 404 void SupervisedUserCreationScreenHandler::HandleGetImages() { | 408 void SupervisedUserCreationScreenHandler::HandleGetImages() { |
| 405 base::ListValue image_urls; | 409 base::ListValue image_urls; |
| 406 for (int i = user_manager::kFirstDefaultImageIndex; | 410 for (int i = user_manager::kFirstDefaultImageIndex; |
| 407 i < user_manager::kDefaultImagesCount; | 411 i < user_manager::kDefaultImagesCount; |
| 408 ++i) { | 412 ++i) { |
| 409 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); | 413 scoped_ptr<base::DictionaryValue> image_data(new base::DictionaryValue); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { | 464 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { |
| 461 CallJS("setCameraPresent", present); | 465 CallJS("setCameraPresent", present); |
| 462 } | 466 } |
| 463 | 467 |
| 464 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( | 468 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( |
| 465 const base::ListValue* users) { | 469 const base::ListValue* users) { |
| 466 CallJS("setExistingSupervisedUsers", *users); | 470 CallJS("setExistingSupervisedUsers", *users); |
| 467 } | 471 } |
| 468 | 472 |
| 469 } // namespace chromeos | 473 } // namespace chromeos |
| OLD | NEW |