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 "chrome/browser/common/cancelable_request.h" | |
15 #include "chrome/common/favicon/favicon_types.h" | 14 #include "chrome/common/favicon/favicon_types.h" |
16 #include "chrome/common/ref_counted_util.h" | 15 #include "chrome/common/ref_counted_util.h" |
17 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
18 #include "ui/base/layout.h" | 17 #include "ui/base/layout.h" |
19 | 18 |
20 class GURL; | 19 class GURL; |
21 class HistoryService; | 20 class HistoryService; |
22 struct ImportedFaviconUsage; | 21 struct ImportedFaviconUsage; |
23 class Profile; | 22 class Profile; |
24 | 23 |
25 namespace chrome { | 24 namespace chrome { |
26 struct FaviconImageResult; | 25 struct FaviconImageResult; |
27 } | 26 } |
28 | 27 |
29 // The favicon service provides methods to access favicons. It calls the history | 28 // The favicon service provides methods to access favicons. It calls the history |
30 // backend behind the scenes. | 29 // backend behind the scenes. |
31 // | 30 class FaviconService : public KeyedService { |
32 // This service is thread safe. Each request callback is invoked in the | |
33 // thread that made the request. | |
34 class FaviconService : public CancelableRequestProvider, public KeyedService { | |
35 public: | 31 public: |
36 explicit FaviconService(Profile* profile); | 32 explicit FaviconService(Profile* profile); |
37 | 33 |
38 virtual ~FaviconService(); | 34 virtual ~FaviconService(); |
39 | 35 |
40 // Auxiliary argument structure for requesting favicons for URLs. | 36 // Auxiliary argument structure for requesting favicons for URLs. |
41 struct FaviconForURLParams { | 37 struct FaviconForURLParams { |
42 FaviconForURLParams(const GURL& page_url, | 38 FaviconForURLParams(const GURL& page_url, |
43 int icon_types, | 39 int icon_types, |
44 int desired_size_in_dip) | 40 int desired_size_in_dip) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void RunFaviconRawCallbackWithBitmapResults( | 261 void RunFaviconRawCallbackWithBitmapResults( |
266 const FaviconRawCallback& callback, | 262 const FaviconRawCallback& callback, |
267 int desired_size_in_dip, | 263 int desired_size_in_dip, |
268 ui::ScaleFactor desired_scale_factor, | 264 ui::ScaleFactor desired_scale_factor, |
269 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); | 265 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results); |
270 | 266 |
271 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 267 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
272 }; | 268 }; |
273 | 269 |
274 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 270 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
OLD | NEW |