| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options2/chromeos/user_image_source.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/user_image_source.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "chrome/browser/chromeos/login/default_user_images.h" | 10 #include "chrome/browser/chromeos/login/default_user_images.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 base::RefCountedMemory* UserImageSource::GetUserImage( | 66 base::RefCountedMemory* UserImageSource::GetUserImage( |
| 67 const std::string& email, | 67 const std::string& email, |
| 68 bool is_image_animated, | 68 bool is_image_animated, |
| 69 ui::ScaleFactor scale_factor) const { | 69 ui::ScaleFactor scale_factor) const { |
| 70 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); | 70 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); |
| 71 if (user) { | 71 if (user) { |
| 72 if (user->has_animated_image() && is_image_animated) { | 72 if (user->has_animated_image() && is_image_animated) { |
| 73 return new base::RefCountedBytes(user->animated_image()); | 73 return new base::RefCountedBytes(user->animated_image()); |
| 74 } else if (user->has_raw_image()) { | 74 } else if (user->has_raw_image()) { |
| 75 return new base::RefCountedBytes(user->raw_image()); | 75 return new base::RefCountedBytes(user->raw_image()); |
| 76 } else if (user->has_default_image()) { | 76 } else if (user->HasDefaultImage()) { |
| 77 return ResourceBundle::GetSharedInstance(). | 77 return ResourceBundle::GetSharedInstance(). |
| 78 LoadDataResourceBytes(kDefaultImageResources[user->image_index()], | 78 LoadDataResourceBytes(kDefaultImageResources[user->image_index()], |
| 79 scale_factor); | 79 scale_factor); |
| 80 } else { | 80 } else { |
| 81 NOTREACHED() << "User with custom image missing raw data"; | 81 NOTREACHED() << "User with custom image missing raw data"; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 return ResourceBundle::GetSharedInstance(). | 84 return ResourceBundle::GetSharedInstance(). |
| 85 LoadDataResourceBytes(IDR_LOGIN_DEFAULT_USER, scale_factor); | 85 LoadDataResourceBytes(IDR_LOGIN_DEFAULT_USER, scale_factor); |
| 86 } | 86 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 116 if (is_image_animated) { | 116 if (is_image_animated) { |
| 117 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); | 117 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); |
| 118 if (user && user->has_animated_image()) | 118 if (user && user->has_animated_image()) |
| 119 return "image/gif"; | 119 return "image/gif"; |
| 120 } | 120 } |
| 121 return "image/png"; | 121 return "image/png"; |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace options2 | 124 } // namespace options2 |
| 125 } // namespace chromeos | 125 } // namespace chromeos |
| OLD | NEW |