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 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 // Wrapper class storing a still image and it's raw representation. Could be | 15 // Wrapper class storing a still image and it's raw representation. Could be |
16 // used for storing profile images (including animated profile images) and user | 16 // used for storing profile images (including animated profile images) and user |
17 // wallpapers. | 17 // wallpapers. |
18 class UserImage { | 18 class UserImage { |
19 public: | 19 public: |
20 // TODO(ivankr): replace with RefCountedMemory to prevent copying. | 20 // TODO(ivankr): replace with RefCountedMemory to prevent copying. |
21 typedef std::vector<unsigned char> RawImage; | 21 typedef std::vector<unsigned char> RawImage; |
22 | 22 |
23 // Creates a new instance from a given still frame and tries to encode raw | 23 // Creates a new instance from a given still frame and tries to encode raw |
24 // representation for it. | 24 // representation for it. |
| 25 // TODO(ivankr): remove eventually. |
25 static UserImage CreateAndEncode(const gfx::ImageSkia& image); | 26 static UserImage CreateAndEncode(const gfx::ImageSkia& image); |
26 | 27 |
27 // Create instance with an empty still frame and no raw data. | 28 // Create instance with an empty still frame and no raw data. |
28 UserImage(); | 29 UserImage(); |
29 | 30 |
30 // Creates a new instance from a given still frame without any raw data. | 31 // Creates a new instance from a given still frame without any raw data. |
31 explicit UserImage(const gfx::ImageSkia& image); | 32 explicit UserImage(const gfx::ImageSkia& image); |
32 | 33 |
33 // Creates a new instance from a given still frame and raw representation. | 34 // Creates a new instance from a given still frame and raw representation. |
34 // |raw_image| can be animated, in which case animated_image() will return the | 35 // |raw_image| can be animated, in which case animated_image() will return the |
(...skipping 25 matching lines...) Expand all Loading... |
60 bool has_raw_image_; | 61 bool has_raw_image_; |
61 RawImage raw_image_; | 62 RawImage raw_image_; |
62 bool has_animated_image_; | 63 bool has_animated_image_; |
63 RawImage animated_image_; | 64 RawImage animated_image_; |
64 GURL url_; | 65 GURL url_; |
65 }; | 66 }; |
66 | 67 |
67 } // namespace chromeos | 68 } // namespace chromeos |
68 | 69 |
69 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_H_ |
OLD | NEW |