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 19 matching lines...) Expand all Loading... |
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; | 36 bool ShouldReplaceExistingSource() const override; |
37 bool ShouldServiceRequest(const net::URLRequest* request) const override; | 37 bool ShouldServiceRequest(const net::URLRequest* request) const override; |
38 | 38 |
39 private: | 39 private: |
40 // Fetch and send the theme bitmap. | 40 // Fetches and sends the theme bitmap. |
41 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, | 41 void SendThemeBitmap(const content::URLDataSource::GotDataCallback& callback, |
42 int resource_id, | 42 int resource_id, |
43 float scale_factor); | 43 float scale); |
44 | 44 |
45 // Similar to SendThemeBitmap but treat the responded data as image; if the | 45 // Used in place of SendThemeBitmap when the desired scale is larger than |
46 // resource bundle does not contain the data for |scale_factor|, the resource | 46 // what the resource bundle supports. This can rescale the provided bitmap up |
47 // bundle falls back to the data of a lower scale, which means smaller images | 47 // to the desired size. |
48 // will be served and webui handles the image incorrectly. | |
49 // See crbug.com/442384. | |
50 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, | 48 void SendThemeImage(const content::URLDataSource::GotDataCallback& callback, |
51 int resource_id, | 49 int resource_id, |
52 float scale_factor); | 50 float scale); |
53 | 51 |
54 // The original profile (never an OTR profile). | 52 // The original profile (never an OTR profile). |
55 Profile* profile_; | 53 Profile* profile_; |
56 | 54 |
57 // We grab the CSS early so we don't have to go back to the UI thread later. | 55 // We grab the CSS early so we don't have to go back to the UI thread later. |
58 scoped_refptr<base::RefCountedMemory> css_bytes_; | 56 scoped_refptr<base::RefCountedMemory> css_bytes_; |
59 | 57 |
60 DISALLOW_COPY_AND_ASSIGN(ThemeSource); | 58 DISALLOW_COPY_AND_ASSIGN(ThemeSource); |
61 }; | 59 }; |
62 | 60 |
63 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ | 61 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ |
OLD | NEW |