Index: components/favicon/ios/web_favicon_driver.h |
diff --git a/components/favicon/ios/web_favicon_driver.h b/components/favicon/ios/web_favicon_driver.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..343d2be90a2fad7da98a5d3e4154b7e55688056d |
--- /dev/null |
+++ b/components/favicon/ios/web_favicon_driver.h |
@@ -0,0 +1,66 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
+#define COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |
+ |
+#include "components/favicon/core/favicon_driver_impl.h" |
+#include "ios/web/public/web_state/web_state_observer.h" |
+#include "ios/web/public/web_state/web_state_user_data.h" |
+ |
+namespace web { |
+struct FaviconStatus; |
+class WebState; |
+} |
+ |
+namespace favicon { |
+ |
+// WebFaviconDriver is an implementation of FaviconDriver that listen to |
+// WebState events to start download of favicons and to get informed when the |
+// favicon download has completed. |
+class WebFaviconDriver : public web::WebStateObserver, |
+ public web::WebStateUserData<WebFaviconDriver>, |
+ public FaviconDriverImpl { |
+ public: |
+ static void CreateForWebState(web::WebState* web_state, |
+ FaviconService* favicon_service, |
+ history::HistoryService* history_service, |
+ bookmarks::BookmarkModel* bookmark_model); |
+ |
+ // FaviconDriver implementation. |
+ gfx::Image GetFavicon() const override; |
+ bool FaviconIsValid() const override; |
+ int StartDownload(const GURL& url, int max_bitmap_size) override; |
+ bool IsOffTheRecord() override; |
+ GURL GetActiveURL() override; |
+ base::string16 GetActiveTitle() override; |
+ bool GetActiveFaviconValidity() override; |
+ void SetActiveFaviconValidity(bool valid) override; |
+ GURL GetActiveFaviconURL() override; |
+ void SetActiveFaviconURL(const GURL& url) override; |
+ gfx::Image GetActiveFaviconImage() override; |
+ void SetActiveFaviconImage(const gfx::Image& image) override; |
+ |
+ private: |
+ friend class web::WebStateUserData<WebFaviconDriver>; |
+ |
+ WebFaviconDriver(web::WebState* web_state, |
+ FaviconService* favicon_service, |
+ history::HistoryService* history_service, |
+ bookmarks::BookmarkModel* bookmark_model); |
+ ~WebFaviconDriver() override; |
+ |
+ // web::WebStateObserver implementation. |
+ void FaviconURLUpdated( |
+ const std::vector<web::FaviconURL>& candidates) override; |
+ |
+ // Returns the active navigation entry's favicon. |
+ web::FaviconStatus& GetFaviconStatus(); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); |
+}; |
+ |
+} // namespace favicon |
+ |
+#endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ |