Chromium Code Reviews| 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" |
| 12 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 11 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 13 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 12 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 14 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 18 #include "chromeos/audio/chromeos_sounds.h" | 17 #include "chromeos/audio/chromeos_sounds.h" |
| 19 #include "components/user_manager/user.h" | 18 #include "components/user_manager/user.h" |
| 20 #include "components/user_manager/user_image/default_user_images.h" | 19 #include "components/user_manager/user_image/default_user_images.h" |
| 21 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
| 21 #include "media/audio/sounds/sounds_manager.h" | |
|
pkotwicz
2014/10/31 20:44:39
Previously, we were relying on ash/audio/sounds.h
| |
| 22 #include "net/base/data_url.h" | 22 #include "net/base/data_url.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 #if !defined(USE_ATHENA) | |
| 28 #include "ash/audio/sounds.h" | |
| 29 #endif | |
| 30 | |
| 27 namespace { | 31 namespace { |
| 28 | 32 |
| 29 const char kJsScreenPath[] = "login.UserImageScreen"; | 33 const char kJsScreenPath[] = "login.UserImageScreen"; |
| 30 | 34 |
| 31 } // namespace | 35 } // namespace |
| 32 | 36 |
| 33 namespace chromeos { | 37 namespace chromeos { |
| 34 | 38 |
| 35 UserImageScreenHandler::UserImageScreenHandler() | 39 UserImageScreenHandler::UserImageScreenHandler() |
| 36 : BaseScreenHandler(kJsScreenPath), | 40 : BaseScreenHandler(kJsScreenPath), |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 std::string mime_type, charset, raw_data; | 182 std::string mime_type, charset, raw_data; |
| 179 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) | 183 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) |
| 180 NOTREACHED(); | 184 NOTREACHED(); |
| 181 DCHECK_EQ("image/png", mime_type); | 185 DCHECK_EQ("image/png", mime_type); |
| 182 | 186 |
| 183 if (screen_) | 187 if (screen_) |
| 184 screen_->OnPhotoTaken(raw_data); | 188 screen_->OnPhotoTaken(raw_data); |
| 185 } | 189 } |
| 186 | 190 |
| 187 void UserImageScreenHandler::HandleTakePhoto() { | 191 void UserImageScreenHandler::HandleTakePhoto() { |
| 192 #if !defined(USE_ATHENA) | |
| 188 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); | 193 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); |
| 194 #endif | |
| 189 } | 195 } |
| 190 | 196 |
| 191 void UserImageScreenHandler::HandleDiscardPhoto() { | 197 void UserImageScreenHandler::HandleDiscardPhoto() { |
| 198 #if !defined(USE_ATHENA) | |
| 192 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); | 199 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); |
| 200 #endif | |
| 193 } | 201 } |
| 194 | 202 |
| 195 void UserImageScreenHandler::HandleSelectImage(const std::string& image_url, | 203 void UserImageScreenHandler::HandleSelectImage(const std::string& image_url, |
| 196 const std::string& image_type, | 204 const std::string& image_type, |
| 197 bool is_user_selection) { | 205 bool is_user_selection) { |
| 198 if (screen_) | 206 if (screen_) |
| 199 screen_->OnImageSelected(image_type, image_url, is_user_selection); | 207 screen_->OnImageSelected(image_type, image_url, is_user_selection); |
| 200 } | 208 } |
| 201 | 209 |
| 202 void UserImageScreenHandler::HandleImageAccepted() { | 210 void UserImageScreenHandler::HandleImageAccepted() { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 214 | 222 |
| 215 void UserImageScreenHandler::SetCameraPresent(bool present) { | 223 void UserImageScreenHandler::SetCameraPresent(bool present) { |
| 216 CallJS("setCameraPresent", present); | 224 CallJS("setCameraPresent", present); |
| 217 } | 225 } |
| 218 | 226 |
| 219 void UserImageScreenHandler::HideCurtain() { | 227 void UserImageScreenHandler::HideCurtain() { |
| 220 CallJS("hideCurtain"); | 228 CallJS("hideCurtain"); |
| 221 } | 229 } |
| 222 | 230 |
| 223 } // namespace chromeos | 231 } // namespace chromeos |
| OLD | NEW |