OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_IOS_WEB_FAVICON_DRIVER_H_ | 5 #ifndef COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
6 #define COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ | 6 #define COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
7 | 7 |
8 #include "components/favicon/core/favicon_driver_impl.h" | 8 #include "components/favicon/core/favicon_driver_impl.h" |
9 #include "ios/web/public/web_state/web_state_observer.h" | 9 #include "ios/web/public/web_state/web_state_observer.h" |
10 #include "ios/web/public/web_state/web_state_user_data.h" | 10 #include "ios/web/public/web_state/web_state_user_data.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class WebFaviconDriver : public web::WebStateObserver, | 22 class WebFaviconDriver : public web::WebStateObserver, |
23 public web::WebStateUserData<WebFaviconDriver>, | 23 public web::WebStateUserData<WebFaviconDriver>, |
24 public FaviconDriverImpl { | 24 public FaviconDriverImpl { |
25 public: | 25 public: |
26 static void CreateForWebState(web::WebState* web_state, | 26 static void CreateForWebState(web::WebState* web_state, |
27 FaviconService* favicon_service, | 27 FaviconService* favicon_service, |
28 history::HistoryService* history_service, | 28 history::HistoryService* history_service, |
29 bookmarks::BookmarkModel* bookmark_model); | 29 bookmarks::BookmarkModel* bookmark_model); |
30 | 30 |
31 // FaviconDriver implementation. | 31 // FaviconDriver implementation. |
| 32 void FetchFavicon(const GURL& url) override; |
32 void SaveFavicon() override; | 33 void SaveFavicon() override; |
33 gfx::Image GetFavicon() const override; | 34 gfx::Image GetFavicon() const override; |
34 bool FaviconIsValid() const override; | 35 bool FaviconIsValid() const override; |
35 int StartDownload(const GURL& url, int max_bitmap_size) override; | 36 int StartDownload(const GURL& url, int max_bitmap_size) override; |
36 bool IsOffTheRecord() override; | 37 bool IsOffTheRecord() override; |
37 GURL GetActiveURL() override; | 38 GURL GetActiveURL() override; |
38 bool GetActiveFaviconValidity() override; | 39 bool GetActiveFaviconValidity() override; |
39 void SetActiveFaviconValidity(bool valid) override; | 40 void SetActiveFaviconValidity(bool valid) override; |
40 GURL GetActiveFaviconURL() override; | 41 GURL GetActiveFaviconURL() override; |
41 void SetActiveFaviconURL(const GURL& url) override; | 42 void SetActiveFaviconURL(const GURL& url) override; |
42 void SetActiveFaviconImage(const gfx::Image& image) override; | 43 void SetActiveFaviconImage(const gfx::Image& image) override; |
| 44 bool ShouldSendFaviconAvailableNotifications() override; |
43 | 45 |
44 private: | 46 private: |
45 friend class web::WebStateUserData<WebFaviconDriver>; | 47 friend class web::WebStateUserData<WebFaviconDriver>; |
46 | 48 |
47 WebFaviconDriver(web::WebState* web_state, | 49 WebFaviconDriver(web::WebState* web_state, |
48 FaviconService* favicon_service, | 50 FaviconService* favicon_service, |
49 history::HistoryService* history_service, | 51 history::HistoryService* history_service, |
50 bookmarks::BookmarkModel* bookmark_model); | 52 bookmarks::BookmarkModel* bookmark_model); |
51 ~WebFaviconDriver() override; | 53 ~WebFaviconDriver() override; |
52 | 54 |
| 55 // Returns whether the active URL has changed since FetchFavicon() was called. |
| 56 bool ActiveURLChangedSinceFetchFavicon(); |
| 57 |
53 // web::WebStateObserver implementation. | 58 // web::WebStateObserver implementation. |
54 void FaviconUrlUpdated( | 59 void FaviconUrlUpdated( |
55 const std::vector<web::FaviconURL>& candidates) override; | 60 const std::vector<web::FaviconURL>& candidates) override; |
56 | 61 |
57 // Returns the active navigation entry's favicon. | 62 // Returns the active navigation entry's favicon. |
58 web::FaviconStatus& GetFaviconStatus(); | 63 web::FaviconStatus& GetFaviconStatus(); |
59 | 64 |
| 65 // The URL passed to FetchFavicon(). |
| 66 GURL fetch_favicon_url_; |
| 67 |
60 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); | 68 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); |
61 }; | 69 }; |
62 | 70 |
63 } // namespace favicon | 71 } // namespace favicon |
64 | 72 |
65 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ | 73 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
OLD | NEW |