OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_ | |
6 #define CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "content/public/browser/browser_thread.h" | |
10 #include "third_party/skia/include/core/SkColor.h" | |
11 #include "ui/base/layout.h" | |
12 #include "ui/gfx/image/image.h" | |
pkotwicz
2013/07/19 05:54:13
gfx::Image could be forward declared as well?
Adrian Kuegel
2013/07/19 13:54:39
Done. I also changed this in browser_theme_pack.h
| |
13 | |
14 namespace base { | |
15 class RefCountedMemory; | |
16 } | |
17 | |
18 namespace color_utils { | |
19 struct HSL; | |
20 } | |
21 | |
22 class CustomThemeProvider : public base::RefCountedThreadSafe< | |
pkotwicz
2013/07/19 05:54:13
I do not like the name CustomThemeProvider because
Adrian Kuegel
2013/07/19 13:54:39
I have chosen the name CustomThemeSupplier now. Cu
| |
23 CustomThemeProvider, content::BrowserThread::DeleteOnFileThread> { | |
24 public: | |
25 enum ThemeType { | |
26 EXTENSION, | |
27 NATIVE_X11, | |
28 MANAGED_USER_THEME, | |
29 }; | |
30 | |
31 explicit CustomThemeProvider(ThemeType type); | |
32 | |
33 ThemeType GetThemeType() const { | |
34 return theme_type_; | |
35 } | |
36 | |
37 // Called when the theme is started being used. | |
pkotwicz
2013/07/19 05:54:13
Nit: starts being used
Adrian Kuegel
2013/07/19 13:54:39
Done.
| |
38 virtual void StartUsingTheme(); | |
39 | |
40 // Called when the theme is not used anymore. | |
41 virtual void StopUsingTheme(); | |
42 | |
43 // If the theme specifies data for the corresponding |id|, return true and | |
44 // write the corresponding value to the output parameter. These functions | |
45 // should not return the default data. These methods should only be called | |
46 // from the UI thread. | |
47 virtual bool GetTint(int id, color_utils::HSL* hsl) const; | |
48 virtual bool GetColor(int id, SkColor* color) const; | |
49 virtual bool GetDisplayProperty(int id, int* result) const; | |
50 | |
51 // Returns the theme image for |id|. Returns an empty image if no image is | |
52 // found for |id|. | |
53 virtual gfx::Image GetImageNamed(int id); | |
54 | |
55 // Whether this theme provides an image for |id|. | |
56 virtual bool HasCustomImage(int id) const; | |
57 | |
58 // Returns the raw PNG encoded data for IDR_THEME_NTP_*. This method is only | |
59 // supposed to work for the NTP attribution and background resources. | |
60 virtual base::RefCountedMemory* GetRawData( | |
61 int id, ui::ScaleFactor scale_factor) const; | |
62 | |
63 protected: | |
64 virtual ~CustomThemeProvider(); | |
65 | |
66 private: | |
67 friend struct content::BrowserThread::DeleteOnThread< | |
68 content::BrowserThread::FILE>; | |
69 friend class base::DeleteHelper<CustomThemeProvider>; | |
70 | |
71 ThemeType theme_type_; | |
72 | |
73 DISALLOW_COPY_AND_ASSIGN(CustomThemeProvider); | |
74 }; | |
75 | |
76 #endif // CHROME_BROWSER_THEMES_CUSTOM_THEME_PROVIDER_H_ | |
OLD | NEW |