| 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 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual bool IsOffTheRecord() = 0; | 55 virtual bool IsOffTheRecord() = 0; |
| 56 | 56 |
| 57 // Returns whether |url| is bookmarked. | 57 // Returns whether |url| is bookmarked. |
| 58 virtual bool IsBookmarked(const GURL& url) = 0; | 58 virtual bool IsBookmarked(const GURL& url) = 0; |
| 59 | 59 |
| 60 // Returns the URL of the current page, if any. Returns an invalid URL | 60 // Returns the URL of the current page, if any. Returns an invalid URL |
| 61 // otherwise. | 61 // otherwise. |
| 62 virtual GURL GetActiveURL() = 0; | 62 virtual GURL GetActiveURL() = 0; |
| 63 | 63 |
| 64 // Returns whether the page's favicon is valid (returns false if the default | 64 // Returns whether the page's favicon is valid (returns false if the default |
| 65 // favicon is being used). Requires GetActiveURL() to be valid. | 65 // favicon is being used). |
| 66 virtual bool GetActiveFaviconValidity() = 0; | 66 virtual bool GetActiveFaviconValidity() = 0; |
| 67 | 67 |
| 68 // Sets whether the page's favicon is valid (if false, the default favicon is | 68 // Sets whether the page's favicon is valid (if false, the default favicon is |
| 69 // being used). | 69 // being used). |
| 70 virtual void SetActiveFaviconValidity(bool valid) = 0; | 70 virtual void SetActiveFaviconValidity(bool valid) = 0; |
| 71 | 71 |
| 72 // Returns the URL of the current page's favicon. Requires GetActiveURL() to | 72 // Returns the URL of the current page's favicon. |
| 73 // be valid. | |
| 74 virtual GURL GetActiveFaviconURL() = 0; | 73 virtual GURL GetActiveFaviconURL() = 0; |
| 75 | 74 |
| 76 // Sets the URL of the favicon's bitmap. | 75 // Sets the URL of the favicon's bitmap. |
| 77 virtual void SetActiveFaviconURL(const GURL& url) = 0; | 76 virtual void SetActiveFaviconURL(const GURL& url) = 0; |
| 78 | 77 |
| 79 // Sets the bitmap of the current page's favicon. | 78 // Sets the bitmap of the current page's favicon. |
| 80 virtual void SetActiveFaviconImage(const gfx::Image& image) = 0; | 79 virtual void SetActiveFaviconImage(const gfx::Image& image) = 0; |
| 81 | 80 |
| 82 // Notifies the driver a favicon image is available. |image| is not | 81 // Notifies the driver a favicon image is available. |image| is not |
| 83 // necessarily 16x16. |icon_url| is the url the image is from. If | 82 // necessarily 16x16. |icon_url| is the url the image is from. If |
| 84 // |is_active_favicon| is true the image corresponds to the favicon | 83 // |is_active_favicon| is true the image corresponds to the favicon |
| 85 // (possibly empty) of the page. | 84 // (possibly empty) of the page. |
| 86 virtual void OnFaviconAvailable(const gfx::Image& image, | 85 virtual void OnFaviconAvailable(const GURL& page_url, |
| 87 const GURL& icon_url, | 86 const GURL& icon_url, |
| 87 const gfx::Image& image, |
| 88 bool is_active_favicon) = 0; | 88 bool is_active_favicon) = 0; |
| 89 | 89 |
| 90 // Returns whether the driver is waiting for a download to complete or for | 90 // Returns whether the driver is waiting for a download to complete or for |
| 91 // data from the FaviconService. Reserved for testing. | 91 // data from the FaviconService. Reserved for testing. |
| 92 virtual bool HasPendingTasksForTest() = 0; | 92 virtual bool HasPendingTasksForTest() = 0; |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 FaviconDriver(); | 95 FaviconDriver(); |
| 96 virtual ~FaviconDriver(); | 96 virtual ~FaviconDriver(); |
| 97 | 97 |
| 98 // Informs FaviconDriverObservers that favicon |image| has been retrieved from | 98 // Informs FaviconDriverObservers that favicon |image| has been retrieved from |
| 99 // either website or cached storage. | 99 // either website or cached storage. |
| 100 void NotifyFaviconAvailable(const gfx::Image& image); | 100 void NotifyFaviconAvailable(const gfx::Image& image); |
| 101 | 101 |
| 102 // Informs FaviconDriverObservers that favicon has changed for the current | 102 // Informs FaviconDriverObservers that favicon has changed for the current |
| 103 // page. |icon_url_changed| is true if the favicon URL has also changed since | 103 // page. |icon_url_changed| is true if the favicon URL has also changed since |
| 104 // the last call. | 104 // the last call. |
| 105 virtual void NotifyFaviconUpdated(bool icon_url_changed); | 105 virtual void NotifyFaviconUpdated(bool icon_url_changed); |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 base::ObserverList<FaviconDriverObserver> observer_list_; | 108 base::ObserverList<FaviconDriverObserver> observer_list_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(FaviconDriver); | 110 DISALLOW_COPY_AND_ASSIGN(FaviconDriver); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace favicon | 113 } // namespace favicon |
| 114 | 114 |
| 115 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ | 115 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_ |
| OLD | NEW |