| OLD | NEW |
| 1 // Copyright (c) 2011 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_THEME_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 11 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 |
| 15 namespace base { |
| 14 class RefCountedMemory; | 16 class RefCountedMemory; |
| 17 } |
| 15 | 18 |
| 16 class ThemeSource : public ChromeURLDataManager::DataSource { | 19 class ThemeSource : public ChromeURLDataManager::DataSource { |
| 17 public: | 20 public: |
| 18 explicit ThemeSource(Profile* profile); | 21 explicit ThemeSource(Profile* profile); |
| 19 | 22 |
| 20 // Called when the network layer has requested a resource underneath | 23 // Called when the network layer has requested a resource underneath |
| 21 // the path we registered. | 24 // the path we registered. |
| 22 virtual void StartDataRequest(const std::string& path, | 25 virtual void StartDataRequest(const std::string& path, |
| 23 bool is_incognito, | 26 bool is_incognito, |
| 24 int request_id) OVERRIDE; | 27 int request_id) OVERRIDE; |
| 25 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 28 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
| 26 | 29 |
| 27 // Used to tell ChromeURLDataManager which thread to handle the request on. | 30 // Used to tell ChromeURLDataManager which thread to handle the request on. |
| 28 virtual MessageLoop* MessageLoopForRequestPath( | 31 virtual MessageLoop* MessageLoopForRequestPath( |
| 29 const std::string& path) const OVERRIDE; | 32 const std::string& path) const OVERRIDE; |
| 30 | 33 |
| 31 virtual bool ShouldReplaceExistingSource() const OVERRIDE; | 34 virtual bool ShouldReplaceExistingSource() const OVERRIDE; |
| 32 | 35 |
| 33 protected: | 36 protected: |
| 34 virtual ~ThemeSource(); | 37 virtual ~ThemeSource(); |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 // Fetch and send the theme bitmap. | 40 // Fetch and send the theme bitmap. |
| 38 void SendThemeBitmap(int request_id, int resource_id); | 41 void SendThemeBitmap(int request_id, int resource_id); |
| 39 | 42 |
| 40 // The original profile (never an OTR profile). | 43 // The original profile (never an OTR profile). |
| 41 Profile* profile_; | 44 Profile* profile_; |
| 42 | 45 |
| 43 // We grab the CSS early so we don't have to go back to the UI thread later. | 46 // We grab the CSS early so we don't have to go back to the UI thread later. |
| 44 scoped_refptr<RefCountedMemory> css_bytes_; | 47 scoped_refptr<base::RefCountedMemory> css_bytes_; |
| 45 | 48 |
| 46 DISALLOW_COPY_AND_ASSIGN(ThemeSource); | 49 DISALLOW_COPY_AND_ASSIGN(ThemeSource); |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ | 52 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
| OLD | NEW |