Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc

Issue 2142463002: ash: Remove media dependency from ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/settings/chromeos/change_picture_handler.h" 5 #include "chrome/browser/ui/webui/settings/chromeos/change_picture_handler.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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 (GetUserImageFileTypeInfo())); 164 (GetUserImageFileTypeInfo()));
164 165
165 select_file_dialog_->SelectFile( 166 select_file_dialog_->SelectFile(
166 ui::SelectFileDialog::SELECT_OPEN_FILE, 167 ui::SelectFileDialog::SELECT_OPEN_FILE,
167 l10n_util::GetStringUTF16(IDS_DOWNLOAD_TITLE), downloads_path, 168 l10n_util::GetStringUTF16(IDS_DOWNLOAD_TITLE), downloads_path,
168 &file_type_info, 0, FILE_PATH_LITERAL(""), GetBrowserWindow(), NULL); 169 &file_type_info, 0, FILE_PATH_LITERAL(""), GetBrowserWindow(), NULL);
169 } 170 }
170 171
171 void ChangePictureHandler::HandleDiscardPhoto(const base::ListValue* args) { 172 void ChangePictureHandler::HandleDiscardPhoto(const base::ListValue* args) {
172 DCHECK(args->empty()); 173 DCHECK(args->empty());
173 ash::PlaySystemSoundIfSpokenFeedback(SOUND_OBJECT_DELETE); 174 AccessibilityManager::Get()->PlayEarcon(
175 SOUND_OBJECT_DELETE, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED);
174 } 176 }
175 177
176 void ChangePictureHandler::HandlePhotoTaken(const base::ListValue* args) { 178 void ChangePictureHandler::HandlePhotoTaken(const base::ListValue* args) {
177 DCHECK_CURRENTLY_ON(BrowserThread::UI); 179 DCHECK_CURRENTLY_ON(BrowserThread::UI);
178 ash::PlaySystemSoundIfSpokenFeedback(SOUND_CAMERA_SNAP); 180 AccessibilityManager::Get()->PlayEarcon(
181 SOUND_CAMERA_SNAP, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED);
179 182
180 std::string image_url; 183 std::string image_url;
181 if (!args || args->GetSize() != 1 || !args->GetString(0, &image_url)) 184 if (!args || args->GetSize() != 1 || !args->GetString(0, &image_url))
182 NOTREACHED(); 185 NOTREACHED();
183 DCHECK(!image_url.empty()); 186 DCHECK(!image_url.empty());
184 187
185 std::string mime_type, charset, raw_data; 188 std::string mime_type, charset, raw_data;
186 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data)) 189 if (!net::DataURL::Parse(GURL(image_url), &mime_type, &charset, &raw_data))
187 NOTREACHED(); 190 NOTREACHED();
188 DCHECK_EQ("image/png", mime_type); 191 DCHECK_EQ("image/png", mime_type);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 Profile* profile = Profile::FromWebUI(web_ui()); 412 Profile* profile = Profile::FromWebUI(web_ui());
410 const user_manager::User* user = 413 const user_manager::User* user =
411 ProfileHelper::Get()->GetUserByProfile(profile); 414 ProfileHelper::Get()->GetUserByProfile(profile);
412 if (!user) 415 if (!user)
413 return user_manager::UserManager::Get()->GetActiveUser(); 416 return user_manager::UserManager::Get()->GetActiveUser();
414 return user; 417 return user;
415 } 418 }
416 419
417 } // namespace settings 420 } // namespace settings
418 } // namespace chromeos 421 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698