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

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

Issue 56143002: Make FaviconService() use Porfile as parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test but break the DEPS Created 7 years, 1 month 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 (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"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 // The favicon service provides methods to access favicons. It calls the history 29 // The favicon service provides methods to access favicons. It calls the history
30 // backend behind the scenes. 30 // backend behind the scenes.
31 // 31 //
32 // This service is thread safe. Each request callback is invoked in the 32 // This service is thread safe. Each request callback is invoked in the
33 // thread that made the request. 33 // thread that made the request.
34 class FaviconService : public CancelableRequestProvider, 34 class FaviconService : public CancelableRequestProvider,
35 public BrowserContextKeyedService { 35 public BrowserContextKeyedService {
36 public: 36 public:
37 explicit FaviconService(HistoryService* history_service); 37 explicit FaviconService(Profile* profile);
38 38
39 virtual ~FaviconService(); 39 virtual ~FaviconService();
40 40
41 // Auxiliary argument structure for requesting favicons for URLs. 41 // Auxiliary argument structure for requesting favicons for URLs.
42 struct FaviconForURLParams { 42 struct FaviconForURLParams {
43 FaviconForURLParams(Profile* profile, 43 FaviconForURLParams(const GURL& page_url,
44 const GURL& page_url,
45 int icon_types, 44 int icon_types,
46 int desired_size_in_dip) 45 int desired_size_in_dip)
47 : profile(profile), 46 : page_url(page_url),
48 page_url(page_url),
49 icon_types(icon_types), 47 icon_types(icon_types),
50 desired_size_in_dip(desired_size_in_dip) {} 48 desired_size_in_dip(desired_size_in_dip) {}
51 49
52 Profile* profile;
53 GURL page_url; 50 GURL page_url;
54 int icon_types; 51 int icon_types;
55 int desired_size_in_dip; 52 int desired_size_in_dip;
56 }; 53 };
57 54
58 // Callback for GetFaviconImage() and GetFaviconImageForURL(). 55 // Callback for GetFaviconImage() and GetFaviconImageForURL().
59 // |FaviconImageResult::image| is constructed from the bitmaps for the 56 // |FaviconImageResult::image| is constructed from the bitmaps for the
60 // passed in URL and icon types which most which closely match the passed in 57 // passed in URL and icon types which most which closely match the passed in
61 // |desired_size_in_dip| at the scale factors supported by the current 58 // |desired_size_in_dip| at the scale factors supported by the current
62 // platform (eg MacOS) in addition to 1x. 59 // platform (eg MacOS) in addition to 1x.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 234
238 // Avoid repeated requests to download missing favicon. 235 // Avoid repeated requests to download missing favicon.
239 void UnableToDownloadFavicon(const GURL& icon_url); 236 void UnableToDownloadFavicon(const GURL& icon_url);
240 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; 237 bool WasUnableToDownloadFavicon(const GURL& icon_url) const;
241 void ClearUnableToDownloadFavicons(); 238 void ClearUnableToDownloadFavicons();
242 239
243 private: 240 private:
244 typedef uint32 MissingFaviconURLHash; 241 typedef uint32 MissingFaviconURLHash;
245 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; 242 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
246 HistoryService* history_service_; 243 HistoryService* history_service_;
244 Profile* profile_;
247 245
248 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and 246 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and
249 // GetFaviconForURL(). 247 // GetFaviconForURL().
250 CancelableTaskTracker::TaskId GetFaviconForURLImpl( 248 CancelableTaskTracker::TaskId GetFaviconForURLImpl(
251 const FaviconForURLParams& params, 249 const FaviconForURLParams& params,
252 const std::vector<ui::ScaleFactor>& desired_scale_factors, 250 const std::vector<ui::ScaleFactor>& desired_scale_factors,
253 const FaviconResultsCallback& callback, 251 const FaviconResultsCallback& callback,
254 CancelableTaskTracker* tracker); 252 CancelableTaskTracker* tracker);
255 253
256 // Intermediate callback for GetFaviconImage() and GetFaviconImageForURL() 254 // Intermediate callback for GetFaviconImage() and GetFaviconImageForURL()
(...skipping 11 matching lines...) Expand all
268 void RunFaviconRawCallbackWithBitmapResults( 266 void RunFaviconRawCallbackWithBitmapResults(
269 const FaviconRawCallback& callback, 267 const FaviconRawCallback& callback,
270 int desired_size_in_dip, 268 int desired_size_in_dip,
271 ui::ScaleFactor desired_scale_factor, 269 ui::ScaleFactor desired_scale_factor,
272 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); 270 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results);
273 271
274 DISALLOW_COPY_AND_ASSIGN(FaviconService); 272 DISALLOW_COPY_AND_ASSIGN(FaviconService);
275 }; 273 };
276 274
277 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 275 #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