OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_THEME_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_ |
6 #define CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_THEME_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 | 12 |
13 class Profile; | 13 class Profile; |
| 14 class RefCountedBytes; |
14 | 15 |
15 // ThumbnailSource is the gateway between network-level chrome: | 16 // ThumbnailSource is the gateway between network-level chrome: |
16 // requests for thumbnails and the history backend that serves these. | 17 // requests for thumbnails and the history backend that serves these. |
17 class DOMUIThemeSource : public ChromeURLDataManager::DataSource { | 18 class DOMUIThemeSource : public ChromeURLDataManager::DataSource { |
18 public: | 19 public: |
19 explicit DOMUIThemeSource(Profile* profile); | 20 explicit DOMUIThemeSource(Profile* profile); |
20 | 21 |
21 // Called when the network layer has requested a resource underneath | 22 // Called when the network layer has requested a resource underneath |
22 // the path we registered. | 23 // the path we registered. |
23 virtual void StartDataRequest(const std::string& path, | 24 virtual void StartDataRequest(const std::string& path, |
24 bool is_off_the_record, | 25 bool is_off_the_record, |
25 int request_id); | 26 int request_id); |
26 virtual std::string GetMimeType(const std::string& path) const; | 27 virtual std::string GetMimeType(const std::string& path) const; |
27 | 28 |
28 // Used to tell ChromeURLDataManager which thread to handle the request on. | 29 // Used to tell ChromeURLDataManager which thread to handle the request on. |
29 virtual MessageLoop* MessageLoopForRequestPath(const std::string& path) const; | 30 virtual MessageLoop* MessageLoopForRequestPath(const std::string& path) const; |
30 | 31 |
31 protected: | 32 protected: |
32 virtual ~DOMUIThemeSource() {} | 33 virtual ~DOMUIThemeSource(); |
33 | 34 |
34 private: | 35 private: |
35 // Fetch and send the theme bitmap. | 36 // Fetch and send the theme bitmap. |
36 void SendThemeBitmap(int request_id, int resource_id); | 37 void SendThemeBitmap(int request_id, int resource_id); |
37 | 38 |
38 // The original profile (never an OTR profile). | 39 // The original profile (never an OTR profile). |
39 Profile* profile_; | 40 Profile* profile_; |
40 | 41 |
41 // We grab the CSS early so we don't have to go back to the UI thread later. | 42 // We grab the CSS early so we don't have to go back to the UI thread later. |
42 scoped_refptr<RefCountedBytes> css_bytes_; | 43 scoped_refptr<RefCountedBytes> css_bytes_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(DOMUIThemeSource); | 45 DISALLOW_COPY_AND_ASSIGN(DOMUIThemeSource); |
45 }; | 46 }; |
46 | 47 |
47 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_ | 48 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_THEME_SOURCE_H_ |
OLD | NEW |