| 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" | |
| 8 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.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_screen.h" | 16 #include "chrome/browser/ui/webui/chromeos/login/oobe_screen.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/signin/core/account_id/account_id.h" |
| 22 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
| 23 #include "components/user_manager/user_type.h" | 23 #include "components/user_manager/user_type.h" |
| 24 #include "google_apis/gaia/gaia_auth_util.h" | 24 #include "google_apis/gaia/gaia_auth_util.h" |
| 25 #include "grit/browser_resources.h" | 25 #include "grit/browser_resources.h" |
| 26 #include "media/audio/sounds/sounds_manager.h" |
| 26 #include "net/base/data_url.h" | 27 #include "net/base/data_url.h" |
| 27 #include "net/base/escape.h" | 28 #include "net/base/escape.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 | 31 |
| 31 const char kJsScreenPath[] = "login.SupervisedUserCreationScreen"; | 32 const char kJsScreenPath[] = "login.SupervisedUserCreationScreen"; |
| 32 | 33 |
| 33 namespace chromeos { | 34 namespace chromeos { |
| 34 | 35 |
| 35 SupervisedUserCreationScreenHandler::SupervisedUserCreationScreenHandler() | 36 SupervisedUserCreationScreenHandler::SupervisedUserCreationScreenHandler() |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 std::string mime_type, charset, raw_data; | 430 std::string mime_type, charset, raw_data; |
| 430 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) | 431 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) |
| 431 NOTREACHED(); | 432 NOTREACHED(); |
| 432 DCHECK_EQ("image/png", mime_type); | 433 DCHECK_EQ("image/png", mime_type); |
| 433 | 434 |
| 434 if (delegate_) | 435 if (delegate_) |
| 435 delegate_->OnPhotoTaken(raw_data); | 436 delegate_->OnPhotoTaken(raw_data); |
| 436 } | 437 } |
| 437 | 438 |
| 438 void SupervisedUserCreationScreenHandler::HandleTakePhoto() { | 439 void SupervisedUserCreationScreenHandler::HandleTakePhoto() { |
| 439 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); | 440 AccessibilityManager::Get()->PlayEarcon( |
| 441 SOUND_CAMERA_SNAP, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
| 440 } | 442 } |
| 441 | 443 |
| 442 void SupervisedUserCreationScreenHandler::HandleDiscardPhoto() { | 444 void SupervisedUserCreationScreenHandler::HandleDiscardPhoto() { |
| 443 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); | 445 AccessibilityManager::Get()->PlayEarcon( |
| 446 SOUND_OBJECT_DELETE, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
| 444 } | 447 } |
| 445 | 448 |
| 446 void SupervisedUserCreationScreenHandler::HandleSelectImage( | 449 void SupervisedUserCreationScreenHandler::HandleSelectImage( |
| 447 const std::string& image_url, | 450 const std::string& image_url, |
| 448 const std::string& image_type) { | 451 const std::string& image_type) { |
| 449 if (delegate_) | 452 if (delegate_) |
| 450 delegate_->OnImageSelected(image_type, image_url); | 453 delegate_->OnImageSelected(image_type, image_url); |
| 451 } | 454 } |
| 452 | 455 |
| 453 void SupervisedUserCreationScreenHandler::HandleCurrentSupervisedUserPage( | 456 void SupervisedUserCreationScreenHandler::HandleCurrentSupervisedUserPage( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 464 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { | 467 void SupervisedUserCreationScreenHandler::SetCameraPresent(bool present) { |
| 465 CallJS("setCameraPresent", present); | 468 CallJS("setCameraPresent", present); |
| 466 } | 469 } |
| 467 | 470 |
| 468 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( | 471 void SupervisedUserCreationScreenHandler::ShowExistingSupervisedUsers( |
| 469 const base::ListValue* users) { | 472 const base::ListValue* users) { |
| 470 CallJS("setExistingSupervisedUsers", *users); | 473 CallJS("setExistingSupervisedUsers", *users); |
| 471 } | 474 } |
| 472 | 475 |
| 473 } // namespace chromeos | 476 } // namespace chromeos |
| OLD | NEW |