OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_DOM_UI_FILEICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ |
6 #define CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ | 6 #define CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 11 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
12 #include "chrome/browser/icon_manager.h" | 12 #include "chrome/browser/icon_manager.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 class RefCountedBytes; | 15 class RefCountedBytes; |
16 | 16 |
17 // FileIconSource is the gateway between network-level chrome: | 17 // FileIconSource is the gateway between network-level chrome: |
18 // requests for favicons and the history backend that serves these. | 18 // requests for favicons and the history backend that serves these. |
19 class FileIconSource : public ChromeURLDataManager::DataSource { | 19 class FileIconSource : public ChromeURLDataManager::DataSource { |
20 public: | 20 public: |
21 explicit FileIconSource(); | 21 explicit FileIconSource(); |
22 | 22 |
23 // Called when the network layer has requested a resource underneath | 23 // Called when the network layer has requested a resource underneath |
24 // the path we registered. | 24 // the path we registered. |
25 virtual void StartDataRequest(const std::string& path, | 25 virtual void StartDataRequest(const std::string& path, |
26 bool is_off_the_record, | 26 bool is_off_the_record, |
27 int request_id); | 27 int request_id); |
28 | 28 |
29 virtual std::string GetMimeType(const std::string&) const { | 29 virtual std::string GetMimeType(const std::string&) const; |
30 // Rely on image decoder inferring the correct type. | |
31 return std::string(); | |
32 } | |
33 | 30 |
34 // Called when favicon data is available from the history backend. | 31 // Called when favicon data is available from the history backend. |
35 void OnFileIconDataAvailable( | 32 void OnFileIconDataAvailable( |
36 IconManager::Handle request_handle, | 33 IconManager::Handle request_handle, |
37 SkBitmap* icon); | 34 SkBitmap* icon); |
38 | 35 |
39 private: | 36 private: |
40 virtual ~FileIconSource(); | 37 virtual ~FileIconSource(); |
41 | 38 |
42 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 39 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
43 | 40 |
44 // Raw PNG representation of the favicon to show when the favicon | 41 // Raw PNG representation of the favicon to show when the favicon |
45 // database doesn't have a favicon for a webpage. | 42 // database doesn't have a favicon for a webpage. |
46 scoped_refptr<RefCountedBytes> default_favicon_; | 43 scoped_refptr<RefCountedBytes> default_favicon_; |
47 | 44 |
48 DISALLOW_COPY_AND_ASSIGN(FileIconSource); | 45 DISALLOW_COPY_AND_ASSIGN(FileIconSource); |
49 }; | 46 }; |
50 #endif // CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ | 47 #endif // CHROME_BROWSER_DOM_UI_FILEICON_SOURCE_H_ |
OLD | NEW |