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/options/chromeos/change_picture_options_handle
r.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/change_picture_options_handle
r.h" |
6 | 6 |
7 #include "ash/audio/sounds.h" | |
8 #include "base/bind.h" | 7 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 11 #include "base/path_service.h" |
13 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 14 #include "base/values.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
17 #include "chrome/browser/chromeos/camera_presence_notifier.h" | 17 #include "chrome/browser/chromeos/camera_presence_notifier.h" |
18 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" | 18 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" |
19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
20 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.h" | 20 #include "chrome/browser/chromeos/login/users/default_user_image/default_user_im
ages.h" |
21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
22 #include "chrome/browser/ui/browser_finder.h" | 22 #include "chrome/browser/ui/browser_finder.h" |
23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/browser/ui/chrome_select_file_policy.h" | 24 #include "chrome/browser/ui/chrome_select_file_policy.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
29 #include "chromeos/audio/chromeos_sounds.h" | 29 #include "chromeos/audio/chromeos_sounds.h" |
30 #include "components/user_manager/user.h" | 30 #include "components/user_manager/user.h" |
31 #include "components/user_manager/user_image/user_image.h" | 31 #include "components/user_manager/user_image/user_image.h" |
32 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
35 #include "content/public/browser/web_ui.h" | 35 #include "content/public/browser/web_ui.h" |
36 #include "content/public/common/url_constants.h" | 36 #include "content/public/common/url_constants.h" |
37 #include "grit/browser_resources.h" | 37 #include "grit/browser_resources.h" |
| 38 #include "media/audio/sounds/sounds_manager.h" |
38 #include "net/base/data_url.h" | 39 #include "net/base/data_url.h" |
39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
41 #include "ui/base/webui/web_ui_util.h" | 42 #include "ui/base/webui/web_ui_util.h" |
42 #include "ui/views/widget/widget.h" | 43 #include "ui/views/widget/widget.h" |
43 #include "url/gurl.h" | 44 #include "url/gurl.h" |
44 | 45 |
45 using content::BrowserThread; | 46 using content::BrowserThread; |
46 | 47 |
47 namespace chromeos { | 48 namespace chromeos { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 &file_type_info, | 208 &file_type_info, |
208 0, | 209 0, |
209 FILE_PATH_LITERAL(""), | 210 FILE_PATH_LITERAL(""), |
210 GetBrowserWindow(), | 211 GetBrowserWindow(), |
211 NULL); | 212 NULL); |
212 } | 213 } |
213 | 214 |
214 void ChangePictureOptionsHandler::HandleTakePhoto( | 215 void ChangePictureOptionsHandler::HandleTakePhoto( |
215 const base::ListValue* args) { | 216 const base::ListValue* args) { |
216 DCHECK(args->empty()); | 217 DCHECK(args->empty()); |
217 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); | 218 AccessibilityManager::Get()->PlayEarcon( |
| 219 SOUND_CAMERA_SNAP, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
218 } | 220 } |
219 | 221 |
220 void ChangePictureOptionsHandler::HandleDiscardPhoto( | 222 void ChangePictureOptionsHandler::HandleDiscardPhoto( |
221 const base::ListValue* args) { | 223 const base::ListValue* args) { |
222 DCHECK(args->empty()); | 224 DCHECK(args->empty()); |
223 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); | 225 AccessibilityManager::Get()->PlayEarcon( |
| 226 SOUND_OBJECT_DELETE, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
224 } | 227 } |
225 | 228 |
226 void ChangePictureOptionsHandler::HandlePhotoTaken( | 229 void ChangePictureOptionsHandler::HandlePhotoTaken( |
227 const base::ListValue* args) { | 230 const base::ListValue* args) { |
228 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 231 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
229 std::string image_url; | 232 std::string image_url; |
230 if (!args || args->GetSize() != 1 || !args->GetString(0, &image_url)) | 233 if (!args || args->GetSize() != 1 || !args->GetString(0, &image_url)) |
231 NOTREACHED(); | 234 NOTREACHED(); |
232 DCHECK(!image_url.empty()); | 235 DCHECK(!image_url.empty()); |
233 | 236 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 Profile* profile = Profile::FromWebUI(web_ui()); | 470 Profile* profile = Profile::FromWebUI(web_ui()); |
468 const user_manager::User* user = | 471 const user_manager::User* user = |
469 ProfileHelper::Get()->GetUserByProfile(profile); | 472 ProfileHelper::Get()->GetUserByProfile(profile); |
470 if (!user) | 473 if (!user) |
471 return user_manager::UserManager::Get()->GetActiveUser(); | 474 return user_manager::UserManager::Get()->GetActiveUser(); |
472 return user; | 475 return user; |
473 } | 476 } |
474 | 477 |
475 } // namespace options | 478 } // namespace options |
476 } // namespace chromeos | 479 } // namespace chromeos |
OLD | NEW |