Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: components/favicon/ios/web_favicon_driver.h

Issue 1064823002: Componentize FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon-notification
Patch Set: Fix BUILD.gn Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/favicon/core/favicon_handler.cc ('k') | components/favicon/ios/web_favicon_driver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « components/favicon/core/favicon_handler.cc ('k') | components/favicon/ios/web_favicon_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698