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 12 matching lines...) Expand all Loading... |
23 explicit ThemeSource(Profile* profile); | 23 explicit ThemeSource(Profile* profile); |
24 ~ThemeSource() override; | 24 ~ThemeSource() override; |
25 | 25 |
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 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 30 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
31 const content::URLDataSource::GotDataCallback& callback) override; | 31 const content::URLDataSource::GotDataCallback& callback) override; |
32 std::string GetMimeType(const std::string& path) const override; | 32 std::string GetMimeType(const std::string& path) const override; |
33 base::MessageLoop* MessageLoopForRequestPath( | 33 scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerForRequestPath( |
34 const std::string& path) const override; | 34 const std::string& path) const override; |
35 bool ShouldServiceRequest(const net::URLRequest* request) const override; | 35 bool ShouldServiceRequest(const net::URLRequest* request) const override; |
36 | 36 |
37 private: | 37 private: |
38 // Fetches and sends the theme bitmap. | 38 // Fetches and sends the theme bitmap. |
39 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, | 39 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, |
40 int resource_id, | 40 int resource_id, |
41 float scale); | 41 float scale); |
42 | 42 |
43 // Used in place of SendThemeBitmap when the desired scale is larger than | 43 // Used in place of SendThemeBitmap when the desired scale is larger than |
44 // what the resource bundle supports. This can rescale the provided bitmap up | 44 // what the resource bundle supports. This can rescale the provided bitmap up |
45 // to the desired size. | 45 // to the desired size. |
46 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, | 46 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, |
47 int resource_id, | 47 int resource_id, |
48 float scale); | 48 float scale); |
49 | 49 |
50 // The profile this object was initialized with. | 50 // The profile this object was initialized with. |
51 Profile* profile_; | 51 Profile* profile_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(ThemeSource); | 53 DISALLOW_COPY_AND_ASSIGN(ThemeSource); |
54 }; | 54 }; |
55 | 55 |
56 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ | 56 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
OLD | NEW |