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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/user_image_source.cc

Issue 10829234: [cros] Fix regression making impossible to select grey G+ avatar, now for realz. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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->image_is_stub()) {
77 return ResourceBundle::GetSharedInstance().
78 LoadDataResourceBytes(IDR_PROFILE_PICTURE_LOADING, scale_factor);
76 } else if (user->HasDefaultImage()) { 79 } else if (user->HasDefaultImage()) {
77 return ResourceBundle::GetSharedInstance(). 80 return ResourceBundle::GetSharedInstance().
78 LoadDataResourceBytes(kDefaultImageResourceIDs[user->image_index()], 81 LoadDataResourceBytes(kDefaultImageResourceIDs[user->image_index()],
79 scale_factor); 82 scale_factor);
80 } else { 83 } else {
81 NOTREACHED() << "User with custom image missing raw data"; 84 NOTREACHED() << "User with custom image missing raw data";
82 } 85 }
83 } 86 }
84 return ResourceBundle::GetSharedInstance(). 87 return ResourceBundle::GetSharedInstance().
85 LoadDataResourceBytes(IDR_LOGIN_DEFAULT_USER, scale_factor); 88 LoadDataResourceBytes(IDR_LOGIN_DEFAULT_USER, scale_factor);
(...skipping 30 matching lines...) Expand all
116 if (is_image_animated) { 119 if (is_image_animated) {
117 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); 120 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email);
118 if (user && user->has_animated_image()) 121 if (user && user->has_animated_image())
119 return "image/gif"; 122 return "image/gif";
120 } 123 }
121 return "image/png"; 124 return "image/png";
122 } 125 }
123 126
124 } // namespace options2 127 } // namespace options2
125 } // namespace chromeos 128 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698