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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 (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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 SendOldImage( 299 SendOldImage(
300 default_user_image::GetDefaultImageUrl(previous_image_index_)); 300 default_user_image::GetDefaultImageUrl(previous_image_index_));
301 } 301 }
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 void ChangePictureOptionsHandler::SendProfileImage(const gfx::ImageSkia& image, 306 void ChangePictureOptionsHandler::SendProfileImage(const gfx::ImageSkia& image,
307 bool should_select) { 307 bool should_select) {
308 base::StringValue data_url(webui::GetBitmapDataUrl(*image.bitmap())); 308 base::StringValue data_url(webui::GetBitmapDataUrl(*image.bitmap()));
309 base::FundamentalValue select(should_select); 309 base::Value select(should_select);
310 web_ui()->CallJavascriptFunctionUnsafe("ChangePictureOptions.setProfileImage", 310 web_ui()->CallJavascriptFunctionUnsafe("ChangePictureOptions.setProfileImage",
311 data_url, select); 311 data_url, select);
312 } 312 }
313 313
314 void ChangePictureOptionsHandler::UpdateProfileImage() { 314 void ChangePictureOptionsHandler::UpdateProfileImage() {
315 UserImageManager* user_image_manager = 315 UserImageManager* user_image_manager =
316 ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId()); 316 ChromeUserManager::Get()->GetUserImageManager(GetUser()->GetAccountId());
317 // If we have a downloaded profile image and haven't sent it in 317 // If we have a downloaded profile image and haven't sent it in
318 // |SendSelectedImage|, send it now (without selecting). 318 // |SendSelectedImage|, send it now (without selecting).
319 if (previous_image_index_ != user_manager::User::USER_IMAGE_PROFILE && 319 if (previous_image_index_ != user_manager::User::USER_IMAGE_PROFILE &&
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 ChromeUserManager::Get() 418 ChromeUserManager::Get()
419 ->GetUserImageManager(GetUser()->GetAccountId()) 419 ->GetUserImageManager(GetUser()->GetAccountId())
420 ->SaveUserImage(user_manager::UserImage::CreateAndEncode(photo)); 420 ->SaveUserImage(user_manager::UserImage::CreateAndEncode(photo));
421 UMA_HISTOGRAM_ENUMERATION("UserImage.ChangeChoice", 421 UMA_HISTOGRAM_ENUMERATION("UserImage.ChangeChoice",
422 default_user_image::kHistogramImageFromCamera, 422 default_user_image::kHistogramImageFromCamera,
423 default_user_image::kHistogramImagesCount); 423 default_user_image::kHistogramImagesCount);
424 VLOG(1) << "Selected camera photo"; 424 VLOG(1) << "Selected camera photo";
425 } 425 }
426 426
427 void ChangePictureOptionsHandler::SetCameraPresent(bool present) { 427 void ChangePictureOptionsHandler::SetCameraPresent(bool present) {
428 base::FundamentalValue present_value(present); 428 base::Value present_value(present);
429 429
430 web_ui()->CallJavascriptFunctionUnsafe( 430 web_ui()->CallJavascriptFunctionUnsafe(
431 "ChangePictureOptions.setCameraPresent", present_value); 431 "ChangePictureOptions.setCameraPresent", present_value);
432 } 432 }
433 433
434 void ChangePictureOptionsHandler::OnCameraPresenceCheckDone( 434 void ChangePictureOptionsHandler::OnCameraPresenceCheckDone(
435 bool is_camera_present) { 435 bool is_camera_present) {
436 SetCameraPresent(is_camera_present); 436 SetCameraPresent(is_camera_present);
437 } 437 }
438 438
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Profile* profile = Profile::FromWebUI(web_ui()); 472 Profile* profile = Profile::FromWebUI(web_ui());
473 const user_manager::User* user = 473 const user_manager::User* user =
474 ProfileHelper::Get()->GetUserByProfile(profile); 474 ProfileHelper::Get()->GetUserByProfile(profile);
475 if (!user) 475 if (!user)
476 return user_manager::UserManager::Get()->GetActiveUser(); 476 return user_manager::UserManager::Get()->GetActiveUser();
477 return user; 477 return user;
478 } 478 }
479 479
480 } // namespace options 480 } // namespace options
481 } // namespace chromeos 481 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698