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_THEMES_THEME_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 class ThemeService : public base::NonThreadSafe, | 59 class ThemeService : public base::NonThreadSafe, |
60 public content::NotificationObserver, | 60 public content::NotificationObserver, |
61 public KeyedService, | 61 public KeyedService, |
62 public ui::ThemeProvider { | 62 public ui::ThemeProvider { |
63 public: | 63 public: |
64 // Public constants used in ThemeService and its subclasses: | 64 // Public constants used in ThemeService and its subclasses: |
65 static const char* kDefaultThemeID; | 65 static const char* kDefaultThemeID; |
66 | 66 |
67 ThemeService(); | 67 ThemeService(); |
68 virtual ~ThemeService(); | 68 ~ThemeService() override; |
69 | 69 |
70 virtual void Init(Profile* profile); | 70 virtual void Init(Profile* profile); |
71 | 71 |
72 // Returns a cross platform image for an id. | 72 // Returns a cross platform image for an id. |
73 // | 73 // |
74 // TODO(erg): Make this part of the ui::ThemeProvider and the main way to get | 74 // TODO(erg): Make this part of the ui::ThemeProvider and the main way to get |
75 // theme properties out of the theme provider since it's cross platform. | 75 // theme properties out of the theme provider since it's cross platform. |
76 virtual gfx::Image GetImageNamed(int id) const; | 76 virtual gfx::Image GetImageNamed(int id) const; |
77 | 77 |
78 // Overridden from ui::ThemeProvider: | 78 // Overridden from ui::ThemeProvider: |
79 virtual bool UsingSystemTheme() const override; | 79 bool UsingSystemTheme() const override; |
80 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const override; | 80 gfx::ImageSkia* GetImageSkiaNamed(int id) const override; |
81 virtual SkColor GetColor(int id) const override; | 81 SkColor GetColor(int id) const override; |
82 virtual int GetDisplayProperty(int id) const override; | 82 int GetDisplayProperty(int id) const override; |
83 virtual bool ShouldUseNativeFrame() const override; | 83 bool ShouldUseNativeFrame() const override; |
84 virtual bool HasCustomImage(int id) const override; | 84 bool HasCustomImage(int id) const override; |
85 virtual base::RefCountedMemory* GetRawData( | 85 base::RefCountedMemory* GetRawData(int id, ui::ScaleFactor scale_factor) |
86 int id, | 86 const override; |
87 ui::ScaleFactor scale_factor) const override; | |
88 #if defined(OS_MACOSX) | 87 #if defined(OS_MACOSX) |
89 virtual NSImage* GetNSImageNamed(int id) const override; | 88 NSImage* GetNSImageNamed(int id) const override; |
90 virtual NSColor* GetNSImageColorNamed(int id) const override; | 89 NSColor* GetNSImageColorNamed(int id) const override; |
91 virtual NSColor* GetNSColor(int id) const override; | 90 NSColor* GetNSColor(int id) const override; |
92 virtual NSColor* GetNSColorTint(int id) const override; | 91 NSColor* GetNSColorTint(int id) const override; |
93 virtual NSGradient* GetNSGradient(int id) const override; | 92 NSGradient* GetNSGradient(int id) const override; |
94 #endif | 93 #endif |
95 | 94 |
96 // Overridden from content::NotificationObserver: | 95 // Overridden from content::NotificationObserver: |
97 virtual void Observe(int type, | 96 void Observe(int type, |
98 const content::NotificationSource& source, | 97 const content::NotificationSource& source, |
99 const content::NotificationDetails& details) override; | 98 const content::NotificationDetails& details) override; |
100 | 99 |
101 // Set the current theme to the theme defined in |extension|. | 100 // Set the current theme to the theme defined in |extension|. |
102 // |extension| must already be added to this profile's | 101 // |extension| must already be added to this profile's |
103 // ExtensionService. | 102 // ExtensionService. |
104 virtual void SetTheme(const extensions::Extension* extension); | 103 virtual void SetTheme(const extensions::Extension* extension); |
105 | 104 |
106 // Reset the theme to default. | 105 // Reset the theme to default. |
107 virtual void UseDefaultTheme(); | 106 virtual void UseDefaultTheme(); |
108 | 107 |
109 // Set the current theme to the system theme. On some platforms, the system | 108 // Set the current theme to the system theme. On some platforms, the system |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 content::NotificationRegistrar registrar_; | 247 content::NotificationRegistrar registrar_; |
249 | 248 |
250 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 249 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
251 | 250 |
252 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 251 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
253 | 252 |
254 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 253 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
255 }; | 254 }; |
256 | 255 |
257 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 256 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
OLD | NEW |