| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_THEME_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 6 #define CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 REPEAT = 3 | 147 REPEAT = 3 |
| 148 } Tiling; | 148 } Tiling; |
| 149 | 149 |
| 150 // ThemeProvider implementation. | 150 // ThemeProvider implementation. |
| 151 virtual void Init(Profile* profile); | 151 virtual void Init(Profile* profile); |
| 152 virtual SkBitmap* GetBitmapNamed(int id); | 152 virtual SkBitmap* GetBitmapNamed(int id); |
| 153 virtual SkColor GetColor(int id); | 153 virtual SkColor GetColor(int id); |
| 154 virtual bool GetDisplayProperty(int id, int* result); | 154 virtual bool GetDisplayProperty(int id, int* result); |
| 155 virtual bool ShouldUseNativeFrame(); | 155 virtual bool ShouldUseNativeFrame(); |
| 156 virtual bool HasCustomImage(int id); | 156 virtual bool HasCustomImage(int id); |
| 157 virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data); |
| 157 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 158 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
| 158 virtual GdkPixbuf* GetPixbufNamed(int id); | 159 virtual GdkPixbuf* GetPixbufNamed(int id); |
| 159 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); | 160 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); |
| 160 #elif defined(OS_MACOSX) | 161 #elif defined(OS_MACOSX) |
| 161 virtual NSImage* GetNSImageNamed(int id); | 162 virtual NSImage* GetNSImageNamed(int id); |
| 162 virtual NSColor* GetNSColorTint(int id); | 163 virtual NSColor* GetNSColorTint(int id); |
| 163 #endif | 164 #endif |
| 164 | 165 |
| 165 // Set the current theme to the theme defined in |extension|. | 166 // Set the current theme to the theme defined in |extension|. |
| 166 virtual void SetTheme(Extension* extension); | 167 virtual void SetTheme(Extension* extension); |
| 167 | 168 |
| 168 // Reset the theme to default. | 169 // Reset the theme to default. |
| 169 virtual void UseDefaultTheme(); | 170 virtual void UseDefaultTheme(); |
| 170 | 171 |
| 171 // Set the current theme to the native theme. On some platforms, the native | 172 // Set the current theme to the native theme. On some platforms, the native |
| 172 // theme is the default theme. | 173 // theme is the default theme. |
| 173 virtual void SetNativeTheme() { UseDefaultTheme(); } | 174 virtual void SetNativeTheme() { UseDefaultTheme(); } |
| 174 | 175 |
| 175 // Gets the id of the last installed theme. (The theme may have been further | 176 // Gets the id of the last installed theme. (The theme may have been further |
| 176 // locally customized.) | 177 // locally customized.) |
| 177 std::string GetThemeID(); | 178 std::string GetThemeID(); |
| 178 | 179 |
| 180 // Reads the image data from the theme file into the specified vector. Returns |
| 181 // true on success. |
| 182 bool ReadThemeFileData(int id, std::vector<unsigned char>* raw_data); |
| 183 |
| 179 // Convert a bitfield alignment into a string like "top left". Public so that | 184 // Convert a bitfield alignment into a string like "top left". Public so that |
| 180 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. | 185 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. |
| 181 static std::string AlignmentToString(int alignment); | 186 static std::string AlignmentToString(int alignment); |
| 182 | 187 |
| 183 // Parse alignments from something like "top left" into a bitfield of | 188 // Parse alignments from something like "top left" into a bitfield of |
| 184 // AlignmentMasks | 189 // AlignmentMasks |
| 185 static int StringToAlignment(const std::string &alignment); | 190 static int StringToAlignment(const std::string &alignment); |
| 186 | 191 |
| 187 // Convert a tiling value into a string like "no-repeat". Public | 192 // Convert a tiling value into a string like "no-repeat". Public |
| 188 // so that it can be used to generate CSS values. Takes a Tiling. | 193 // so that it can be used to generate CSS values. Takes a Tiling. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // otherwise modified, or an application default. | 227 // otherwise modified, or an application default. |
| 223 virtual SkBitmap* LoadThemeBitmap(int id); | 228 virtual SkBitmap* LoadThemeBitmap(int id); |
| 224 | 229 |
| 225 Profile* profile() { return profile_; } | 230 Profile* profile() { return profile_; } |
| 226 | 231 |
| 227 private: | 232 private: |
| 228 typedef std::map<const int, std::string> ImageMap; | 233 typedef std::map<const int, std::string> ImageMap; |
| 229 typedef std::map<const std::string, SkColor> ColorMap; | 234 typedef std::map<const std::string, SkColor> ColorMap; |
| 230 typedef std::map<const std::string, skia::HSL> TintMap; | 235 typedef std::map<const std::string, skia::HSL> TintMap; |
| 231 typedef std::map<const std::string, int> DisplayPropertyMap; | 236 typedef std::map<const std::string, int> DisplayPropertyMap; |
| 232 | 237 typedef std::map<const int, std::vector<unsigned char> > RawDataMap; |
| 233 // Reads the image data from the theme file into the specified vector. Returns | |
| 234 // true on success. | |
| 235 bool ReadThemeFileData(int id, std::vector<unsigned char>* raw_data); | |
| 236 | 238 |
| 237 // Returns the string key for the given tint |id| TINT_* enum value. | 239 // Returns the string key for the given tint |id| TINT_* enum value. |
| 238 const std::string GetTintKey(int id); | 240 const std::string GetTintKey(int id); |
| 239 | 241 |
| 240 // Returns the default tint for the given tint |id| TINT_* enum value. | 242 // Returns the default tint for the given tint |id| TINT_* enum value. |
| 241 skia::HSL GetDefaultTint(int id); | 243 skia::HSL GetDefaultTint(int id); |
| 242 | 244 |
| 243 // Get the specified tint - |id| is one of the TINT_* enum values. | 245 // Get the specified tint - |id| is one of the TINT_* enum values. |
| 244 skia::HSL GetTint(int id); | 246 skia::HSL GetTint(int id); |
| 245 | 247 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 typedef std::map<int, NSColor*> NSColorMap; | 311 typedef std::map<int, NSColor*> NSColorMap; |
| 310 NSColorMap nscolor_cache_; | 312 NSColorMap nscolor_cache_; |
| 311 #endif | 313 #endif |
| 312 | 314 |
| 313 ResourceBundle& rb_; | 315 ResourceBundle& rb_; |
| 314 Profile* profile_; | 316 Profile* profile_; |
| 315 | 317 |
| 316 ImageMap images_; | 318 ImageMap images_; |
| 317 ColorMap colors_; | 319 ColorMap colors_; |
| 318 TintMap tints_; | 320 TintMap tints_; |
| 321 RawDataMap raw_data_; |
| 319 DisplayPropertyMap display_properties_; | 322 DisplayPropertyMap display_properties_; |
| 320 | 323 |
| 321 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 324 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
| 322 }; | 325 }; |
| 323 | 326 |
| 324 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 327 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
| OLD | NEW |