cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / favicon / content / content_favicon_driver.h
blobadbc7e79866efc738ba1297f88b847dbf47bf406
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_
6 #define COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_
8 #include "components/favicon/core/favicon_driver_impl.h"
9 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h"
11 #include "url/gurl.h"
13 namespace content {
14 struct FaviconStatus;
15 struct FaviconURL;
16 class WebContents;
19 namespace favicon {
21 // ContentFaviconDriver is an implementation of FaviconDriver that listens to
22 // WebContents events to start download of favicons and to get informed when the
23 // favicon download has completed.
24 class ContentFaviconDriver
25 : public content::WebContentsObserver,
26 public content::WebContentsUserData<ContentFaviconDriver>,
27 public FaviconDriverImpl {
28 public:
29 static void CreateForWebContents(content::WebContents* web_contents,
30 FaviconService* favicon_service,
31 history::HistoryService* history_service,
32 bookmarks::BookmarkModel* bookmark_model);
34 // Returns the current tab's favicon URLs. If this is empty,
35 // DidUpdateFaviconURL has not yet been called for the current navigation.
36 const std::vector<content::FaviconURL>& favicon_urls() const {
37 return favicon_urls_;
40 // Saves the favicon for the last committed navigation entry to the thumbnail
41 // database.
42 void SaveFavicon();
44 // FaviconDriver implementation.
45 gfx::Image GetFavicon() const override;
46 bool FaviconIsValid() const override;
47 int StartDownload(const GURL& url, int max_bitmap_size) override;
48 bool IsOffTheRecord() override;
49 GURL GetActiveURL() override;
50 bool GetActiveFaviconValidity() override;
51 void SetActiveFaviconValidity(bool valid) override;
52 GURL GetActiveFaviconURL() override;
53 void SetActiveFaviconURL(const GURL& url) override;
54 void SetActiveFaviconImage(const gfx::Image& image) override;
56 protected:
57 ContentFaviconDriver(content::WebContents* web_contents,
58 FaviconService* favicon_service,
59 history::HistoryService* history_service,
60 bookmarks::BookmarkModel* bookmark_model);
61 ~ContentFaviconDriver() override;
63 private:
64 friend class content::WebContentsUserData<ContentFaviconDriver>;
66 // FaviconDriver implementation.
67 void NotifyFaviconUpdated(bool icon_url_changed) override;
69 // content::WebContentsObserver implementation.
70 void DidUpdateFaviconURL(
71 const std::vector<content::FaviconURL>& candidates) override;
72 void DidStartNavigationToPendingEntry(
73 const GURL& url,
74 content::NavigationController::ReloadType reload_type) override;
75 void DidNavigateMainFrame(
76 const content::LoadCommittedDetails& details,
77 const content::FrameNavigateParams& params) override;
79 // Returns the active navigation entry's favicon.
80 content::FaviconStatus& GetFaviconStatus();
82 GURL bypass_cache_page_url_;
83 std::vector<content::FaviconURL> favicon_urls_;
85 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriver);
88 } // namespace favicon
90 #endif // COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_