| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 17 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 20 #include "ui/base/theme_provider.h" | 20 #include "ui/base/theme_provider.h" |
| 21 | 21 |
| 22 class BrowserThemePack; | 22 class BrowserThemePack; |
| 23 class ThemeServiceTest; | 23 class ThemeServiceTest; |
| 24 class Extension; | |
| 25 class FilePath; | 24 class FilePath; |
| 26 class Profile; | 25 class Profile; |
| 27 | 26 |
| 28 namespace color_utils { | 27 namespace color_utils { |
| 29 struct HSL; | 28 struct HSL; |
| 30 } | 29 } |
| 31 | 30 |
| 31 namespace extensions { |
| 32 class Extension; |
| 33 } |
| 34 |
| 32 namespace gfx { | 35 namespace gfx { |
| 33 class Image; | 36 class Image; |
| 34 } | 37 } |
| 35 | 38 |
| 36 namespace ui { | 39 namespace ui { |
| 37 class ResourceBundle; | 40 class ResourceBundle; |
| 38 } | 41 } |
| 39 | 42 |
| 40 #ifdef __OBJC__ | 43 #ifdef __OBJC__ |
| 41 @class NSString; | 44 @class NSString; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; | 174 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; |
| 172 #elif defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) && !defined(OS_ANDROID) | 175 #elif defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) && !defined(OS_ANDROID) |
| 173 // This mismatch between what this class defines and whether or not it | 176 // This mismatch between what this class defines and whether or not it |
| 174 // overrides ui::ThemeProvider is http://crbug.com/105040 . | 177 // overrides ui::ThemeProvider is http://crbug.com/105040 . |
| 175 // GdkPixbufs returned by GetPixbufNamed and GetRTLEnabledPixbufNamed are | 178 // GdkPixbufs returned by GetPixbufNamed and GetRTLEnabledPixbufNamed are |
| 176 // shared instances owned by the theme provider and should not be freed. | 179 // shared instances owned by the theme provider and should not be freed. |
| 177 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const OVERRIDE; | 180 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const OVERRIDE; |
| 178 #endif | 181 #endif |
| 179 | 182 |
| 180 // Set the current theme to the theme defined in |extension|. | 183 // Set the current theme to the theme defined in |extension|. |
| 181 virtual void SetTheme(const Extension* extension); | 184 virtual void SetTheme(const extensions::Extension* extension); |
| 182 | 185 |
| 183 // Reset the theme to default. | 186 // Reset the theme to default. |
| 184 virtual void UseDefaultTheme(); | 187 virtual void UseDefaultTheme(); |
| 185 | 188 |
| 186 // Set the current theme to the native theme. On some platforms, the native | 189 // Set the current theme to the native theme. On some platforms, the native |
| 187 // theme is the default theme. | 190 // theme is the default theme. |
| 188 virtual void SetNativeTheme(); | 191 virtual void SetNativeTheme(); |
| 189 | 192 |
| 190 // Whether we're using the chrome default theme. Virtual so linux can check | 193 // Whether we're using the chrome default theme. Virtual so linux can check |
| 191 // if we're using the GTK theme. | 194 // if we're using the GTK theme. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 friend class ThemeServiceTest; | 277 friend class ThemeServiceTest; |
| 275 | 278 |
| 276 // Saves the filename of the cached theme pack. | 279 // Saves the filename of the cached theme pack. |
| 277 void SavePackName(const FilePath& pack_path); | 280 void SavePackName(const FilePath& pack_path); |
| 278 | 281 |
| 279 // Save the id of the last theme installed. | 282 // Save the id of the last theme installed. |
| 280 void SaveThemeID(const std::string& id); | 283 void SaveThemeID(const std::string& id); |
| 281 | 284 |
| 282 // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in | 285 // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in |
| 283 // case we don't have a theme pack). | 286 // case we don't have a theme pack). |
| 284 void BuildFromExtension(const Extension* extension); | 287 void BuildFromExtension(const extensions::Extension* extension); |
| 285 | 288 |
| 286 #if defined(TOOLKIT_GTK) | 289 #if defined(TOOLKIT_GTK) |
| 287 // Loads an image and flips it horizontally if |rtl_enabled| is true. | 290 // Loads an image and flips it horizontally if |rtl_enabled| is true. |
| 288 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; | 291 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; |
| 289 #endif | 292 #endif |
| 290 | 293 |
| 291 #if defined(TOOLKIT_GTK) | 294 #if defined(TOOLKIT_GTK) |
| 292 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; | 295 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; |
| 293 mutable GdkPixbufMap gdk_pixbufs_; | 296 mutable GdkPixbufMap gdk_pixbufs_; |
| 294 #elif defined(OS_MACOSX) | 297 #elif defined(OS_MACOSX) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 310 | 313 |
| 311 // The number of infobars currently displayed. | 314 // The number of infobars currently displayed. |
| 312 int number_of_infobars_; | 315 int number_of_infobars_; |
| 313 | 316 |
| 314 content::NotificationRegistrar registrar_; | 317 content::NotificationRegistrar registrar_; |
| 315 | 318 |
| 316 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 319 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 317 }; | 320 }; |
| 318 | 321 |
| 319 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 322 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |