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

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: 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 private: 217 private:
219 typedef uint32 MissingFaviconURLHash; 218 typedef uint32 MissingFaviconURLHash;
220 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; 219 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
221 HistoryService* history_service_; 220 HistoryService* history_service_;
222 Profile* profile_; 221 Profile* profile_;
223 222
224 // Helper function for GetFaviconImageForPageURL(), GetRawFaviconForPageURL() 223 // Helper function for GetFaviconImageForPageURL(), GetRawFaviconForPageURL()
225 // and GetFaviconForPageURL(). 224 // and GetFaviconForPageURL().
226 base::CancelableTaskTracker::TaskId GetFaviconForPageURLImpl( 225 base::CancelableTaskTracker::TaskId GetFaviconForPageURLImpl(
227 const FaviconForPageURLParams& params, 226 const FaviconForPageURLParams& params,
228 const std::vector<ui::ScaleFactor>& desired_scale_factors, 227 const std::vector<float>& desired_favicon_scale,
229 const favicon_base::FaviconResultsCallback& callback, 228 const favicon_base::FaviconResultsCallback& callback,
230 base::CancelableTaskTracker* tracker); 229 base::CancelableTaskTracker* tracker);
231 230
232 // Intermediate callback for GetFaviconImage() and GetFaviconImageForPageURL() 231 // Intermediate callback for GetFaviconImage() and GetFaviconImageForPageURL()
233 // so that history service can deal solely with FaviconResultsCallback. 232 // so that history service can deal solely with FaviconResultsCallback.
234 // Builds favicon_base::FaviconImageResult from |favicon_bitmap_results| and 233 // Builds favicon_base::FaviconImageResult from |favicon_bitmap_results| and
235 // runs |callback|. 234 // runs |callback|.
236 void RunFaviconImageCallbackWithBitmapResults( 235 void RunFaviconImageCallbackWithBitmapResults(
237 const favicon_base::FaviconImageCallback& callback, 236 const favicon_base::FaviconImageCallback& callback,
238 int desired_size_in_dip, 237 int desired_size_in_dip,
239 const std::vector<favicon_base::FaviconRawBitmapResult>& 238 const std::vector<favicon_base::FaviconRawBitmapResult>&
240 favicon_bitmap_results); 239 favicon_bitmap_results);
241 240
242 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL() 241 // Intermediate callback for GetRawFavicon() and GetRawFaviconForPageURL()
243 // so that history service can deal solely with FaviconResultsCallback. 242 // so that history service can deal solely with FaviconResultsCallback.
244 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs 243 // Resizes favicon_base::FaviconRawBitmapResult if necessary and runs
245 // |callback|. 244 // |callback|.
246 void RunFaviconRawBitmapCallbackWithBitmapResults( 245 void RunFaviconRawBitmapCallbackWithBitmapResults(
247 const favicon_base::FaviconRawBitmapCallback& callback, 246 const favicon_base::FaviconRawBitmapCallback& callback,
248 int desired_size_in_dip, 247 int desired_size_in_dip,
249 ui::ScaleFactor desired_scale_factor, 248 float desired_favicon_scale,
250 const std::vector<favicon_base::FaviconRawBitmapResult>& 249 const std::vector<favicon_base::FaviconRawBitmapResult>&
251 favicon_bitmap_results); 250 favicon_bitmap_results);
252 251
253 DISALLOW_COPY_AND_ASSIGN(FaviconService); 252 DISALLOW_COPY_AND_ASSIGN(FaviconService);
254 }; 253 };
255 254
256 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 255 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698