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 29 matching lines...) Expand all Loading... |
40 if (url_spec.substr(key.begin, key.len) == kKeyAnimated) { | 40 if (url_spec.substr(key.begin, key.len) == kKeyAnimated) { |
41 *is_image_animated = true; | 41 *is_image_animated = true; |
42 break; | 42 break; |
43 } | 43 } |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 namespace chromeos { | 49 namespace chromeos { |
50 namespace options2 { | 50 namespace options { |
51 | 51 |
52 base::RefCountedMemory* UserImageSource::GetUserImage( | 52 base::RefCountedMemory* UserImageSource::GetUserImage( |
53 const std::string& email, | 53 const std::string& email, |
54 bool is_image_animated, | 54 bool is_image_animated, |
55 ui::ScaleFactor scale_factor) const { | 55 ui::ScaleFactor scale_factor) const { |
56 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); | 56 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); |
57 if (user) { | 57 if (user) { |
58 if (user->has_animated_image() && is_image_animated) { | 58 if (user->has_animated_image() && is_image_animated) { |
59 return new base::RefCountedBytes(user->animated_image()); | 59 return new base::RefCountedBytes(user->animated_image()); |
60 } else if (user->has_raw_image()) { | 60 } else if (user->has_raw_image()) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ParseRequest(url, &email, &is_image_animated, &scale_factor); | 103 ParseRequest(url, &email, &is_image_animated, &scale_factor); |
104 | 104 |
105 if (is_image_animated) { | 105 if (is_image_animated) { |
106 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); | 106 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(email); |
107 if (user && user->has_animated_image()) | 107 if (user && user->has_animated_image()) |
108 return "image/gif"; | 108 return "image/gif"; |
109 } | 109 } |
110 return "image/png"; | 110 return "image/png"; |
111 } | 111 } |
112 | 112 |
113 } // namespace options2 | 113 } // namespace options |
114 } // namespace chromeos | 114 } // namespace chromeos |
OLD | NEW |