Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7502)

Unified Diff: chrome/browser/themes/theme_service.h

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't call NotifyThemeChanged if not ready. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/themes/theme_properties.cc ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/theme_service.h
diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h
index b6d88696267ebb318459f68a2acea6dd0b853c27..1452a9a8e0ba7dcdf216ef9cf9a911967f42c50f 100644
--- a/chrome/browser/themes/theme_service.h
+++ b/chrome/browser/themes/theme_service.h
@@ -19,8 +19,8 @@
#include "content/public/browser/notification_registrar.h"
#include "ui/base/theme_provider.h"
+class CustomThemeSupplier;
class BrowserThemePack;
-class ThemeServiceTest;
class ThemeSyncableService;
class Profile;
@@ -40,6 +40,10 @@ namespace gfx {
class Image;
}
+namespace theme_service_internal {
+class ThemeServiceTest;
+}
+
namespace ui {
class ResourceBundle;
}
@@ -142,6 +146,13 @@ class ThemeService : public base::NonThreadSafe,
typedef std::map<base::FilePath, int> ImagesDiskCache;
protected:
+ // Set a custom default theme instead of the normal default theme.
+ virtual void SetCustomDefaultTheme(
+ scoped_refptr<CustomThemeSupplier> theme_supplier);
+
+ // Returns true if the ThemeService should use the native theme on startup.
+ virtual bool ShouldInitWithNativeTheme() const;
+
// Get the specified tint - |id| is one of the TINT_* enum values.
color_utils::HSL GetTint(int id) const;
@@ -167,8 +178,16 @@ class ThemeService : public base::NonThreadSafe,
void set_ready() { ready_ = true; }
+ const CustomThemeSupplier* get_theme_supplier() const {
+ return theme_supplier_.get();
+ }
+
private:
- friend class ThemeServiceTest;
+ friend class theme_service_internal::ThemeServiceTest;
+
+ // Replaces the current theme supplier with a new one and calls
+ // StopUsingTheme() or StartUsingTheme() as appropriate.
+ void SwapThemeSupplier(scoped_refptr<CustomThemeSupplier> theme_supplier);
// Migrate the theme to the new theme pack schema by recreating the data pack
// from the extension.
@@ -187,6 +206,10 @@ class ThemeService : public base::NonThreadSafe,
// Returns true if the profile belongs to a managed user.
bool IsManagedUser() const;
+ // Sets the current theme to the managed user theme. Should only be used for
+ // managed user profiles.
+ void SetManagedUserTheme();
+
#if defined(TOOLKIT_GTK)
// Loads an image and flips it horizontally if |rtl_enabled| is true.
GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const;
@@ -215,7 +238,7 @@ class ThemeService : public base::NonThreadSafe,
// ThemeSource no longer uses the ThemeService when it is not ready.
bool ready_;
- scoped_refptr<BrowserThemePack> theme_pack_;
+ scoped_refptr<CustomThemeSupplier> theme_supplier_;
// The number of infobars currently displayed.
int number_of_infobars_;
« no previous file with comments | « chrome/browser/themes/theme_properties.cc ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698