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