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

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

Issue 335233003: Convert ui::ScaleFactor -> float in favicon/history code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/task/cancelable_task_tracker.h" 13 #include "base/task/cancelable_task_tracker.h"
14 #include "components/favicon_base/favicon_callback.h" 14 #include "components/favicon_base/favicon_callback.h"
15 #include "components/favicon_base/favicon_types.h" 15 #include "components/favicon_base/favicon_types.h"
16 #include "components/keyed_service/core/keyed_service.h" 16 #include "components/keyed_service/core/keyed_service.h"
17 #include "ui/base/layout.h"
18 17
19 class GURL; 18 class GURL;
20 class HistoryService; 19 class HistoryService;
21 struct ImportedFaviconUsage; 20 struct ImportedFaviconUsage;
22 class Profile; 21 class Profile;
23 22
24 // The favicon service provides methods to access favicons. It calls the history 23 // The favicon service provides methods to access favicons. It calls the history
25 // backend behind the scenes. 24 // backend behind the scenes.
26 class FaviconService : public KeyedService { 25 class FaviconService : public KeyedService {
27 public: 26 public:
(...skipping 30 matching lines...) Expand all
58 // |image| originate from. 57 // |image| originate from.
59 // TODO(pkotwicz): Enable constructing |image| from bitmaps from several 58 // TODO(pkotwicz): Enable constructing |image| from bitmaps from several
60 // icon URLs. 59 // icon URLs.
61 60
62 // Requests the favicon at |icon_url| of |icon_type| whose size most closely 61 // Requests the favicon at |icon_url| of |icon_type| whose size most closely
63 // matches |desired_size_in_dip|. If |desired_size_in_dip| is 0, the largest 62 // matches |desired_size_in_dip|. If |desired_size_in_dip| is 0, the largest
64 // favicon bitmap at |icon_url| is returned. |consumer| is notified when the 63 // favicon bitmap at |icon_url| is returned. |consumer| is notified when the
65 // bits have been fetched. |icon_url| is the URL of the icon itself, e.g. 64 // bits have been fetched. |icon_url| is the URL of the icon itself, e.g.
66 // <http://www.google.com/favicon.ico>. 65 // <http://www.google.com/favicon.ico>.
67 // Each of the three methods below differs in the format of the callback and 66 // Each of the three methods below differs in the format of the callback and
68 // the requested scale factors. All of the scale factors supported by the 67 // the requested scales. All of the scale factors supported by the
pkotwicz 2014/06/20 00:35:41 Find and replace 'scale factors' -> 'scales'
oshima 2014/06/20 04:16:33 I intentionally left them as scale factors as they
69 // current platform (eg MacOS) are requested for GetFaviconImage(). 68 // current platform (eg MacOS) are requested for GetFaviconImage().
70 base::CancelableTaskTracker::TaskId GetFaviconImage( 69 base::CancelableTaskTracker::TaskId GetFaviconImage(
71 const GURL& icon_url, 70 const GURL& icon_url,
72 favicon_base::IconType icon_type, 71 favicon_base::IconType icon_type,
73 int desired_size_in_dip, 72 int desired_size_in_dip,
74 const favicon_base::FaviconImageCallback& callback, 73 const favicon_base::FaviconImageCallback& callback,
75 base::CancelableTaskTracker* tracker); 74 base::CancelableTaskTracker* tracker);
76 75
77 base::CancelableTaskTracker::TaskId GetRawFavicon( 76 base::CancelableTaskTracker::TaskId GetRawFavicon(
78 const GURL& icon_url, 77 const GURL& icon_url,
79 favicon_base::IconType icon_type, 78 favicon_base::IconType icon_type,
80 int desired_size_in_dip, 79 int desired_size_in_dip,
81 ui::ScaleFactor desired_scale_factor, 80 float desired_favicon_scale,
82 const favicon_base::FaviconRawBitmapCallback& callback, 81 const favicon_base::FaviconRawBitmapCallback& callback,
83 base::CancelableTaskTracker* tracker); 82 base::CancelableTaskTracker* tracker);
84 83
85 // The first argument for |callback| is the set of bitmaps for the passed in 84 // The first argument for |callback| is the set of bitmaps for the passed in
86 // URL and icon types whose pixel sizes best match the passed in 85 // URL and icon types whose pixel sizes best match the passed in
87 // |desired_size_in_dip| at the scale factors supported by the current 86 // |desired_size_in_dip| at the scale factors supported by the current
88 // platform (eg MacOS) in addition to 1x. The vector has at most one result 87 // platform (eg MacOS) in addition to 1x. The vector has at most one result
89 // for each of the scale factors. There are less entries if a single result 88 // for each of the scale factors. There are less entries if a single result
90 // is the best bitmap to use for several scale factors. 89 // is the best bitmap to use for several scale factors.
91 base::CancelableTaskTracker::TaskId GetFavicon( 90 base::CancelableTaskTracker::TaskId GetFavicon(
(...skipping 25 matching lines...) Expand all
117 // returned. 116 // returned.
118 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 117 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
119 const GURL& page_url, 118 const GURL& page_url,
120 const std::vector<GURL>& icon_urls, 119 const std::vector<GURL>& icon_urls,
121 int icon_types, 120 int icon_types,
122 int desired_size_in_dip, 121 int desired_size_in_dip,
123 const favicon_base::FaviconResultsCallback& callback, 122 const favicon_base::FaviconResultsCallback& callback,
124 base::CancelableTaskTracker* tracker); 123 base::CancelableTaskTracker* tracker);
125 124
126 // Requests the favicons of any of |icon_types| whose pixel sizes most 125 // Requests the favicons of any of |icon_types| whose pixel sizes most
127 // closely match |desired_size_in_dip| and desired scale factors for a web 126 // closely match |desired_size_in_dip| and desired scale for a web
128 // page URL. If |desired_size_in_dip| is 0, the largest favicon for the web 127 // page URL. If |desired_size_in_dip| is 0, the largest favicon for the web
129 // page URL is returned. |callback| is run when the bits have been fetched. 128 // page URL is returned. |callback| is run when the bits have been fetched.
130 // |icon_types| can be any combination of IconType value, but only one icon 129 // |icon_types| can be any combination of IconType value, but only one icon
131 // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON and 130 // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON and
132 // FAVICON. Each of the three methods below differs in the format of the 131 // FAVICON. Each of the three methods below differs in the format of the
133 // callback and the requested scale factors. All of the scale factors 132 // callback and the requested scales. All of the scale factors
134 // supported by the current platform (eg MacOS) are requested for 133 // supported by the current platform (eg MacOS) are requested for
135 // GetFaviconImageForPageURL(). 134 // GetFaviconImageForPageURL().
136 // Note. |callback| is always run asynchronously. 135 // Note. |callback| is always run asynchronously.
137 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( 136 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL(
138 const FaviconForPageURLParams& params, 137 const FaviconForPageURLParams& params,
139 const favicon_base::FaviconImageCallback& callback, 138 const favicon_base::FaviconImageCallback& callback,
140 base::CancelableTaskTracker* tracker); 139 base::CancelableTaskTracker* tracker);
141 140
142 base::CancelableTaskTracker::TaskId GetRawFaviconForPageURL( 141 base::CancelableTaskTracker::TaskId GetRawFaviconForPageURL(
143 const FaviconForPageURLParams& params, 142 const FaviconForPageURLParams& params,
144 ui::ScaleFactor desired_scale_factor, 143 float desired_favicon_scale,
145 const favicon_base::FaviconRawBitmapCallback& callback, 144 const favicon_base::FaviconRawBitmapCallback& callback,
146 base::CancelableTaskTracker* tracker); 145 base::CancelableTaskTracker* tracker);
147 146
148 // See HistoryService::GetLargestFaviconForPageURL(). 147 // See HistoryService::GetLargestFaviconForPageURL().
149 base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL( 148 base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL(
150 Profile* profile, 149 Profile* profile,
151 const GURL& page_url, 150 const GURL& page_url,
152 const std::vector<int>& icon_types, 151 const std::vector<int>& icon_types,
153 int minimum_size_in_pixels, 152 int minimum_size_in_pixels,
154 const favicon_base::FaviconRawBitmapCallback& callback, 153 const favicon_base::FaviconRawBitmapCallback& callback,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void RunFaviconRawBitmapCallbackWithBitmapResults( 245 void RunFaviconRawBitmapCallbackWithBitmapResults(
247 const favicon_base::FaviconRawBitmapCallback& callback, 246 const favicon_base::FaviconRawBitmapCallback& callback,
248 int desired_size_in_pixel, 247 int desired_size_in_pixel,
249 const std::vector<favicon_base::FaviconRawBitmapResult>& 248 const std::vector<favicon_base::FaviconRawBitmapResult>&
250 favicon_bitmap_results); 249 favicon_bitmap_results);
251 250
252 DISALLOW_COPY_AND_ASSIGN(FaviconService); 251 DISALLOW_COPY_AND_ASSIGN(FaviconService);
253 }; 252 };
254 253
255 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 254 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698