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

Unified Diff: chrome/browser/favicon/favicon_service.h

Issue 10918065: Introduce structures to reduce the number of arguments in the FaviconService methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use copies rather than refs + fix nits. Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/favicon/favicon_handler.cc ('k') | chrome/browser/favicon/favicon_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/favicon_service.h
diff --git a/chrome/browser/favicon/favicon_service.h b/chrome/browser/favicon/favicon_service.h
index 9cb4f583e24eeb7a36feeefa05b8167052c585ac..750874c475c945b35481b4dafc9d0075c3c4046e 100644
--- a/chrome/browser/favicon/favicon_service.h
+++ b/chrome/browser/favicon/favicon_service.h
@@ -31,6 +31,45 @@ class FaviconService : public CancelableRequestProvider,
virtual ~FaviconService();
+ // Auxiliary argument structure for requesting favicons.
James Hawkins 2012/09/05 22:02:58 Why is this necessary?
Leandro Graciá Gil 2012/09/05 22:04:28 I could remove this case and leave only the URL on
James Hawkins 2012/09/05 22:11:49 Yes, please remove. The FaviconForURLParams is a
+ struct FaviconParams {
+ FaviconParams(const GURL& icon_url,
+ history::IconType icon_type,
+ int desired_size_in_dip,
+ CancelableRequestConsumerBase* consumer)
+ : icon_url(icon_url),
+ icon_type(icon_type),
+ desired_size_in_dip(desired_size_in_dip),
+ consumer(consumer) {
+ }
+
+ GURL icon_url;
+ history::IconType icon_type;
+ int desired_size_in_dip;
+ CancelableRequestConsumerBase* consumer;
+ };
+
+ // Auxiliary argument structure for requesting favicons for URLs.
+ struct FaviconForURLParams {
+ FaviconForURLParams(Profile* profile,
+ const GURL& page_url,
+ int icon_types,
+ int desired_size_in_dip,
+ CancelableRequestConsumerBase* consumer)
+ : profile(profile),
+ page_url(page_url),
+ icon_types(icon_types),
+ desired_size_in_dip(desired_size_in_dip),
+ consumer(consumer) {
+ }
+
+ Profile* profile;
+ GURL page_url;
+ int icon_types;
+ int desired_size_in_dip;
+ CancelableRequestConsumerBase* consumer;
+ };
+
// Callback for GetFaviconImage() and GetFaviconImageForURL().
// |FaviconImageResult::image| is constructed from the bitmaps for the
// passed in URL and icon types which most which closely match the passed in
@@ -85,24 +124,15 @@ class FaviconService : public CancelableRequestProvider,
// Each of the three methods below differs in the format of the callback and
// the requested scale factors. All of the scale factors supported by the
// current platform (eg MacOS) are requested for GetFaviconImage().
- Handle GetFaviconImage(const GURL& icon_url,
- history::IconType icon_type,
- int desired_size_in_dip,
- CancelableRequestConsumerBase* consumer,
+ Handle GetFaviconImage(const FaviconParams& params,
const FaviconImageCallback& callback);
- Handle GetRawFavicon(const GURL& icon_url,
- history::IconType icon_type,
- int desired_size_in_dip,
+ Handle GetRawFavicon(const FaviconParams& params,
ui::ScaleFactor desired_scale_factor,
- CancelableRequestConsumerBase* consumer,
const FaviconRawCallback& callback);
- Handle GetFavicon(const GURL& icon_url,
- history::IconType icon_type,
- int desired_size_in_dip,
+ Handle GetFavicon(const FaviconParams& params,
const std::vector<ui::ScaleFactor>& desired_scale_factors,
- CancelableRequestConsumerBase* consumer,
const FaviconResultsCallback& callback);
// Fetches the |icon_type| of favicon at |icon_url|, sending the results to
@@ -125,28 +155,16 @@ class FaviconService : public CancelableRequestProvider,
// callback and the requested scale factors. All of the scale factors
// supported by the current platform (eg MacOS) are requested for
// GetFaviconImageForURL().
- Handle GetFaviconImageForURL(Profile* profile,
- const GURL& page_url,
- int icon_types,
- int desired_size_in_dip,
- CancelableRequestConsumerBase* consumer,
+ Handle GetFaviconImageForURL(const FaviconForURLParams& params,
const FaviconImageCallback& callback);
- Handle GetRawFaviconForURL(Profile* profile,
- const GURL& page_url,
- int icon_types,
- int desired_size_in_dip,
+ Handle GetRawFaviconForURL(const FaviconForURLParams& params,
ui::ScaleFactor desired_scale_factor,
- CancelableRequestConsumerBase* consumer,
const FaviconRawCallback& callback);
Handle GetFaviconForURL(
- Profile* profile,
- const GURL& page_url,
- int icon_types,
- int desired_size_in_dip,
+ const FaviconForURLParams& params,
const std::vector<ui::ScaleFactor>& desired_scale_factors,
- CancelableRequestConsumerBase* consumer,
const FaviconResultsCallback& callback);
// Requests the favicon for |favicon_id| which most closely matches
@@ -189,12 +207,8 @@ class FaviconService : public CancelableRequestProvider,
// Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and
// GetFaviconForURL().
Handle GetFaviconForURLImpl(
- Profile* profile,
- const GURL& page_url,
- int icon_types,
- int desired_size_in_dip,
+ const FaviconForURLParams& params,
const std::vector<ui::ScaleFactor>& desired_scale_factors,
- CancelableRequestConsumerBase* consumer,
GetFaviconRequest* request);
// Intermediate callback for GetFaviconImage() and GetFaviconImageForURL()
« no previous file with comments | « chrome/browser/favicon/favicon_handler.cc ('k') | chrome/browser/favicon/favicon_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698