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

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

Issue 1585963004: Settings People Revamp: Add tests for ChromeOS Change Picture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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" 7 #include "ash/audio/sounds.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 void ChangePictureHandler::HandleSelectImage(const base::ListValue* args) { 271 void ChangePictureHandler::HandleSelectImage(const base::ListValue* args) {
272 std::string image_url; 272 std::string image_url;
273 std::string image_type; 273 std::string image_type;
274 if (!args || args->GetSize() != 2 || !args->GetString(0, &image_url) || 274 if (!args || args->GetSize() != 2 || !args->GetString(0, &image_url) ||
275 !args->GetString(1, &image_type)) { 275 !args->GetString(1, &image_type)) {
276 NOTREACHED(); 276 NOTREACHED();
277 return; 277 return;
278 } 278 }
279 DCHECK(!image_url.empty()); 279 // |image_url| may be empty unless |image_type| is "default".
280 DCHECK(!image_type.empty()); 280 DCHECK(!image_type.empty());
281 281
282 UserImageManager* user_image_manager = 282 UserImageManager* user_image_manager =
283 ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId()); 283 ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId());
284 int image_index = user_manager::User::USER_IMAGE_INVALID; 284 int image_index = user_manager::User::USER_IMAGE_INVALID;
285 bool waiting_for_camera_photo = false; 285 bool waiting_for_camera_photo = false;
286 286
287 if (image_type == "old") { 287 if (image_type == "old") {
288 // Previous image (from camera or manually uploaded) re-selected. 288 // Previous image (from camera or manually uploaded) re-selected.
289 DCHECK(!previous_image_.isNull()); 289 DCHECK(!previous_image_.isNull());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 Profile* profile = Profile::FromWebUI(web_ui()); 404 Profile* profile = Profile::FromWebUI(web_ui());
405 const user_manager::User* user = 405 const user_manager::User* user =
406 ProfileHelper::Get()->GetUserByProfile(profile); 406 ProfileHelper::Get()->GetUserByProfile(profile);
407 if (!user) 407 if (!user)
408 return user_manager::UserManager::Get()->GetActiveUser(); 408 return user_manager::UserManager::Get()->GetActiveUser();
409 return user; 409 return user;
410 } 410 }
411 411
412 } // namespace settings 412 } // namespace settings
413 } // namespace chromeos 413 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698