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 content { | 10 namespace gfx { |
11 // TODO(jif): Abstract the NavigationEntry (crbug.com/359598). | 11 class Image; |
12 class NavigationEntry; | |
13 } | 12 } |
14 | 13 |
15 // 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., |
16 // obtain information from it and give information to it). A concrete | 15 // obtain information from it and give information to it). A concrete |
17 // implementation must be provided by the driver. | 16 // implementation must be provided by the driver. |
18 class FaviconDriver { | 17 class FaviconDriver { |
19 public: | 18 public: |
20 // Returns the current NavigationEntry. | |
21 // TODO(jif): Abstract the NavigationEntry (crbug.com/359598). | |
22 virtual content::NavigationEntry* GetActiveEntry() = 0; | |
23 | 19 |
24 // Starts the download for the given favicon. When finished, the driver | 20 // Starts the download for the given favicon. When finished, the driver |
25 // will call OnDidDownloadFavicon() with the results. | 21 // will call OnDidDownloadFavicon() with the results. |
26 // Returns the unique id of the download request. The id will be passed | 22 // Returns the unique id of the download request. The id will be passed |
27 // in OnDidDownloadFavicon(). | 23 // in OnDidDownloadFavicon(). |
28 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out | 24 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out |
29 // from the bitmap results. If there are no bitmap results <= | 25 // from the bitmap results. If there are no bitmap results <= |
30 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and | 26 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and |
31 // is the only result. A |max_bitmap_size| of 0 means unlimited. | 27 // is the only result. A |max_bitmap_size| of 0 means unlimited. |
32 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; | 28 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; |
33 | 29 |
34 // Notifies the driver that the favicon for the active entry was updated. | 30 // Notifies the driver that the favicon for the active entry was updated. |
35 // |icon_url_changed| is true if a favicon with a different icon URL has | 31 // |icon_url_changed| is true if a favicon with a different icon URL has |
36 // been selected since the previous call to NotifyFaviconUpdated(). | 32 // been selected since the previous call to NotifyFaviconUpdated(). |
37 virtual void NotifyFaviconUpdated(bool icon_url_changed) = 0; | 33 virtual void NotifyFaviconUpdated(bool icon_url_changed) = 0; |
38 | 34 |
39 // Returns whether the user is operating in an off-the-record context. | 35 // Returns whether the user is operating in an off-the-record context. |
40 virtual bool IsOffTheRecord() = 0; | 36 virtual bool IsOffTheRecord() = 0; |
37 | |
38 // Returns the bitmap of the current page's favicon. | |
39 virtual const gfx::Image GetActiveFaviconImage() = 0; | |
blundell
2014/05/09 14:30:34
It looks like all of these getters/setters expecte
jif
2014/05/11 13:41:22
Done.
| |
40 | |
41 // Returns the URL of the current page's favicon. | |
42 virtual const GURL GetActiveFaviconURL() = 0; | |
43 | |
44 // Returns whether we've got the current page's favicon, or just using the | |
45 // default favicon. | |
46 virtual bool GetActiveFaviconValidity() = 0; | |
47 | |
48 // Returns the URL of the current page. | |
blundell
2014/05/09 14:30:34
Returns an invalid GURL if there is no current pag
jif
2014/05/11 13:41:22
Done.
| |
49 virtual const GURL GetActiveURL() = 0; | |
50 | |
51 // Sets the bitmap of the current page's favicon. | |
52 virtual void SetActiveFaviconImage(gfx::Image image) = 0; | |
53 | |
54 // Sets whether we've got the current page's favicon, or just using the | |
blundell
2014/05/09 14:30:34
This comment is wrong.
jif
2014/05/11 13:41:22
Done.
| |
55 // default favicon. | |
56 virtual void SetActiveFaviconURL(GURL url) = 0; | |
57 | |
58 // Set whether we've got the page's favicon, or just using the default | |
blundell
2014/05/09 14:30:34
Sets whether the page's favicon is valid (if false
jif
2014/05/11 13:41:22
Done.
| |
59 // favicon. | |
60 virtual void SetActiveFaviconValidity(bool validity) = 0; | |
41 }; | 61 }; |
42 | 62 |
43 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 63 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
OLD | NEW |