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

Side by Side Diff: components/favicon/ios/web_favicon_driver.h

Issue 2691933004: Avoid cyclic dependency FaviconHandler<-->FaviconDriverImpl (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ 5 #ifndef COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_
6 #define COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ 6 #define COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/favicon/core/favicon_driver_impl.h" 9 #include "components/favicon/core/favicon_driver_impl.h"
10 #include "components/favicon/core/favicon_handler.h"
10 #include "ios/web/public/web_state/web_state_observer.h" 11 #include "ios/web/public/web_state/web_state_observer.h"
11 #include "ios/web/public/web_state/web_state_user_data.h" 12 #include "ios/web/public/web_state/web_state_user_data.h"
12 13
13 namespace web { 14 namespace web {
14 class WebState; 15 class WebState;
15 } 16 }
16 17
17 namespace favicon { 18 namespace favicon {
18 19
19 // WebFaviconDriver is an implementation of FaviconDriver that listen to 20 // WebFaviconDriver is an implementation of FaviconDriver that listen to
20 // WebState events to start download of favicons and to get informed when the 21 // WebState events to start download of favicons and to get informed when the
21 // favicon download has completed. 22 // favicon download has completed.
22 class WebFaviconDriver : public web::WebStateObserver, 23 class WebFaviconDriver : public web::WebStateObserver,
23 public web::WebStateUserData<WebFaviconDriver>, 24 public web::WebStateUserData<WebFaviconDriver>,
25 public FaviconHandler::Delegate,
24 public FaviconDriverImpl { 26 public FaviconDriverImpl {
25 public: 27 public:
26 static void CreateForWebState(web::WebState* web_state, 28 static void CreateForWebState(web::WebState* web_state,
27 FaviconService* favicon_service, 29 FaviconService* favicon_service,
28 history::HistoryService* history_service, 30 history::HistoryService* history_service,
29 bookmarks::BookmarkModel* bookmark_model); 31 bookmarks::BookmarkModel* bookmark_model);
30 32
31 // FaviconDriver implementation. 33 // FaviconDriver implementation.
32 void FetchFavicon(const GURL& url) override; 34 void FetchFavicon(const GURL& url) override;
33 gfx::Image GetFavicon() const override; 35 gfx::Image GetFavicon() const override;
34 bool FaviconIsValid() const override; 36 bool FaviconIsValid() const override;
35 int StartDownload(const GURL& url, int max_bitmap_size) override; 37 GURL GetActiveURL() override;
38
39 // FaviconHandler::Delegate implementation.
40 int DownloadImage(const GURL& url,
41 int max_image_size,
42 ImageDownloadCallback callback) override;
36 bool IsOffTheRecord() override; 43 bool IsOffTheRecord() override;
37 GURL GetActiveURL() override;
38 void OnFaviconUpdated( 44 void OnFaviconUpdated(
39 const GURL& page_url, 45 const GURL& page_url,
40 FaviconDriverObserver::NotificationIconType notification_icon_type, 46 FaviconDriverObserver::NotificationIconType notification_icon_type,
41 const GURL& icon_url, 47 const GURL& icon_url,
42 bool icon_url_changed, 48 bool icon_url_changed,
43 const gfx::Image& image) override; 49 const gfx::Image& image) override;
44 50
45 private: 51 private:
46 friend class web::WebStateUserData<WebFaviconDriver>; 52 friend class web::WebStateUserData<WebFaviconDriver>;
47 53
48 WebFaviconDriver(web::WebState* web_state, 54 WebFaviconDriver(web::WebState* web_state,
49 FaviconService* favicon_service, 55 FaviconService* favicon_service,
50 history::HistoryService* history_service, 56 history::HistoryService* history_service,
51 bookmarks::BookmarkModel* bookmark_model); 57 bookmarks::BookmarkModel* bookmark_model);
52 ~WebFaviconDriver() override; 58 ~WebFaviconDriver() override;
53 59
54 // web::WebStateObserver implementation. 60 // web::WebStateObserver implementation.
55 void FaviconUrlUpdated( 61 void FaviconUrlUpdated(
56 const std::vector<web::FaviconURL>& candidates) override; 62 const std::vector<web::FaviconURL>& candidates) override;
57 63
58 // The URL passed to FetchFavicon(). 64 // The URL passed to FetchFavicon().
59 GURL fetch_favicon_url_; 65 GURL fetch_favicon_url_;
60 66
61 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver); 67 DISALLOW_COPY_AND_ASSIGN(WebFaviconDriver);
62 }; 68 };
63 69
64 } // namespace favicon 70 } // namespace favicon
65 71
66 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_ 72 #endif // COMPONENTS_FAVICON_IOS_WEB_FAVICON_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698