OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_ | |
6 #define COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_ | |
7 | |
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" | |
12 | |
13 namespace content { | |
14 struct FaviconStatus; | |
15 struct FaviconURL; | |
16 class WebContents; | |
17 } | |
18 | |
19 namespace favicon { | |
20 | |
21 // 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.
| |
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 // 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.
| |
30 // DidUpdateFaviconURL has not yet been called for the current navigation. | |
31 const std::vector<content::FaviconURL>& favicon_urls() const { | |
32 return favicon_urls_; | |
33 } | |
34 | |
35 // FaviconDriver implementation. | |
36 gfx::Image GetFavicon() const override; | |
37 bool FaviconIsValid() const override; | |
38 int StartDownload(const GURL& url, int max_bitmap_size) override; | |
39 bool IsOffTheRecord() override; | |
40 GURL GetActiveURL() override; | |
41 base::string16 GetActiveTitle() override; | |
42 bool GetActiveFaviconValidity() override; | |
43 void SetActiveFaviconValidity(bool valid) override; | |
44 GURL GetActiveFaviconURL() override; | |
45 void SetActiveFaviconURL(const GURL& url) override; | |
46 gfx::Image GetActiveFaviconImage() override; | |
47 void SetActiveFaviconImage(const gfx::Image& image) override; | |
48 | |
49 protected: | |
50 ContentFaviconDriver(content::WebContents* web_content, | |
51 FaviconService* favicon_service, | |
52 history::HistoryService* history_service, | |
53 bookmarks::BookmarkModel* bookmark_model); | |
54 | |
55 private: | |
56 friend class content::WebContentsUserData<ContentFaviconDriver>; | |
57 | |
58 // FaviconDriver implementation. | |
59 void NotifyFaviconUpdated(bool icon_url_changed) override; | |
60 | |
61 // content::WebContentsObserver implementation. | |
62 void DidUpdateFaviconURL( | |
63 const std::vector<content::FaviconURL>& candidates) override; | |
64 void DidStartNavigationToPendingEntry( | |
65 const GURL& url, | |
66 content::NavigationController::ReloadType reload_type) override; | |
67 void DidNavigateMainFrame( | |
68 const content::LoadCommittedDetails& details, | |
69 const content::FrameNavigateParams& params) override; | |
70 | |
71 // Returns the active navigation entry's favicon. | |
72 content::FaviconStatus& GetFaviconStatus(); | |
73 | |
74 GURL bypass_cache_page_url_; | |
75 std::vector<content::FaviconURL> favicon_urls_; | |
76 | |
77 DISALLOW_COPY_AND_ASSIGN(ContentFaviconDriver); | |
78 }; | |
79 | |
80 } // namespace favicon | |
81 | |
82 #endif // COMPONENTS_FAVICON_CONTENT_CONTENT_FAVICON_DRIVER_H_ | |
OLD | NEW |