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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // content::URLDataSource implementation. | 26 // content::URLDataSource implementation. |
27 std::string GetSource() const override; | 27 std::string GetSource() const override; |
28 void StartDataRequest( | 28 void StartDataRequest( |
29 const std::string& path, | 29 const std::string& path, |
30 int render_process_id, | 30 int render_process_id, |
31 int render_frame_id, | 31 int render_frame_id, |
32 const content::URLDataSource::GotDataCallback& callback) override; | 32 const content::URLDataSource::GotDataCallback& callback) override; |
33 std::string GetMimeType(const std::string& path) const override; | 33 std::string GetMimeType(const std::string& path) const override; |
34 base::MessageLoop* MessageLoopForRequestPath( | 34 base::MessageLoop* MessageLoopForRequestPath( |
35 const std::string& path) const override; | 35 const std::string& path) const override; |
36 bool ShouldReplaceExistingSource() const override; | |
37 bool ShouldServiceRequest(const net::URLRequest* request) const override; | 36 bool ShouldServiceRequest(const net::URLRequest* request) const override; |
38 | 37 |
39 private: | 38 private: |
40 // Fetches and sends the theme bitmap. | 39 // Fetches and sends the theme bitmap. |
41 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, | 40 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, |
42 int resource_id, | 41 int resource_id, |
43 float scale); | 42 float scale); |
44 | 43 |
45 // Used in place of SendThemeBitmap when the desired scale is larger than | 44 // Used in place of SendThemeBitmap when the desired scale is larger than |
46 // what the resource bundle supports. This can rescale the provided bitmap up | 45 // what the resource bundle supports. This can rescale the provided bitmap up |
47 // to the desired size. | 46 // to the desired size. |
48 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, | 47 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, |
49 int resource_id, | 48 int resource_id, |
50 float scale); | 49 float scale); |
51 | 50 |
52 // The original profile (never an OTR profile). | 51 // The profile this object was initialized with. |
53 Profile* profile_; | 52 Profile* profile_; |
54 | 53 |
55 // We grab the CSS early so we don't have to go back to the UI thread later. | |
56 scoped_refptr<base::RefCountedMemory> css_bytes_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(ThemeSource); | 54 DISALLOW_COPY_AND_ASSIGN(ThemeSource); |
59 }; | 55 }; |
60 | 56 |
61 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ | 57 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
OLD | NEW |