| 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 <memory> | 9 #include <memory> |
| 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/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.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 #include "ui/events/devices/input_device_event_observer.h" |
| 24 | 25 |
| 25 class CustomThemeSupplier; | 26 class CustomThemeSupplier; |
| 26 class BrowserThemePack; | 27 class BrowserThemePack; |
| 27 class ThemeSyncableService; | 28 class ThemeSyncableService; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| 30 namespace base { | 31 namespace base { |
| 31 class FilePath; | 32 class FilePath; |
| 32 } | 33 } |
| 33 | 34 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 #ifdef __OBJC__ | 55 #ifdef __OBJC__ |
| 55 @class NSString; | 56 @class NSString; |
| 56 // Sent whenever the browser theme changes. Object => NSValue wrapping the | 57 // Sent whenever the browser theme changes. Object => NSValue wrapping the |
| 57 // ThemeService that changed. | 58 // ThemeService that changed. |
| 58 extern "C" NSString* const kBrowserThemeDidChangeNotification; | 59 extern "C" NSString* const kBrowserThemeDidChangeNotification; |
| 59 #endif // __OBJC__ | 60 #endif // __OBJC__ |
| 60 | 61 |
| 61 class ThemeService : public base::NonThreadSafe, | 62 class ThemeService : public base::NonThreadSafe, |
| 62 public content::NotificationObserver, | 63 public content::NotificationObserver, |
| 64 public ui::InputDeviceEventObserver, |
| 63 public KeyedService { | 65 public KeyedService { |
| 64 public: | 66 public: |
| 65 // Public constants used in ThemeService and its subclasses: | 67 // Public constants used in ThemeService and its subclasses: |
| 66 static const char kDefaultThemeID[]; | 68 static const char kDefaultThemeID[]; |
| 67 | 69 |
| 68 ThemeService(); | 70 ThemeService(); |
| 69 ~ThemeService() override; | 71 ~ThemeService() override; |
| 70 | 72 |
| 71 virtual void Init(Profile* profile); | 73 virtual void Init(Profile* profile); |
| 72 | 74 |
| 73 // KeyedService: | 75 // KeyedService: |
| 74 void Shutdown() override; | 76 void Shutdown() override; |
| 75 | 77 |
| 76 // Overridden from content::NotificationObserver: | 78 // Overridden from content::NotificationObserver: |
| 77 void Observe(int type, | 79 void Observe(int type, |
| 78 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
| 79 const content::NotificationDetails& details) override; | 81 const content::NotificationDetails& details) override; |
| 80 | 82 |
| 83 // ui::InputDeviceEventObserver: |
| 84 void OnDeviceListsComplete() override; |
| 85 |
| 81 // Set the current theme to the theme defined in |extension|. | 86 // Set the current theme to the theme defined in |extension|. |
| 82 // |extension| must already be added to this profile's | 87 // |extension| must already be added to this profile's |
| 83 // ExtensionService. | 88 // ExtensionService. |
| 84 virtual void SetTheme(const extensions::Extension* extension); | 89 virtual void SetTheme(const extensions::Extension* extension); |
| 85 | 90 |
| 86 // Reset the theme to default. | 91 // Reset the theme to default. |
| 87 virtual void UseDefaultTheme(); | 92 virtual void UseDefaultTheme(); |
| 88 | 93 |
| 89 // Set the current theme to the system theme. On some platforms, the system | 94 // Set the current theme to the system theme. On some platforms, the system |
| 90 // theme is the default theme. | 95 // theme is the default theme. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 329 |
| 325 BrowserThemeProvider original_theme_provider_; | 330 BrowserThemeProvider original_theme_provider_; |
| 326 BrowserThemeProvider incognito_theme_provider_; | 331 BrowserThemeProvider incognito_theme_provider_; |
| 327 | 332 |
| 328 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 333 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 329 | 334 |
| 330 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 335 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 331 }; | 336 }; |
| 332 | 337 |
| 333 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 338 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |