| 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/ui/webui/chromeos/login/user_image_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" |
| 6 | 6 |
| 7 #include "ash/audio/sounds.h" | |
| 8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 8 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 11 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/chromeos/accessibility/accessibility_manager.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/user_image_model.h" | 13 #include "chrome/browser/chromeos/login/screens/user_image_model.h" |
| 14 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 14 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 15 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.h" | 15 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.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/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "chromeos/audio/chromeos_sounds.h" | 20 #include "chromeos/audio/chromeos_sounds.h" |
| 21 #include "components/login/localized_values_builder.h" | 21 #include "components/login/localized_values_builder.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 std::string mime_type, charset, raw_data; | 159 std::string mime_type, charset, raw_data; |
| 160 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) | 160 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) |
| 161 NOTREACHED(); | 161 NOTREACHED(); |
| 162 DCHECK_EQ("image/png", mime_type); | 162 DCHECK_EQ("image/png", mime_type); |
| 163 | 163 |
| 164 if (model_) | 164 if (model_) |
| 165 model_->OnPhotoTaken(raw_data); | 165 model_->OnPhotoTaken(raw_data); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void UserImageScreenHandler::HandleTakePhoto() { | 168 void UserImageScreenHandler::HandleTakePhoto() { |
| 169 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); | 169 AccessibilityManager::Get()->PlayEarcon( |
| 170 SOUND_CAMERA_SNAP, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void UserImageScreenHandler::HandleDiscardPhoto() { | 173 void UserImageScreenHandler::HandleDiscardPhoto() { |
| 173 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); | 174 AccessibilityManager::Get()->PlayEarcon( |
| 175 SOUND_OBJECT_DELETE, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
| 174 } | 176 } |
| 175 | 177 |
| 176 void UserImageScreenHandler::HandleSelectImage(const std::string& image_url, | 178 void UserImageScreenHandler::HandleSelectImage(const std::string& image_url, |
| 177 const std::string& image_type, | 179 const std::string& image_type, |
| 178 bool is_user_selection) { | 180 bool is_user_selection) { |
| 179 if (model_) | 181 if (model_) |
| 180 model_->OnImageSelected(image_type, image_url, is_user_selection); | 182 model_->OnImageSelected(image_type, image_url, is_user_selection); |
| 181 } | 183 } |
| 182 | 184 |
| 183 void UserImageScreenHandler::HandleImageAccepted() { | 185 void UserImageScreenHandler::HandleImageAccepted() { |
| 184 if (model_) | 186 if (model_) |
| 185 model_->OnImageAccepted(); | 187 model_->OnImageAccepted(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 void UserImageScreenHandler::HandleScreenShown() { | 190 void UserImageScreenHandler::HandleScreenShown() { |
| 189 DCHECK(!screen_show_time_.is_null()); | 191 DCHECK(!screen_show_time_.is_null()); |
| 190 | 192 |
| 191 base::TimeDelta delta = base::Time::Now() - screen_show_time_; | 193 base::TimeDelta delta = base::Time::Now() - screen_show_time_; |
| 192 VLOG(1) << "Screen load time: " << delta.InSecondsF(); | 194 VLOG(1) << "Screen load time: " << delta.InSecondsF(); |
| 193 UMA_HISTOGRAM_TIMES("UserImage.ScreenIsShownTime", delta); | 195 UMA_HISTOGRAM_TIMES("UserImage.ScreenIsShownTime", delta); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void UserImageScreenHandler::HideCurtain() { | 198 void UserImageScreenHandler::HideCurtain() { |
| 197 CallJS("hideCurtain"); | 199 CallJS("hideCurtain"); |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace chromeos | 202 } // namespace chromeos |
| OLD | NEW |