OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IMAGE_HOLDER_H_ | 5 #ifndef CHROME_BROWSER_IMAGE_HOLDER_H_ |
6 #define CHROME_BROWSER_IMAGE_HOLDER_H_ | 6 #define CHROME_BROWSER_IMAGE_HOLDER_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 virtual ~ImageHolder(); | 33 virtual ~ImageHolder(); |
34 | 34 |
35 // Begin fetching of the URLs we have. | 35 // Begin fetching of the URLs we have. |
36 void StartFetch(); | 36 void StartFetch(); |
37 | 37 |
38 // Check whether we have a response from the server for these resources, | 38 // Check whether we have a response from the server for these resources, |
39 // even if the response is a failed fetch. | 39 // even if the response is a failed fetch. |
40 bool IsFetchingDone() const; | 40 bool IsFetchingDone() const; |
41 | 41 |
42 // Inherited from BitmapFetcherDelegate | 42 // Inherited from BitmapFetcherDelegate |
43 virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE; | 43 virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) override; |
44 | 44 |
45 // Accessors: | 45 // Accessors: |
46 GURL low_dpi_url() const { return low_dpi_url_; } | 46 GURL low_dpi_url() const { return low_dpi_url_; } |
47 GURL high_dpi_url() const { return high_dpi_url_; } | 47 GURL high_dpi_url() const { return high_dpi_url_; } |
48 gfx::Image low_dpi_image() { return gfx::Image(image_); } | 48 gfx::Image low_dpi_image() { return gfx::Image(image_); } |
49 | 49 |
50 private: | 50 private: |
51 // Helper function to create a bitmap fetcher (but not start the fetch). | 51 // Helper function to create a bitmap fetcher (but not start the fetch). |
52 void CreateBitmapFetcher(const GURL& url); | 52 void CreateBitmapFetcher(const GURL& url); |
53 | 53 |
54 GURL low_dpi_url_; | 54 GURL low_dpi_url_; |
55 GURL high_dpi_url_; | 55 GURL high_dpi_url_; |
56 bool low_dpi_fetched_; | 56 bool low_dpi_fetched_; |
57 bool high_dpi_fetched_; | 57 bool high_dpi_fetched_; |
58 gfx::ImageSkia image_; | 58 gfx::ImageSkia image_; |
59 ImageHolderDelegate* delegate_; | 59 ImageHolderDelegate* delegate_; |
60 ScopedVector<chrome::BitmapFetcher> fetchers_; | 60 ScopedVector<chrome::BitmapFetcher> fetchers_; |
61 Profile* profile_; | 61 Profile* profile_; |
62 | 62 |
63 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, CreateBitmapFetcherTest); | 63 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, CreateBitmapFetcherTest); |
64 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, OnFetchCompleteTest); | 64 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, OnFetchCompleteTest); |
65 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, IsFetchingDoneTest); | 65 FRIEND_TEST_ALL_PREFIXES(ImageHolderTest, IsFetchingDoneTest); |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(ImageHolder); | 67 DISALLOW_COPY_AND_ASSIGN(ImageHolder); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace chrome. | 70 } // namespace chrome. |
71 | 71 |
72 #endif // CHROME_BROWSER_IMAGE_HOLDER_H_ | 72 #endif // CHROME_BROWSER_IMAGE_HOLDER_H_ |
OLD | NEW |