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/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
17 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 18 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 #include "ui/base/theme_provider.h" | 21 #include "ui/base/theme_provider.h" |
21 | 22 |
22 class CustomThemeSupplier; | 23 class CustomThemeSupplier; |
23 class BrowserThemePack; | 24 class BrowserThemePack; |
24 class ThemeSyncableService; | 25 class ThemeSyncableService; |
25 class Profile; | 26 class Profile; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // case we don't have a theme pack). | 208 // case we don't have a theme pack). |
208 void BuildFromExtension(const extensions::Extension* extension); | 209 void BuildFromExtension(const extensions::Extension* extension); |
209 | 210 |
210 // Returns true if the profile belongs to a managed user. | 211 // Returns true if the profile belongs to a managed user. |
211 bool IsManagedUser() const; | 212 bool IsManagedUser() const; |
212 | 213 |
213 // Sets the current theme to the managed user theme. Should only be used for | 214 // Sets the current theme to the managed user theme. Should only be used for |
214 // managed user profiles. | 215 // managed user profiles. |
215 void SetManagedUserTheme(); | 216 void SetManagedUserTheme(); |
216 | 217 |
| 218 // Sets the managed user theme if the user has no custom theme yet. |
| 219 void OnManagedUserInitialized(); |
| 220 |
217 #if defined(TOOLKIT_GTK) | 221 #if defined(TOOLKIT_GTK) |
218 // Loads an image and flips it horizontally if |rtl_enabled| is true. | 222 // Loads an image and flips it horizontally if |rtl_enabled| is true. |
219 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; | 223 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; |
220 #endif | 224 #endif |
221 | 225 |
222 #if defined(TOOLKIT_GTK) | 226 #if defined(TOOLKIT_GTK) |
223 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; | 227 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; |
224 mutable GdkPixbufMap gdk_pixbufs_; | 228 mutable GdkPixbufMap gdk_pixbufs_; |
225 #elif defined(OS_MACOSX) | 229 #elif defined(OS_MACOSX) |
226 // |nsimage_cache_| retains the images it has cached. | 230 // |nsimage_cache_| retains the images it has cached. |
(...skipping 13 matching lines...) Expand all Loading... |
240 | 244 |
241 scoped_refptr<CustomThemeSupplier> theme_supplier_; | 245 scoped_refptr<CustomThemeSupplier> theme_supplier_; |
242 | 246 |
243 // The number of infobars currently displayed. | 247 // The number of infobars currently displayed. |
244 int number_of_infobars_; | 248 int number_of_infobars_; |
245 | 249 |
246 content::NotificationRegistrar registrar_; | 250 content::NotificationRegistrar registrar_; |
247 | 251 |
248 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 252 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
249 | 253 |
| 254 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 255 |
250 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 256 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
251 }; | 257 }; |
252 | 258 |
253 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 259 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
OLD | NEW |