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" | 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 | 263 |
264 void ChangePictureOptionsHandler::SendSelectedImage() { | 264 void ChangePictureOptionsHandler::SendSelectedImage() { |
265 const User* user = GetUser(); | 265 const User* user = GetUser(); |
266 DCHECK(!user->email().empty()); | 266 DCHECK(!user->email().empty()); |
267 | 267 |
268 previous_image_index_ = user->image_index(); | 268 previous_image_index_ = user->image_index(); |
269 switch (previous_image_index_) { | 269 switch (previous_image_index_) { |
270 case User::kExternalImageIndex: { | 270 case User::kExternalImageIndex: { |
271 // User has image from camera/file, record it and add to the image list. | 271 // User has image from camera/file, record it and add to the image list. |
272 previous_image_ = user->image(); | 272 previous_image_ = user->GetImage(); |
273 SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap())); | 273 SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap())); |
274 break; | 274 break; |
275 } | 275 } |
276 case User::kProfileImageIndex: { | 276 case User::kProfileImageIndex: { |
277 // User has his/her Profile image as the current image. | 277 // User has his/her Profile image as the current image. |
278 SendProfileImage(user->image(), true); | 278 SendProfileImage(user->GetImage(), true); |
279 break; | 279 break; |
280 } | 280 } |
281 default: { | 281 default: { |
282 DCHECK(previous_image_index_ >= 0 && | 282 DCHECK(previous_image_index_ >= 0 && |
283 previous_image_index_ < kDefaultImagesCount); | 283 previous_image_index_ < kDefaultImagesCount); |
284 if (previous_image_index_ >= kFirstDefaultImageIndex) { | 284 if (previous_image_index_ >= kFirstDefaultImageIndex) { |
285 // User has image from the current set of default images. | 285 // User has image from the current set of default images. |
286 base::StringValue image_url(GetDefaultImageUrl(previous_image_index_)); | 286 base::StringValue image_url(GetDefaultImageUrl(previous_image_index_)); |
287 web_ui()->CallJavascriptFunction( | 287 web_ui()->CallJavascriptFunction( |
288 "ChangePictureOptions.setSelectedImage", image_url); | 288 "ChangePictureOptions.setSelectedImage", image_url); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 User* ChangePictureOptionsHandler::GetUser() const { | 465 User* ChangePictureOptionsHandler::GetUser() const { |
466 Profile* profile = Profile::FromWebUI(web_ui()); | 466 Profile* profile = Profile::FromWebUI(web_ui()); |
467 User* user = UserManager::Get()->GetUserByProfile(profile); | 467 User* user = UserManager::Get()->GetUserByProfile(profile); |
468 if (!user) | 468 if (!user) |
469 return UserManager::Get()->GetActiveUser(); | 469 return UserManager::Get()->GetActiveUser(); |
470 return user; | 470 return user; |
471 } | 471 } |
472 | 472 |
473 } // namespace options | 473 } // namespace options |
474 } // namespace chromeos | 474 } // namespace chromeos |
OLD | NEW |