Index: components/favicon/content/content_favicon_driver.h |
diff --git a/components/favicon/content/content_favicon_driver.h b/components/favicon/content/content_favicon_driver.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..90b745f964baafb5523b55b391cee3e1bb191935 |
--- /dev/null |
+++ b/components/favicon/content/content_favicon_driver.h |
@@ -0,0 +1,82 @@ |
+// 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_CONTENT_CONTENT_FAVICON_DRIVER_H_ |
+#define COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_ |
+ |
+#include "components/favicon/core/favicon_driver_impl.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "content/public/browser/web_contents_user_data.h" |
+#include "url/gurl.h" |
+ |
+namespace content { |
+struct FaviconStatus; |
+struct FaviconURL; |
+class WebContents; |
+} |
+ |
+namespace favicon { |
+ |
+// ContentFaviconDriver is an implementation of FaviconDriver that listen to |
droger
2015/04/07 15:33:24
s/listen/listens/
sdefresne
2015/04/07 16:50:06
Done.
|
+// WebContents events to start download of favicons and to get informed when the |
+// favicon download has completed. |
+class ContentFaviconDriver |
+ : public content::WebContentsObserver, |
+ public content::WebContentsUserData<ContentFaviconDriver>, |
+ public FaviconDriverImpl { |
+ public: |
+ // Returns the current tab's favicon urls. If this is empty, |
droger
2015/04/07 15:33:24
s/urls/URLs/
sdefresne
2015/04/07 16:50:06
Done.
|
+ // DidUpdateFaviconURL has not yet been called for the current navigation. |
+ const std::vector<content::FaviconURL>& favicon_urls() const { |
+ return favicon_urls_; |
+ } |
+ |
+ // 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; |
+ |
+ protected: |
+ ContentFaviconDriver(content::WebContents* web_content, |
+ FaviconService* favicon_service, |
+ history::HistoryService* history_service, |
+ bookmarks::BookmarkModel* bookmark_model); |
+ |
+ private: |
+ friend class content::WebContentsUserData<ContentFaviconDriver>; |
+ |
+ // FaviconDriver implementation. |
+ void NotifyFaviconUpdated(bool icon_url_changed) override; |
+ |
+ // content::WebContentsObserver implementation. |
+ void DidUpdateFaviconURL( |
+ const std::vector<content::FaviconURL>& candidates) override; |
+ void DidStartNavigationToPendingEntry( |
+ const GURL& url, |
+ content::NavigationController::ReloadType reload_type) override; |
+ void DidNavigateMainFrame( |
+ const content::LoadCommittedDetails& details, |
+ const content::FrameNavigateParams& params) override; |
+ |
+ // Returns the active navigation entry's favicon. |
+ content::FaviconStatus& GetFaviconStatus(); |
+ |
+ GURL bypass_cache_page_url_; |
+ std::vector<content::FaviconURL> favicon_urls_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriver); |
+}; |
+ |
+} // namespace favicon |
+ |
+#endif // COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_ |