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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "googleurl/src/gurl.h" |
11 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
12 | 13 |
13 namespace chromeos { | 14 namespace chromeos { |
14 | 15 |
15 // Wrapper class for bitmaps and raw images when it's necessary. Could | 16 // Wrapper class for bitmaps and raw images when it's necessary. Could |
16 // be used for storing profile images (including animated profile | 17 // be used for storing profile images (including animated profile |
17 // images) and user wallpapers. | 18 // images) and user wallpapers. |
18 class UserImage { | 19 class UserImage { |
19 public: | 20 public: |
20 typedef std::vector<unsigned char> RawImage; | 21 typedef std::vector<unsigned char> RawImage; |
(...skipping 17 matching lines...) Expand all Loading... |
38 | 39 |
39 // Returns true iff |image| argument of constructors or |SetImage| | 40 // Returns true iff |image| argument of constructors or |SetImage| |
40 // can be encoded as a bitmap. | 41 // can be encoded as a bitmap. |
41 bool has_raw_image() const { return has_raw_image_; } | 42 bool has_raw_image() const { return has_raw_image_; } |
42 const RawImage& raw_image() const { return raw_image_; } | 43 const RawImage& raw_image() const { return raw_image_; } |
43 | 44 |
44 // Returns true iff UserImage is constructed from animated image. | 45 // Returns true iff UserImage is constructed from animated image. |
45 bool has_animated_image() const { return has_animated_image_; } | 46 bool has_animated_image() const { return has_animated_image_; } |
46 const RawImage& animated_image() const { return animated_image_; } | 47 const RawImage& animated_image() const { return animated_image_; } |
47 | 48 |
| 49 // URL from which this image was originally downloaded, if any. |
| 50 void set_url(const GURL& url) { url_ = url; } |
| 51 GURL url() const { return url_; } |
| 52 |
48 private: | 53 private: |
49 gfx::ImageSkia image_; | 54 gfx::ImageSkia image_; |
50 bool has_raw_image_; | 55 bool has_raw_image_; |
51 RawImage raw_image_; | 56 RawImage raw_image_; |
52 bool has_animated_image_; | 57 bool has_animated_image_; |
53 RawImage animated_image_; | 58 RawImage animated_image_; |
| 59 GURL url_; |
54 }; | 60 }; |
55 | 61 |
56 } // namespace chromeos | 62 } // namespace chromeos |
57 | 63 |
58 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ |
OLD | NEW |