| 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 <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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 CameraPresenceNotifier::GetInstance()->AddObserver(this); | 261 CameraPresenceNotifier::GetInstance()->AddObserver(this); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void ChangePictureOptionsHandler::HandlePageHidden( | 264 void ChangePictureOptionsHandler::HandlePageHidden( |
| 265 const base::ListValue* args) { | 265 const base::ListValue* args) { |
| 266 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); | 266 CameraPresenceNotifier::GetInstance()->RemoveObserver(this); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void ChangePictureOptionsHandler::SendSelectedImage() { | 269 void ChangePictureOptionsHandler::SendSelectedImage() { |
| 270 const user_manager::User* user = GetUser(); | 270 const user_manager::User* user = GetUser(); |
| 271 DCHECK(!user->email().empty()); | 271 DCHECK(user->GetAccountId().is_valid()); |
| 272 | 272 |
| 273 previous_image_index_ = user->image_index(); | 273 previous_image_index_ = user->image_index(); |
| 274 switch (previous_image_index_) { | 274 switch (previous_image_index_) { |
| 275 case user_manager::User::USER_IMAGE_EXTERNAL: { | 275 case user_manager::User::USER_IMAGE_EXTERNAL: { |
| 276 // User has image from camera/file, record it and add to the image list. | 276 // User has image from camera/file, record it and add to the image list. |
| 277 previous_image_ = user->GetImage(); | 277 previous_image_ = user->GetImage(); |
| 278 SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap())); | 278 SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap())); |
| 279 break; | 279 break; |
| 280 } | 280 } |
| 281 case user_manager::User::USER_IMAGE_PROFILE: { | 281 case user_manager::User::USER_IMAGE_PROFILE: { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |