OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_FAVICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "chrome/browser/favicon_service.h" | 13 #include "chrome/browser/favicon_service.h" |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 class Profile; | 17 class Profile; |
18 | 18 |
19 // FaviconSource is the gateway between network-level chrome: | 19 // FaviconSource is the gateway between network-level chrome: |
20 // requests for favicons and the history backend that serves these. | 20 // requests for favicons and the history backend that serves these. |
21 class FaviconSource : public ChromeURLDataManager::DataSource { | 21 class FaviconSource : public ChromeURLDataManager::DataSource { |
22 public: | 22 public: |
23 explicit FaviconSource(Profile* profile); | 23 FaviconSource(Profile* profile, const std::string& favicon_host); |
sky
2011/03/22 19:48:48
This isn't related to this patch, right? Please ke
michaelbai
2011/03/22 23:59:03
Move them to another CL
| |
24 | 24 |
25 // Called when the network layer has requested a resource underneath | 25 // Called when the network layer has requested a resource underneath |
26 // the path we registered. | 26 // the path we registered. |
27 virtual void StartDataRequest(const std::string& path, | 27 virtual void StartDataRequest(const std::string& path, |
28 bool is_off_the_record, | 28 bool is_off_the_record, |
29 int request_id); | 29 int request_id); |
30 | 30 |
31 virtual std::string GetMimeType(const std::string&) const; | 31 virtual std::string GetMimeType(const std::string&) const; |
32 | 32 |
33 virtual bool ShouldReplaceExistingSource() const; | 33 virtual bool ShouldReplaceExistingSource() const; |
34 | 34 |
35 private: | 35 private: |
36 // Called when favicon data is available from the history backend. | 36 // Called when favicon data is available from the history backend. |
37 void OnFaviconDataAvailable(FaviconService::Handle request_handle, | 37 void OnFaviconDataAvailable(FaviconService::Handle request_handle, |
38 history::FaviconData favicon); | 38 history::FaviconData favicon); |
39 | 39 |
40 // Sends the default favicon. | 40 // Sends the default favicon. |
41 void SendDefaultResponse(int request_id); | 41 void SendDefaultResponse(int request_id); |
42 | 42 |
43 virtual ~FaviconSource(); | 43 virtual ~FaviconSource(); |
44 | 44 |
45 Profile* profile_; | 45 Profile* profile_; |
46 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 46 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
47 | 47 |
48 // Raw PNG representation of the favicon to show when the favicon | 48 // Raw PNG representation of the favicon to show when the favicon |
49 // database doesn't have a favicon for a webpage. | 49 // database doesn't have a favicon for a webpage. |
50 scoped_refptr<RefCountedMemory> default_favicon_; | 50 scoped_refptr<RefCountedMemory> default_favicon_; |
51 | 51 |
52 // The types of icon that this FaviconSource handles. | |
53 const int icon_types_; | |
54 | |
52 DISALLOW_COPY_AND_ASSIGN(FaviconSource); | 55 DISALLOW_COPY_AND_ASSIGN(FaviconSource); |
53 }; | 56 }; |
54 | 57 |
55 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
OLD | NEW |