OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ |
6 #define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ |
7 | 7 |
| 8 #include "base/memory/ref_counted.h" |
8 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
11 | 12 |
12 namespace enhanced_bookmarks { | 13 namespace enhanced_bookmarks { |
13 | 14 |
14 // Defines a record of a bookmark image in the ImageStore. | 15 // Defines a record of a bookmark image in the ImageStore. |
15 struct ImageRecord { | 16 class ImageRecord : public base::RefCountedThreadSafe<ImageRecord> { |
16 ImageRecord() : image(), url(), dominant_color(SK_ColorBLACK) {} | 17 public: |
17 ImageRecord(const gfx::Image& image, const GURL& url, SkColor dominant_color) | 18 ImageRecord(scoped_ptr<gfx::Image> image, |
18 : image(image), url(url), dominant_color(dominant_color) {} | 19 const GURL& url, |
| 20 SkColor dominant_color); |
| 21 ImageRecord(scoped_ptr<gfx::Image> image, const GURL& url); |
| 22 ImageRecord(); |
19 | 23 |
20 // The image data. | 24 // The image data. |
21 gfx::Image image; | 25 scoped_ptr<gfx::Image> image; |
22 // The URL that hosts the image. | 26 // The URL that hosts the image. |
23 GURL url; | 27 GURL url; |
24 // The dominant color of the image. | 28 // The dominant color of the image. |
25 SkColor dominant_color; | 29 SkColor dominant_color; |
| 30 |
| 31 private: |
| 32 friend class base::RefCountedThreadSafe<ImageRecord>; |
| 33 |
| 34 ~ImageRecord(); |
26 }; | 35 }; |
27 | 36 |
28 } // namespace enhanced_bookmarks | 37 } // namespace enhanced_bookmarks |
29 | 38 |
30 #endif // COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ | 39 #endif // COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_ |
OLD | NEW |