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 COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
6 #define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 6 #define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
7 | 7 |
8 class GURL; | 8 class GURL; |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 class Image; | 11 class Image; |
12 } | 12 } |
13 | 13 |
14 // Interface that allows Favicon core code to interact with its driver (i.e., | 14 // Interface that allows Favicon core code to interact with its driver (i.e., |
15 // obtain information from it and give information to it). A concrete | 15 // obtain information from it and give information to it). A concrete |
16 // implementation must be provided by the driver. | 16 // implementation must be provided by the driver. |
17 class FaviconDriver { | 17 class FaviconDriver { |
18 public: | 18 public: |
19 | |
20 // Starts the download for the given favicon. When finished, the driver | 19 // Starts the download for the given favicon. When finished, the driver |
21 // will call OnDidDownloadFavicon() with the results. | 20 // will call OnDidDownloadFavicon() with the results. |
22 // Returns the unique id of the download request. The id will be passed | 21 // Returns the unique id of the download request. The id will be passed |
23 // in OnDidDownloadFavicon(). | 22 // in OnDidDownloadFavicon(). |
24 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out | 23 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out |
25 // from the bitmap results. If there are no bitmap results <= | 24 // from the bitmap results. If there are no bitmap results <= |
26 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and | 25 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and |
27 // is the only result. A |max_bitmap_size| of 0 means unlimited. | 26 // is the only result. A |max_bitmap_size| of 0 means unlimited. |
28 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; | 27 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; |
29 | 28 |
(...skipping 16 matching lines...) Expand all Loading... |
46 // URL otherwise. | 45 // URL otherwise. |
47 virtual const GURL GetActiveURL() = 0; | 46 virtual const GURL GetActiveURL() = 0; |
48 | 47 |
49 // Notifies the driver a favicon image is available. |image| is not | 48 // Notifies the driver a favicon image is available. |image| is not |
50 // necessarily 16x16. |icon_url| is the url the image is from. If | 49 // necessarily 16x16. |icon_url| is the url the image is from. If |
51 // |is_active_favicon| is true the image corresponds to the favicon | 50 // |is_active_favicon| is true the image corresponds to the favicon |
52 // (possibly empty) of the page. | 51 // (possibly empty) of the page. |
53 virtual void OnFaviconAvailable(const gfx::Image& image, | 52 virtual void OnFaviconAvailable(const gfx::Image& image, |
54 const GURL& icon_url, | 53 const GURL& icon_url, |
55 bool is_active_favicon) = 0; | 54 bool is_active_favicon) = 0; |
| 55 |
| 56 protected: |
| 57 FaviconDriver() {} |
| 58 virtual ~FaviconDriver() {} |
| 59 |
| 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(FaviconDriver); |
56 }; | 62 }; |
57 | 63 |
58 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 64 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
OLD | NEW |