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_UI_WEBUI_FILEICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_FILEICON_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_FILEICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_FILEICON_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "chrome/browser/icon_manager.h" | 11 #include "chrome/browser/icon_manager.h" |
12 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | |
13 #include "chrome/common/cancelable_task_tracker.h" | 12 #include "chrome/common/cancelable_task_tracker.h" |
| 13 #include "content/public/browser/url_data_source_delegate.h" |
14 #include "ui/base/layout.h" | 14 #include "ui/base/layout.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Image; | 17 class Image; |
18 } | 18 } |
19 | 19 |
20 // FileIconSource is the gateway between network-level chrome: | 20 // FileIconSource is the gateway between network-level chrome: |
21 // requests for favicons and the history backend that serves these. | 21 // requests for favicons and the history backend that serves these. |
22 class FileIconSource : public ChromeURLDataManager::DataSource { | 22 class FileIconSource : public content::URLDataSourceDelegate { |
23 public: | 23 public: |
24 explicit FileIconSource(); | 24 explicit FileIconSource(); |
25 | 25 |
26 // Called when the network layer has requested a resource underneath | 26 // content::URLDataSourceDelegate implementation. |
27 // the path we registered. | 27 virtual std::string GetSource() OVERRIDE; |
28 virtual void StartDataRequest(const std::string& path, | 28 virtual void StartDataRequest(const std::string& path, |
29 bool is_incognito, | 29 bool is_incognito, |
30 int request_id) OVERRIDE; | 30 int request_id) OVERRIDE; |
31 | |
32 virtual std::string GetMimeType(const std::string&) const OVERRIDE; | 31 virtual std::string GetMimeType(const std::string&) const OVERRIDE; |
33 | 32 |
34 protected: | 33 protected: |
35 virtual ~FileIconSource(); | 34 virtual ~FileIconSource(); |
36 | 35 |
37 // Once the |path| and |icon_size| has been determined from the request, this | 36 // Once the |path| and |icon_size| has been determined from the request, this |
38 // function is called to perform the actual fetch. Declared as virtual for | 37 // function is called to perform the actual fetch. Declared as virtual for |
39 // testing. | 38 // testing. |
40 virtual void FetchFileIcon(const FilePath& path, | 39 virtual void FetchFileIcon(const FilePath& path, |
41 ui::ScaleFactor scale_factor, | 40 ui::ScaleFactor scale_factor, |
(...skipping 13 matching lines...) Expand all Loading... |
55 // Called when favicon data is available from the history backend. | 54 // Called when favicon data is available from the history backend. |
56 void OnFileIconDataAvailable(const IconRequestDetails& details, | 55 void OnFileIconDataAvailable(const IconRequestDetails& details, |
57 gfx::Image* icon); | 56 gfx::Image* icon); |
58 | 57 |
59 // Tracks tasks requesting file icons. | 58 // Tracks tasks requesting file icons. |
60 CancelableTaskTracker cancelable_task_tracker_; | 59 CancelableTaskTracker cancelable_task_tracker_; |
61 | 60 |
62 DISALLOW_COPY_AND_ASSIGN(FileIconSource); | 61 DISALLOW_COPY_AND_ASSIGN(FileIconSource); |
63 }; | 62 }; |
64 #endif // CHROME_BROWSER_UI_WEBUI_FILEICON_SOURCE_H_ | 63 #endif // CHROME_BROWSER_UI_WEBUI_FILEICON_SOURCE_H_ |
OLD | NEW |