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