| 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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/common/cancelable_request.h" | 12 #include "chrome/browser/common/cancelable_request.h" |
| 13 #include "chrome/browser/history/history_types.h" | 13 #include "chrome/browser/history/history_types.h" |
| 14 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 15 #include "chrome/common/cancelable_task_tracker.h" | 15 #include "chrome/common/cancelable_task_tracker.h" |
| 16 #include "chrome/common/ref_counted_util.h" | 16 #include "chrome/common/ref_counted_util.h" |
| 17 #include "ui/base/layout.h" | 17 #include "ui/base/layout.h" |
| 18 | 18 |
| 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 // | 26 // |
| 26 // This service is thread safe. Each request callback is invoked in the | 27 // This service is thread safe. Each request callback is invoked in the |
| 27 // thread that made the request. | 28 // thread that made the request. |
| 28 class FaviconService : public CancelableRequestProvider, | 29 class FaviconService : public CancelableRequestProvider, |
| 29 public ProfileKeyedService { | 30 public ProfileKeyedService { |
| 30 public: | 31 public: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // |old_page_url| with |new_page_url|, provided |new_page_url| has no | 188 // |old_page_url| with |new_page_url|, provided |new_page_url| has no |
| 188 // recorded associations to any other icons. | 189 // recorded associations to any other icons. |
| 189 // Needed if you want to declare favicons (tentatively) in advance, before a | 190 // Needed if you want to declare favicons (tentatively) in advance, before a |
| 190 // page is ever visited. | 191 // page is ever visited. |
| 191 void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); | 192 void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); |
| 192 | 193 |
| 193 // Allows the importer to set many favicons for many pages at once. The pages | 194 // Allows the importer to set many favicons for many pages at once. The pages |
| 194 // must exist, any favicon sets for unknown pages will be discarded. Existing | 195 // must exist, any favicon sets for unknown pages will be discarded. Existing |
| 195 // favicons will not be overwritten. | 196 // favicons will not be overwritten. |
| 196 void SetImportedFavicons( | 197 void SetImportedFavicons( |
| 197 const std::vector<history::ImportedFaviconUsage>& favicon_usage); | 198 const std::vector<ImportedFaviconUsage>& favicon_usage); |
| 198 | 199 |
| 199 // Set the favicon for |page_url| for |icon_type| in the thumbnail database. | 200 // Set the favicon for |page_url| for |icon_type| in the thumbnail database. |
| 200 // Unlike SetFavicons(), this method will not delete preexisting bitmap data | 201 // Unlike SetFavicons(), this method will not delete preexisting bitmap data |
| 201 // which is associated to |page_url| if at all possible. Use this method if | 202 // which is associated to |page_url| if at all possible. Use this method if |
| 202 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not | 203 // the favicon bitmaps for any of ui::GetSupportedScaleFactors() are not |
| 203 // known. | 204 // known. |
| 204 void MergeFavicon(const GURL& page_url, | 205 void MergeFavicon(const GURL& page_url, |
| 205 const GURL& icon_url, | 206 const GURL& icon_url, |
| 206 history::IconType icon_type, | 207 history::IconType icon_type, |
| 207 scoped_refptr<base::RefCountedMemory> bitmap_data, | 208 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void RunFaviconRawCallbackWithBitmapResults( | 250 void RunFaviconRawCallbackWithBitmapResults( |
| 250 const FaviconRawCallback& callback, | 251 const FaviconRawCallback& callback, |
| 251 int desired_size_in_dip, | 252 int desired_size_in_dip, |
| 252 ui::ScaleFactor desired_scale_factor, | 253 ui::ScaleFactor desired_scale_factor, |
| 253 const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results); | 254 const std::vector<history::FaviconBitmapResult>& favicon_bitmap_results); |
| 254 | 255 |
| 255 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 256 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
| 256 }; | 257 }; |
| 257 | 258 |
| 258 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 259 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
| OLD | NEW |