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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 UsingNativeTheme() const OVERRIDE; | 79 virtual bool UsingSystemTheme() const OVERRIDE; |
80 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE; | 80 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE; |
81 virtual SkColor GetColor(int id) const OVERRIDE; | 81 virtual SkColor GetColor(int id) const OVERRIDE; |
82 virtual int GetDisplayProperty(int id) const OVERRIDE; | 82 virtual int GetDisplayProperty(int id) const OVERRIDE; |
83 virtual bool ShouldUseNativeFrame() const OVERRIDE; | 83 virtual bool ShouldUseNativeFrame() const OVERRIDE; |
msw
2014/04/22 18:02:13
nit: this should match UseSystemTheme / SetNativeT
Evan Stade
2014/04/22 18:16:06
you mean ShouldUseSystemFrame? Maybe, but "NativeF
| |
84 virtual bool HasCustomImage(int id) const OVERRIDE; | 84 virtual bool HasCustomImage(int id) const OVERRIDE; |
85 virtual base::RefCountedMemory* GetRawData( | 85 virtual base::RefCountedMemory* GetRawData( |
86 int id, | 86 int id, |
87 ui::ScaleFactor scale_factor) const OVERRIDE; | 87 ui::ScaleFactor scale_factor) const OVERRIDE; |
88 #if defined(OS_MACOSX) | 88 #if defined(OS_MACOSX) |
89 virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; | 89 virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; |
90 virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; | 90 virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; |
91 virtual NSColor* GetNSColor(int id) const OVERRIDE; | 91 virtual NSColor* GetNSColor(int id) const OVERRIDE; |
92 virtual NSColor* GetNSColorTint(int id) const OVERRIDE; | 92 virtual NSColor* GetNSColorTint(int id) const OVERRIDE; |
93 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; | 93 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; |
94 #endif | 94 #endif |
95 | 95 |
96 // Overridden from content::NotificationObserver: | 96 // Overridden from content::NotificationObserver: |
97 virtual void Observe(int type, | 97 virtual void Observe(int type, |
98 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
99 const content::NotificationDetails& details) OVERRIDE; | 99 const content::NotificationDetails& details) OVERRIDE; |
100 | 100 |
101 // Set the current theme to the theme defined in |extension|. | 101 // Set the current theme to the theme defined in |extension|. |
102 // |extension| must already be added to this profile's | 102 // |extension| must already be added to this profile's |
103 // ExtensionService. | 103 // ExtensionService. |
104 virtual void SetTheme(const extensions::Extension* extension); | 104 virtual void SetTheme(const extensions::Extension* extension); |
105 | 105 |
106 // Reset the theme to default. | 106 // Reset the theme to default. |
107 virtual void UseDefaultTheme(); | 107 virtual void UseDefaultTheme(); |
108 | 108 |
109 // Set the current theme to the native theme. On some platforms, the native | 109 // Set the current theme to the system theme. On some platforms, the system |
110 // theme is the default theme. | 110 // theme is the default theme. |
111 virtual void SetNativeTheme(); | 111 virtual void UseSystemTheme(); |
112 | 112 |
113 // Whether we're using the chrome default theme. Virtual so linux can check | 113 // Whether we're using the chrome default theme. Virtual so linux can check |
114 // if we're using the GTK theme. | 114 // if we're using the GTK theme. |
115 virtual bool UsingDefaultTheme() const; | 115 virtual bool UsingDefaultTheme() const; |
116 | 116 |
117 // Gets the id of the last installed theme. (The theme may have been further | 117 // Gets the id of the last installed theme. (The theme may have been further |
118 // locally customized.) | 118 // locally customized.) |
119 virtual std::string GetThemeID() const; | 119 virtual std::string GetThemeID() const; |
120 | 120 |
121 // This class needs to keep track of the number of theme infobars so that we | 121 // This class needs to keep track of the number of theme infobars so that we |
(...skipping 15 matching lines...) Expand all Loading... | |
137 | 137 |
138 // Save the images to be written to disk, mapping file path to id. | 138 // Save the images to be written to disk, mapping file path to id. |
139 typedef std::map<base::FilePath, int> ImagesDiskCache; | 139 typedef std::map<base::FilePath, int> ImagesDiskCache; |
140 | 140 |
141 protected: | 141 protected: |
142 // Set a custom default theme instead of the normal default theme. | 142 // Set a custom default theme instead of the normal default theme. |
143 virtual void SetCustomDefaultTheme( | 143 virtual void SetCustomDefaultTheme( |
144 scoped_refptr<CustomThemeSupplier> theme_supplier); | 144 scoped_refptr<CustomThemeSupplier> theme_supplier); |
145 | 145 |
146 // Returns true if the ThemeService should use the native theme on startup. | 146 // Returns true if the ThemeService should use the native theme on startup. |
147 virtual bool ShouldInitWithNativeTheme() const; | 147 virtual bool ShouldInitWithNativeTheme() const; |
msw
2014/04/22 18:02:13
nit: this should match UseSystemTheme / SetNativeT
| |
148 | 148 |
149 // Get the specified tint - |id| is one of the TINT_* enum values. | 149 // Get the specified tint - |id| is one of the TINT_* enum values. |
150 color_utils::HSL GetTint(int id) const; | 150 color_utils::HSL GetTint(int id) const; |
151 | 151 |
152 // Clears all the override fields and saves the dictionary. | 152 // Clears all the override fields and saves the dictionary. |
153 virtual void ClearAllThemeData(); | 153 virtual void ClearAllThemeData(); |
154 | 154 |
155 // Load theme data from preferences. | 155 // Load theme data from preferences. |
156 virtual void LoadThemePrefs(); | 156 virtual void LoadThemePrefs(); |
157 | 157 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 content::NotificationRegistrar registrar_; | 245 content::NotificationRegistrar registrar_; |
246 | 246 |
247 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 247 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
248 | 248 |
249 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 249 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
250 | 250 |
251 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 251 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
252 }; | 252 }; |
253 | 253 |
254 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 254 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
OLD | NEW |