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

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

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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
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/options/chromeos/user_image_source.h" 5 #include "chrome/browser/ui/webui/options/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/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "chrome/browser/chromeos/login/users/avatar/default_user_images.h" 10 #include "chrome/browser/chromeos/login/users/avatar/default_user_images.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 } // namespace 48 } // namespace
49 49
50 namespace chromeos { 50 namespace chromeos {
51 namespace options { 51 namespace options {
52 52
53 base::RefCountedMemory* UserImageSource::GetUserImage( 53 base::RefCountedMemory* UserImageSource::GetUserImage(
54 const std::string& email, 54 const std::string& email,
55 bool is_image_animated, 55 bool is_image_animated,
56 ui::ScaleFactor scale_factor) const { 56 ui::ScaleFactor scale_factor) const {
57 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); 57 const chromeos::User* user = chromeos::GetUserManager()->FindUser(email);
58 if (user) { 58 if (user) {
59 if (user->has_animated_image() && is_image_animated) { 59 if (user->has_animated_image() && is_image_animated) {
60 return new base::RefCountedBytes(user->animated_image()); 60 return new base::RefCountedBytes(user->animated_image());
61 } else if (user->has_raw_image()) { 61 } else if (user->has_raw_image()) {
62 return new base::RefCountedBytes(user->raw_image()); 62 return new base::RefCountedBytes(user->raw_image());
63 } else if (user->image_is_stub()) { 63 } else if (user->image_is_stub()) {
64 return ResourceBundle::GetSharedInstance(). 64 return ResourceBundle::GetSharedInstance().
65 LoadDataResourceBytesForScale(IDR_PROFILE_PICTURE_LOADING, 65 LoadDataResourceBytesForScale(IDR_PROFILE_PICTURE_LOADING,
66 scale_factor); 66 scale_factor);
67 } else if (user->HasDefaultImage()) { 67 } else if (user->HasDefaultImage()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 std::string UserImageSource::GetMimeType(const std::string& path) const { 101 std::string UserImageSource::GetMimeType(const std::string& path) const {
102 // We need to explicitly return a mime type, otherwise if the user tries to 102 // We need to explicitly return a mime type, otherwise if the user tries to
103 // drag the image they get no extension. 103 // drag the image they get no extension.
104 std::string email; 104 std::string email;
105 bool is_image_animated = false; 105 bool is_image_animated = false;
106 106
107 GURL url(chrome::kChromeUIUserImageURL + path); 107 GURL url(chrome::kChromeUIUserImageURL + path);
108 ParseRequest(url, &email, &is_image_animated); 108 ParseRequest(url, &email, &is_image_animated);
109 109
110 if (is_image_animated) { 110 if (is_image_animated) {
111 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); 111 const chromeos::User* user = chromeos::GetUserManager()->FindUser(email);
112 if (user && user->has_animated_image()) 112 if (user && user->has_animated_image())
113 return "image/gif"; 113 return "image/gif";
114 } 114 }
115 return "image/png"; 115 return "image/png";
116 } 116 }
117 117
118 } // namespace options 118 } // namespace options
119 } // namespace chromeos 119 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698