OLD | NEW |
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 | 17 |
18 class FaviconClient; | 18 class FaviconClient; |
19 class GURL; | 19 class GURL; |
20 class HistoryService; | 20 class HistoryService; |
| 21 struct ImportedFaviconUsage; |
21 class Profile; | 22 class Profile; |
22 | 23 |
23 // The favicon service provides methods to access favicons. It calls the history | 24 // The favicon service provides methods to access favicons. It calls the history |
24 // backend behind the scenes. | 25 // backend behind the scenes. |
25 class FaviconService : public KeyedService { | 26 class FaviconService : public KeyedService { |
26 public: | 27 public: |
27 // TODO(jif): Remove usage of Profile. http://crbug.com/378208. | 28 // TODO(jif): Remove usage of Profile. http://crbug.com/378208. |
28 // The FaviconClient must outlive the constructed FaviconService. | 29 // The FaviconClient must outlive the constructed FaviconService. |
29 FaviconService(Profile* profile, FaviconClient* favicon_client); | 30 FaviconService(Profile* profile, FaviconClient* favicon_client); |
30 | 31 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Marks all types of favicon for the page as being out of date. | 173 // Marks all types of favicon for the page as being out of date. |
173 void SetFaviconOutOfDateForPage(const GURL& page_url); | 174 void SetFaviconOutOfDateForPage(const GURL& page_url); |
174 | 175 |
175 // Clones all icons from an existing page. This associates the icons from | 176 // Clones all icons from an existing page. This associates the icons from |
176 // |old_page_url| with |new_page_url|, provided |new_page_url| has no | 177 // |old_page_url| with |new_page_url|, provided |new_page_url| has no |
177 // recorded associations to any other icons. | 178 // recorded associations to any other icons. |
178 // Needed if you want to declare favicons (tentatively) in advance, before a | 179 // Needed if you want to declare favicons (tentatively) in advance, before a |
179 // page is ever visited. | 180 // page is ever visited. |
180 void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); | 181 void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); |
181 | 182 |
| 183 // Allows the importer to set many favicons for many pages at once. The pages |
| 184 // must exist, any favicon sets for unknown pages will be discarded. Existing |
| 185 // favicons will not be overwritten. |
| 186 void SetImportedFavicons( |
| 187 const std::vector<ImportedFaviconUsage>& favicon_usage); |
| 188 |
182 // Set the favicon for |page_url| for |icon_type| in the thumbnail database. | 189 // Set the favicon for |page_url| for |icon_type| in the thumbnail database. |
183 // Unlike SetFavicons(), this method will not delete preexisting bitmap data | 190 // Unlike SetFavicons(), this method will not delete preexisting bitmap data |
184 // which is associated to |page_url| if at all possible. Use this method if | 191 // which is associated to |page_url| if at all possible. Use this method if |
185 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not | 192 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not |
186 // known. | 193 // known. |
187 void MergeFavicon(const GURL& page_url, | 194 void MergeFavicon(const GURL& page_url, |
188 const GURL& icon_url, | 195 const GURL& icon_url, |
189 favicon_base::IconType icon_type, | 196 favicon_base::IconType icon_type, |
190 scoped_refptr<base::RefCountedMemory> bitmap_data, | 197 scoped_refptr<base::RefCountedMemory> bitmap_data, |
191 const gfx::Size& pixel_size); | 198 const gfx::Size& pixel_size); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void RunFaviconRawBitmapCallbackWithBitmapResults( | 249 void RunFaviconRawBitmapCallbackWithBitmapResults( |
243 const favicon_base::FaviconRawBitmapCallback& callback, | 250 const favicon_base::FaviconRawBitmapCallback& callback, |
244 int desired_size_in_pixel, | 251 int desired_size_in_pixel, |
245 const std::vector<favicon_base::FaviconRawBitmapResult>& | 252 const std::vector<favicon_base::FaviconRawBitmapResult>& |
246 favicon_bitmap_results); | 253 favicon_bitmap_results); |
247 | 254 |
248 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 255 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
249 }; | 256 }; |
250 | 257 |
251 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 258 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
OLD | NEW |