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

Side by Side Diff: chrome/browser/favicon/favicon_service.h

Issue 14322023: Don't request missing favicon on every page request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync up to r199996 Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FAVICON_FAVICON_SERVICE_H_ 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/hash_tables.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/common/cancelable_request.h" 13 #include "chrome/browser/common/cancelable_request.h"
13 #include "chrome/browser/history/history_types.h" 14 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/profiles/profile_keyed_service.h" 15 #include "chrome/browser/profiles/profile_keyed_service.h"
15 #include "chrome/common/cancelable_task_tracker.h" 16 #include "chrome/common/cancelable_task_tracker.h"
16 #include "chrome/common/ref_counted_util.h" 17 #include "chrome/common/ref_counted_util.h"
17 #include "ui/base/layout.h" 18 #include "ui/base/layout.h"
18 19
19 class GURL; 20 class GURL;
20 class HistoryService; 21 class HistoryService;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // MergeFavicon() if it does not. 217 // MergeFavicon() if it does not.
217 // TODO(pkotwicz): Save unresized favicon bitmaps to the database. 218 // TODO(pkotwicz): Save unresized favicon bitmaps to the database.
218 // TODO(pkotwicz): Support adding favicons for multiple icon URLs to the 219 // TODO(pkotwicz): Support adding favicons for multiple icon URLs to the
219 // thumbnail database. 220 // thumbnail database.
220 void SetFavicons( 221 void SetFavicons(
221 const GURL& page_url, 222 const GURL& page_url,
222 const GURL& icon_url, 223 const GURL& icon_url,
223 history::IconType icon_type, 224 history::IconType icon_type,
224 const gfx::Image& image); 225 const gfx::Image& image);
225 226
227 // Avoid repeated requests to download missing favicon.
228 void UnableToDownloadFavicon(const GURL& icon_url);
229 bool WasUnableToDownloadFavicon(const GURL& icon_url) const;
230 void ClearUnableToDownloadFavicons();
231
226 private: 232 private:
233 typedef uint32 MissingFaviconURLHash;
234 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
227 HistoryService* history_service_; 235 HistoryService* history_service_;
228 236
229 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and 237 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and
230 // GetFaviconForURL(). 238 // GetFaviconForURL().
231 CancelableTaskTracker::TaskId GetFaviconForURLImpl( 239 CancelableTaskTracker::TaskId GetFaviconForURLImpl(
232 const FaviconForURLParams& params, 240 const FaviconForURLParams& params,
233 const std::vector<ui::ScaleFactor>& desired_scale_factors, 241 const std::vector<ui::ScaleFactor>& desired_scale_factors,
234 const FaviconResultsCallback& callback, 242 const FaviconResultsCallback& callback,
235 CancelableTaskTracker* tracker); 243 CancelableTaskTracker* tracker);
236 244
(...skipping 12 matching lines...) Expand all
249 void RunFaviconRawCallbackWithBitmapResults( 257 void RunFaviconRawCallbackWithBitmapResults(
250 const FaviconRawCallback& callback, 258 const FaviconRawCallback& callback,
251 int desired_size_in_dip, 259 int desired_size_in_dip,
252 ui::ScaleFactor desired_scale_factor, 260 ui::ScaleFactor desired_scale_factor,
253 const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results); 261 const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results);
254 262
255 DISALLOW_COPY_AND_ASSIGN(FaviconService); 263 DISALLOW_COPY_AND_ASSIGN(FaviconService);
256 }; 264 };
257 265
258 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 266 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_handler_unittest.cc ('k') | chrome/browser/favicon/favicon_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698