| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "ui/base/theme_provider.h" | 23 #include "ui/base/theme_provider.h" |
| 24 | 24 |
| 25 #if defined(OS_WIN) |
| 26 #include "base/win/registry.h" |
| 27 #endif |
| 28 |
| 25 class CustomThemeSupplier; | 29 class CustomThemeSupplier; |
| 26 class BrowserThemePack; | 30 class BrowserThemePack; |
| 27 class ThemeSyncableService; | 31 class ThemeSyncableService; |
| 28 class Profile; | 32 class Profile; |
| 29 | 33 |
| 30 namespace base { | 34 namespace base { |
| 31 class FilePath; | 35 class FilePath; |
| 32 } | 36 } |
| 33 | 37 |
| 34 namespace color_utils { | 38 namespace color_utils { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 256 |
| 253 #if defined(ENABLE_SUPERVISED_USERS) | 257 #if defined(ENABLE_SUPERVISED_USERS) |
| 254 // Returns true if the profile belongs to a supervised user. | 258 // Returns true if the profile belongs to a supervised user. |
| 255 bool IsSupervisedUser() const; | 259 bool IsSupervisedUser() const; |
| 256 | 260 |
| 257 // Sets the current theme to the supervised user theme. Should only be used | 261 // Sets the current theme to the supervised user theme. Should only be used |
| 258 // for supervised user profiles. | 262 // for supervised user profiles. |
| 259 void SetSupervisedUserTheme(); | 263 void SetSupervisedUserTheme(); |
| 260 #endif | 264 #endif |
| 261 | 265 |
| 266 #if defined(OS_WIN) |
| 267 // Returns true if the window frame color is determined by the DWM, i.e. this |
| 268 // is a native frame on Win 10+. |
| 269 bool ShouldUseDwmFrameColor() const; |
| 270 |
| 271 // Callback executed when |dwm_key_| is updated. This re-reads the active |
| 272 // frame color and updates |dwm_frame_color_|. |
| 273 void OnDwmKeyUpdated(); |
| 274 #endif |
| 275 |
| 262 #if defined(OS_MACOSX) | 276 #if defined(OS_MACOSX) |
| 263 // |nsimage_cache_| retains the images it has cached. | 277 // |nsimage_cache_| retains the images it has cached. |
| 264 typedef std::map<int, NSImage*> NSImageMap; | 278 typedef std::map<int, NSImage*> NSImageMap; |
| 265 mutable NSImageMap nsimage_cache_; | 279 mutable NSImageMap nsimage_cache_; |
| 266 | 280 |
| 267 // |nscolor_cache_| retains the colors it has cached. | 281 // |nscolor_cache_| retains the colors it has cached. |
| 268 typedef std::map<int, NSColor*> NSColorMap; | 282 typedef std::map<int, NSColor*> NSColorMap; |
| 269 mutable NSColorMap nscolor_cache_; | 283 mutable NSColorMap nscolor_cache_; |
| 270 | 284 |
| 271 typedef std::map<int, NSGradient*> NSGradientMap; | 285 typedef std::map<int, NSGradient*> NSGradientMap; |
| 272 mutable NSGradientMap nsgradient_cache_; | 286 mutable NSGradientMap nsgradient_cache_; |
| 273 #endif | 287 #endif |
| 274 | 288 |
| 275 ui::ResourceBundle& rb_; | 289 ui::ResourceBundle& rb_; |
| 276 Profile* profile_; | 290 Profile* profile_; |
| 277 | 291 |
| 278 scoped_refptr<CustomThemeSupplier> theme_supplier_; | 292 scoped_refptr<CustomThemeSupplier> theme_supplier_; |
| 279 | 293 |
| 280 // The id of the theme extension which has just been installed but has not | 294 // The id of the theme extension which has just been installed but has not |
| 281 // been loaded yet. The theme extension with |installed_pending_load_id_| may | 295 // been loaded yet. The theme extension with |installed_pending_load_id_| may |
| 282 // never be loaded if the install is due to updating a disabled theme. | 296 // never be loaded if the install is due to updating a disabled theme. |
| 283 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no | 297 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no |
| 284 // recently installed theme extensions | 298 // recently installed theme extensions |
| 285 std::string installed_pending_load_id_; | 299 std::string installed_pending_load_id_; |
| 286 | 300 |
| 287 // The number of infobars currently displayed. | 301 // The number of infobars currently displayed. |
| 288 int number_of_infobars_; | 302 int number_of_infobars_; |
| 289 | 303 |
| 304 #if defined(OS_WIN) |
| 305 // Registry key containing the params that determine the DWM frame color. |
| 306 // This is only initialized on Windows 10. |
| 307 scoped_ptr<base::win::RegKey> dwm_key_; |
| 308 |
| 309 // The DWM frame color, if available; white otherwise. |
| 310 SkColor dwm_frame_color_; |
| 311 #endif |
| 312 |
| 290 content::NotificationRegistrar registrar_; | 313 content::NotificationRegistrar registrar_; |
| 291 | 314 |
| 292 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 315 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
| 293 | 316 |
| 294 #if defined(ENABLE_EXTENSIONS) | 317 #if defined(ENABLE_EXTENSIONS) |
| 295 class ThemeObserver; | 318 class ThemeObserver; |
| 296 scoped_ptr<ThemeObserver> theme_observer_; | 319 scoped_ptr<ThemeObserver> theme_observer_; |
| 297 #endif | 320 #endif |
| 298 | 321 |
| 299 BrowserThemeProvider original_theme_provider_; | 322 BrowserThemeProvider original_theme_provider_; |
| 300 BrowserThemeProvider incognito_theme_provider_; | 323 BrowserThemeProvider incognito_theme_provider_; |
| 301 | 324 |
| 302 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 325 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 303 | 326 |
| 304 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 327 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 305 }; | 328 }; |
| 306 | 329 |
| 307 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 330 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |