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 | 19 |
20 // Starts the download for the given favicon. When finished, the driver | 20 // Starts the download for the given favicon. When finished, the driver |
21 // will call OnDidDownloadFavicon() with the results. | 21 // will call OnDidDownloadFavicon() with the results. |
22 // 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 |
23 // in OnDidDownloadFavicon(). | 23 // in OnDidDownloadFavicon(). |
24 // 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 |
25 // from the bitmap results. If there are no bitmap results <= | 25 // from the bitmap results. If there are no bitmap results <= |
26 // |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 |
27 // 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. |
28 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; | 28 virtual int StartDownload(const GURL& url, int max_bitmap_size) = 0; |
29 | 29 |
30 // Notifies the driver that the favicon for the active entry was updated. | |
31 // |icon_url_changed| is true if a favicon with a different icon URL has | |
32 // been selected since the previous call to NotifyFaviconUpdated(). | |
33 virtual void NotifyFaviconUpdated(bool icon_url_changed) = 0; | |
34 | |
35 // Returns whether the user is operating in an off-the-record context. | 30 // Returns whether the user is operating in an off-the-record context. |
36 virtual bool IsOffTheRecord() = 0; | 31 virtual bool IsOffTheRecord() = 0; |
37 | 32 |
38 // Returns the bitmap of the current page's favicon. Requires GetActiveURL() | 33 // Returns the bitmap of the current page's favicon. Requires GetActiveURL() |
39 // to be valid. | 34 // to be valid. |
40 virtual const gfx::Image GetActiveFaviconImage() = 0; | 35 virtual const gfx::Image GetActiveFaviconImage() = 0; |
41 | 36 |
42 // Returns the URL of the current page's favicon. Requires GetActiveURL() to | 37 // Returns the URL of the current page's favicon. Requires GetActiveURL() to |
43 // be valid. | 38 // be valid. |
44 virtual const GURL GetActiveFaviconURL() = 0; | 39 virtual const GURL GetActiveFaviconURL() = 0; |
45 | 40 |
46 // Returns whether the page's favicon is valid (returns false if the default | 41 // Returns whether the page's favicon is valid (returns false if the default |
47 // favicon is being used). Requires GetActiveURL() to be valid. | 42 // favicon is being used). Requires GetActiveURL() to be valid. |
48 virtual bool GetActiveFaviconValidity() = 0; | 43 virtual bool GetActiveFaviconValidity() = 0; |
49 | 44 |
50 // Returns the URL of the current page, if any. Returns an invalid | 45 // Returns the URL of the current page, if any. Returns an invalid |
51 // URL otherwise. | 46 // URL otherwise. |
52 virtual const GURL GetActiveURL() = 0; | 47 virtual const GURL GetActiveURL() = 0; |
53 | 48 |
54 // Sets the bitmap of the current page's favicon. Requires GetActiveURL() to | 49 // Notifies the driver favicon |image| is available to use. |icon_url| is |
55 // be valid. | 50 // image's url, |update_active_favicon| indicates whether updating active |
56 virtual void SetActiveFaviconImage(gfx::Image image) = 0; | 51 // favicon is needed. |
57 | 52 virtual void OnFaviconAvailable(const gfx::Image& image, |
sky
2014/10/30 21:33:49
You need to make it clear image is not necessarily
michaelbai
2014/10/31 23:21:27
Done.
| |
58 // Sets the URL of the favicon's bitmap. Requires GetActiveURL() to be valid. | 53 const GURL& icon_url, |
59 virtual void SetActiveFaviconURL(GURL url) = 0; | 54 bool update_active_favicon) = 0; |
60 | |
61 // Sets whether the page's favicon is valid (if false, the default favicon is | |
62 // being used). Requires GetActiveURL() to be valid. | |
63 virtual void SetActiveFaviconValidity(bool validity) = 0; | |
michaelbai
2014/10/30 19:22:51
Hey Scott, I am not sure these methods still neede
blundell
2014/10/31 06:53:42
jif@ is the right person to answer this question.
jif-google
2014/10/31 12:05:18
michaelbai>
Since GetActiveFaviconValidity is used
michaelbai
2014/10/31 15:57:56
I don't know how you use the driver, this patch ad
jif-google
2014/10/31 16:51:30
Resolved offline.
The conclusion is: we can remove
| |
64 }; | 55 }; |
65 | 56 |
66 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 57 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
OLD | NEW |