| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/favicon/core/favicon_driver_impl.h" | 9 #include "components/favicon/core/favicon_driver_impl.h" |
| 10 #import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h" | 10 #import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // WebState events to start download of favicons and to get informed when the | 21 // WebState events to start download of favicons and to get informed when the |
| 22 // favicon download has completed. | 22 // favicon download has completed. |
| 23 class WebFaviconDriver : public web::WebStateObserver, | 23 class WebFaviconDriver : public web::WebStateObserver, |
| 24 public web::WebStateUserData<WebFaviconDriver>, | 24 public web::WebStateUserData<WebFaviconDriver>, |
| 25 public FaviconDriverImpl { | 25 public FaviconDriverImpl { |
| 26 public: | 26 public: |
| 27 ~WebFaviconDriver() override; | 27 ~WebFaviconDriver() override; |
| 28 | 28 |
| 29 static void CreateForWebState(web::WebState* web_state, | 29 static void CreateForWebState(web::WebState* web_state, |
| 30 FaviconService* favicon_service, | 30 FaviconService* favicon_service, |
| 31 history::HistoryService* history_service, | 31 history::HistoryService* history_service); |
| 32 bookmarks::BookmarkModel* bookmark_model); | |
| 33 | 32 |
| 34 // FaviconDriver implementation. | 33 // FaviconDriver implementation. |
| 35 void FetchFavicon(const GURL& page_url, bool is_same_document) override; | 34 void FetchFavicon(const GURL& page_url, bool is_same_document) override; |
| 36 gfx::Image GetFavicon() const override; | 35 gfx::Image GetFavicon() const override; |
| 37 bool FaviconIsValid() const override; | 36 bool FaviconIsValid() const override; |
| 38 GURL GetActiveURL() override; | 37 GURL GetActiveURL() override; |
| 39 | 38 |
| 40 // FaviconHandler::Delegate implementation. | 39 // FaviconHandler::Delegate implementation. |
| 41 int DownloadImage(const GURL& url, | 40 int DownloadImage(const GURL& url, |
| 42 int max_image_size, | 41 int max_image_size, |
| 43 ImageDownloadCallback callback) override; | 42 ImageDownloadCallback callback) override; |
| 44 void DownloadManifest(const GURL& url, | 43 void DownloadManifest(const GURL& url, |
| 45 ManifestDownloadCallback callback) override; | 44 ManifestDownloadCallback callback) override; |
| 46 bool IsOffTheRecord() override; | 45 bool IsOffTheRecord() override; |
| 47 void OnFaviconUpdated( | 46 void OnFaviconUpdated( |
| 48 const GURL& page_url, | 47 const GURL& page_url, |
| 49 FaviconDriverObserver::NotificationIconType notification_icon_type, | 48 FaviconDriverObserver::NotificationIconType notification_icon_type, |
| 50 const GURL& icon_url, | 49 const GURL& icon_url, |
| 51 bool icon_url_changed, | 50 bool icon_url_changed, |
| 52 const gfx::Image& image) override; | 51 const gfx::Image& image) override; |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 friend class web::WebStateUserData<WebFaviconDriver>; | 54 friend class web::WebStateUserData<WebFaviconDriver>; |
| 56 | 55 |
| 57 WebFaviconDriver(web::WebState* web_state, | 56 WebFaviconDriver(web::WebState* web_state, |
| 58 FaviconService* favicon_service, | 57 FaviconService* favicon_service, |
| 59 history::HistoryService* history_service, | 58 history::HistoryService* history_service); |
| 60 bookmarks::BookmarkModel* bookmark_model); | |
| 61 | 59 |
| 62 // web::WebStateObserver implementation. | 60 // web::WebStateObserver implementation. |
| 63 void FaviconUrlUpdated( | 61 void FaviconUrlUpdated( |
| 64 const std::vector<web::FaviconURL>& candidates) override; | 62 const std::vector<web::FaviconURL>& candidates) override; |
| 65 | 63 |
| 66 // The URL passed to FetchFavicon(). | 64 // The URL passed to FetchFavicon(). |
| 67 GURL fetch_favicon_url_; | 65 GURL fetch_favicon_url_; |
| 68 | 66 |
| 69 // Image Fetcher used to fetch favicon. | 67 // Image Fetcher used to fetch favicon. |
| 70 image_fetcher::IOSImageDataFetcherWrapper image_fetcher_; | 68 image_fetcher::IOSImageDataFetcherWrapper image_fetcher_; |
| 71 | 69 |
| 72 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); | 70 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 } // namespace favicon | 73 } // namespace favicon |
| 76 | 74 |
| 77 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ | 75 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
| OLD | NEW |