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/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" | |
11 #include "chrome/browser/chromeos/login/users/user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/user_manager.h" |
12 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "components/user_manager/user_image/default_user_images.h" |
13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
14 #include "grit/ui_chromeos_resources.h" | 14 #include "grit/ui_chromeos_resources.h" |
15 #include "net/base/escape.h" | 15 #include "net/base/escape.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/codec/png_codec.h" | 17 #include "ui/gfx/codec/png_codec.h" |
18 #include "url/url_parse.h" | 18 #include "url/url_parse.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Animated key is used in user image URL requests to specify that | 22 // Animated key is used in user image URL requests to specify that |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return new base::RefCountedBytes(user->animated_image()); | 61 return new base::RefCountedBytes(user->animated_image()); |
62 } else if (user->has_raw_image()) { | 62 } else if (user->has_raw_image()) { |
63 return new base::RefCountedBytes(user->raw_image()); | 63 return new base::RefCountedBytes(user->raw_image()); |
64 } else if (user->image_is_stub()) { | 64 } else if (user->image_is_stub()) { |
65 return ResourceBundle::GetSharedInstance(). | 65 return ResourceBundle::GetSharedInstance(). |
66 LoadDataResourceBytesForScale(IDR_PROFILE_PICTURE_LOADING, | 66 LoadDataResourceBytesForScale(IDR_PROFILE_PICTURE_LOADING, |
67 scale_factor); | 67 scale_factor); |
68 } else if (user->HasDefaultImage()) { | 68 } else if (user->HasDefaultImage()) { |
69 return ResourceBundle::GetSharedInstance(). | 69 return ResourceBundle::GetSharedInstance(). |
70 LoadDataResourceBytesForScale( | 70 LoadDataResourceBytesForScale( |
71 kDefaultImageResourceIDs[user->image_index()], | 71 user_manager::kDefaultImageResourceIDs[user->image_index()], |
72 scale_factor); | 72 scale_factor); |
73 } else { | 73 } else { |
74 NOTREACHED() << "User with custom image missing raw data"; | 74 NOTREACHED() << "User with custom image missing raw data"; |
75 } | 75 } |
76 } | 76 } |
77 return ResourceBundle::GetSharedInstance(). | 77 return ResourceBundle::GetSharedInstance(). |
78 LoadDataResourceBytesForScale(IDR_LOGIN_DEFAULT_USER, scale_factor); | 78 LoadDataResourceBytesForScale(IDR_LOGIN_DEFAULT_USER, scale_factor); |
79 } | 79 } |
80 | 80 |
81 UserImageSource::UserImageSource() { | 81 UserImageSource::UserImageSource() { |
(...skipping 29 matching lines...) Expand all Loading... |
111 if (is_image_animated) { | 111 if (is_image_animated) { |
112 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); | 112 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); |
113 if (user && user->has_animated_image()) | 113 if (user && user->has_animated_image()) |
114 return "image/gif"; | 114 return "image/gif"; |
115 } | 115 } |
116 return "image/png"; | 116 return "image/png"; |
117 } | 117 } |
118 | 118 |
119 } // namespace options | 119 } // namespace options |
120 } // namespace chromeos | 120 } // namespace chromeos |
OLD | NEW |