OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 typedef base::Closure IconLoadedCallback; | 31 typedef base::Closure IconLoadedCallback; |
32 | 32 |
33 // Create a URL Icon source with the given URL. The post_process parameter | 33 // Create a URL Icon source with the given URL. The post_process parameter |
34 // specifies a function to post-process the result icon before displaying it. | 34 // specifies a function to post-process the result icon before displaying it. |
35 UrlIconSource(const IconLoadedCallback& icon_loaded_callback, | 35 UrlIconSource(const IconLoadedCallback& icon_loaded_callback, |
36 net::URLRequestContextGetter* context_getter, | 36 net::URLRequestContextGetter* context_getter, |
37 const GURL& icon_url, | 37 const GURL& icon_url, |
38 int icon_size, | 38 int icon_size, |
39 int default_icon_resource_id); | 39 int default_icon_resource_id); |
40 virtual ~UrlIconSource(); | 40 ~UrlIconSource() override; |
41 | 41 |
42 private: | 42 private: |
43 // Invoked from GetImageForScale to download the app icon when the hosting | 43 // Invoked from GetImageForScale to download the app icon when the hosting |
44 // ImageSkia gets painted on screen. | 44 // ImageSkia gets painted on screen. |
45 void StartIconFetch(); | 45 void StartIconFetch(); |
46 | 46 |
47 // gfx::ImageSkiaSource overrides: | 47 // gfx::ImageSkiaSource overrides: |
48 virtual gfx::ImageSkiaRep GetImageForScale(float scale) override; | 48 gfx::ImageSkiaRep GetImageForScale(float scale) override; |
49 | 49 |
50 // net::URLFetcherDelegate overrides: | 50 // net::URLFetcherDelegate overrides: |
51 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 51 void OnURLFetchComplete(const net::URLFetcher* source) override; |
52 | 52 |
53 // ImageDecoder::Delegate overrides: | 53 // ImageDecoder::Delegate overrides: |
54 virtual void OnImageDecoded(const ImageDecoder* decoder, | 54 void OnImageDecoded(const ImageDecoder* decoder, |
55 const SkBitmap& decoded_image) override; | 55 const SkBitmap& decoded_image) override; |
56 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override; | 56 void OnDecodeImageFailed(const ImageDecoder* decoder) override; |
57 | 57 |
58 IconLoadedCallback icon_loaded_callback_; | 58 IconLoadedCallback icon_loaded_callback_; |
59 net::URLRequestContextGetter* context_getter_; | 59 net::URLRequestContextGetter* context_getter_; |
60 const GURL icon_url_; | 60 const GURL icon_url_; |
61 const int icon_size_; | 61 const int icon_size_; |
62 const int default_icon_resource_id_; | 62 const int default_icon_resource_id_; |
63 | 63 |
64 bool icon_fetch_attempted_; | 64 bool icon_fetch_attempted_; |
65 scoped_ptr<net::URLFetcher> icon_fetcher_; | 65 scoped_ptr<net::URLFetcher> icon_fetcher_; |
66 | 66 |
67 scoped_refptr<ImageDecoder> image_decoder_; | 67 scoped_refptr<ImageDecoder> image_decoder_; |
68 | 68 |
69 gfx::ImageSkia icon_; | 69 gfx::ImageSkia icon_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(UrlIconSource); | 71 DISALLOW_COPY_AND_ASSIGN(UrlIconSource); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace app_list | 74 } // namespace app_list |
75 | 75 |
76 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ | 76 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_URL_ICON_SOURCE_H_ |
OLD | NEW |