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

Side by Side Diff: chrome/browser/fav_icon_helper.h

Issue 6374009: Get rid of a few more interfaces from RenderViewHostDelegate that aren't need... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/fav_icon_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_FAV_ICON_HELPER_H__ 5 #ifndef CHROME_BROWSER_FAV_ICON_HELPER_H__
6 #define CHROME_BROWSER_FAV_ICON_HELPER_H__ 6 #define CHROME_BROWSER_FAV_ICON_HELPER_H__
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "chrome/browser/cancelable_request.h" 14 #include "chrome/browser/cancelable_request.h"
15 #include "chrome/browser/favicon_service.h" 15 #include "chrome/browser/favicon_service.h"
16 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 16 #include "chrome/browser/tab_contents/web_navigation_observer.h"
17 #include "chrome/common/ref_counted_util.h" 17 #include "chrome/common/ref_counted_util.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 19
20 class NavigationEntry; 20 class NavigationEntry;
21 class Profile; 21 class Profile;
22 class RefCountedMemory; 22 class RefCountedMemory;
23 class SkBitmap; 23 class SkBitmap;
24 class TabContents; 24 class TabContents;
25 25
26 // FavIconHelper is used to fetch the favicon for TabContents. 26 // FavIconHelper is used to fetch the favicon for TabContents.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // between page to favicon url. The callback for this is OnFavIconData. 58 // between page to favicon url. The callback for this is OnFavIconData.
59 // 59 //
60 // OnFavIconData either updates the favicon of the NavigationEntry (if the 60 // OnFavIconData either updates the favicon of the NavigationEntry (if the
61 // db knew about the favicon), or requests the renderer to download the 61 // db knew about the favicon), or requests the renderer to download the
62 // favicon. 62 // favicon.
63 // 63 //
64 // When the renderer downloads the favicon SetFavIconImageData is invoked, 64 // When the renderer downloads the favicon SetFavIconImageData is invoked,
65 // at which point we update the favicon of the NavigationEntry and notify 65 // at which point we update the favicon of the NavigationEntry and notify
66 // the database to save the favicon. 66 // the database to save the favicon.
67 67
68 class FavIconHelper : public RenderViewHostDelegate::FavIcon { 68 class FavIconHelper : public WebNavigationObserver {
69 public: 69 public:
70 explicit FavIconHelper(TabContents* tab_contents); 70 explicit FavIconHelper(TabContents* tab_contents);
71 virtual ~FavIconHelper(); 71 virtual ~FavIconHelper();
72 72
73 // Initiates loading the favicon for the specified url. 73 // Initiates loading the favicon for the specified url.
74 void FetchFavIcon(const GURL& url); 74 void FetchFavIcon(const GURL& url);
75 75
76 // Initiates loading an image from given |image_url|. Returns a download id 76 // Initiates loading an image from given |image_url|. Returns a download id
77 // for caller to track the request. When download completes, |callback| is 77 // for caller to track the request. When download completes, |callback| is
78 // called with the three params: the download_id, a boolean flag to indicate 78 // called with the three params: the download_id, a boolean flag to indicate
(...skipping 13 matching lines...) Expand all
92 ImageDownloadCallback* callback) 92 ImageDownloadCallback* callback)
93 : url(url), 93 : url(url),
94 image_url(image_url), 94 image_url(image_url),
95 callback(callback) { } 95 callback(callback) { }
96 96
97 GURL url; 97 GURL url;
98 GURL image_url; 98 GURL image_url;
99 ImageDownloadCallback* callback; 99 ImageDownloadCallback* callback;
100 }; 100 };
101 101
102 // RenderViewHostDelegate::Favicon implementation. 102 // WebNavigationObserver implementation.
103 virtual void DidDownloadFavIcon(RenderViewHost* render_view_host, 103 virtual bool OnMessageReceived(const IPC::Message& message);
104 int id, 104
105 const GURL& image_url, 105 void OnDidDownloadFavIcon(int id,
106 bool errored, 106 const GURL& image_url,
107 const SkBitmap& image); 107 bool errored,
108 virtual void UpdateFavIconURL(RenderViewHost* render_view_host, 108 const SkBitmap& image);
109 int32 page_id, 109 void OnUpdateFavIconURL(int32 page_id, const GURL& icon_url);
110 const GURL& icon_url);
111 110
112 // Return the NavigationEntry for the active entry, or NULL if the active 111 // Return the NavigationEntry for the active entry, or NULL if the active
113 // entries URL does not match that of the URL last passed to FetchFavIcon. 112 // entries URL does not match that of the URL last passed to FetchFavIcon.
114 NavigationEntry* GetEntry(); 113 NavigationEntry* GetEntry();
115 114
116 Profile* profile(); 115 Profile* profile();
117 116
118 FaviconService* GetFaviconService(); 117 FaviconService* GetFaviconService();
119 118
120 // See description above class for details. 119 // See description above class for details.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool fav_icon_expired_; 182 bool fav_icon_expired_;
184 183
185 // Requests to the renderer to download favicons. 184 // Requests to the renderer to download favicons.
186 typedef std::map<int, DownloadRequest> DownloadRequests; 185 typedef std::map<int, DownloadRequest> DownloadRequests;
187 DownloadRequests download_requests_; 186 DownloadRequests download_requests_;
188 187
189 DISALLOW_COPY_AND_ASSIGN(FavIconHelper); 188 DISALLOW_COPY_AND_ASSIGN(FavIconHelper);
190 }; 189 };
191 190
192 #endif // CHROME_BROWSER_FAV_ICON_HELPER_H__ 191 #endif // CHROME_BROWSER_FAV_ICON_HELPER_H__
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/fav_icon_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698