diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 23:23:08 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-13 23:23:08 +0000 |
commit | 5fdafb2f68bd61ef92d10194402348d1e5839015 (patch) | |
tree | fb8583216c733e2a2218501646cf8c72fec35bb1 /chrome/browser/browser_theme_provider.h | |
parent | 0735266658f996210b6f43142ce7f4c55f47ae13 (diff) | |
download | chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.zip chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.tar.gz chromium_src-5fdafb2f68bd61ef92d10194402348d1e5839015.tar.bz2 |
GTK Themes: Refactored to use notifications instead of manual plumbing.
- Removes large amounts of plumbing because:
- All GtkChromeButtons are constructed from GtkThemeProvider which keeps a reference to all live buttons and sends them theme change notifications.
- CustomDrawButtons now subscribe themselves to the BROWSER_THEME_CHANGED notification; this gets rid of a LOT of plubming.
- Removes the GtkThemeProperties struct; just pass the theme provider around.
- Move all the constants from the themes namespace to class statics, per tony's suggestion
Review URL: http://codereview.chromium.org/149547
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.h')
-rw-r--r-- | chrome/browser/browser_theme_provider.h | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index b0c1b9c..f91b494 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -20,75 +20,75 @@ class Extension; class Profile; class DictionaryValue; -namespace themes { - -// Strings used by themes to identify colors for different parts of our UI. -extern const char* kColorFrame; -extern const char* kColorFrameInactive; -extern const char* kColorFrameIncognito; -extern const char* kColorFrameIncognitoInactive; -extern const char* kColorToolbar; -extern const char* kColorTabText; -extern const char* kColorBackgroundTabText; -extern const char* kColorBookmarkText; -extern const char* kColorNTPBackground; -extern const char* kColorNTPText; -extern const char* kColorNTPLink; -extern const char* kColorNTPSection; -extern const char* kColorNTPSectionText; -extern const char* kColorNTPSectionLink; -extern const char* kColorControlBackground; -extern const char* kColorButtonBackground; - -// Strings used by themes to identify tints to apply to different parts of -// our UI. The frame tints apply to the frame color and produce the -// COLOR_FRAME* colors. -extern const char* kTintButtons; -extern const char* kTintFrame; -extern const char* kTintFrameInactive; -extern const char* kTintFrameIncognito; -extern const char* kTintFrameIncognitoInactive; -extern const char* kTintBackgroundTab; - -// Strings used by themes to identify miscellaneous numerical properties. -extern const char* kDisplayPropertyNTPAlignment; - -// Strings used in alignment properties. -extern const char* kAlignmentTop; -extern const char* kAlignmentBottom; -extern const char* kAlignmentLeft; -extern const char* kAlignmentRight; - -// Default colors. -extern const SkColor kDefaultColorFrame; -extern const SkColor kDefaultColorFrameInactive; -extern const SkColor kDefaultColorFrameIncognito; -extern const SkColor kDefaultColorFrameIncognitoInactive; -extern const SkColor kDefaultColorToolbar; -extern const SkColor kDefaultColorTabText; -extern const SkColor kDefaultColorBackgroundTabText; -extern const SkColor kDefaultColorBookmarkText; -extern const SkColor kDefaultColorNTPBackground; -extern const SkColor kDefaultColorNTPText; -extern const SkColor kDefaultColorNTPLink; -extern const SkColor kDefaultColorNTPSection; -extern const SkColor kDefaultColorNTPSectionText; -extern const SkColor kDefaultColorNTPSectionLink; -extern const SkColor kDefaultColorControlBackground; -extern const SkColor kDefaultColorButtonBackground; - -extern const skia::HSL kDefaultTintButtons; -extern const skia::HSL kDefaultTintFrame; -extern const skia::HSL kDefaultTintFrameInactive; -extern const skia::HSL kDefaultTintFrameIncognito; -extern const skia::HSL kDefaultTintFrameIncognitoInactive; -extern const skia::HSL kDefaultTintBackgroundTab; -} // namespace themes - class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, public NonThreadSafe, public ThemeProvider { public: + // Public constants used in BrowserThemeProvider and its subclasses: + + // Strings used by themes to identify colors for different parts of our UI. + static const char* kColorFrame; + static const char* kColorFrameInactive; + static const char* kColorFrameIncognito; + static const char* kColorFrameIncognitoInactive; + static const char* kColorToolbar; + static const char* kColorTabText; + static const char* kColorBackgroundTabText; + static const char* kColorBookmarkText; + static const char* kColorNTPBackground; + static const char* kColorNTPText; + static const char* kColorNTPLink; + static const char* kColorNTPSection; + static const char* kColorNTPSectionText; + static const char* kColorNTPSectionLink; + static const char* kColorControlBackground; + static const char* kColorButtonBackground; + + // Strings used by themes to identify tints to apply to different parts of + // our UI. The frame tints apply to the frame color and produce the + // COLOR_FRAME* colors. + static const char* kTintButtons; + static const char* kTintFrame; + static const char* kTintFrameInactive; + static const char* kTintFrameIncognito; + static const char* kTintFrameIncognitoInactive; + static const char* kTintBackgroundTab; + + // Strings used by themes to identify miscellaneous numerical properties. + static const char* kDisplayPropertyNTPAlignment; + + // Strings used in alignment properties. + static const char* kAlignmentTop; + static const char* kAlignmentBottom; + static const char* kAlignmentLeft; + static const char* kAlignmentRight; + + // Default colors. + static const SkColor kDefaultColorFrame; + static const SkColor kDefaultColorFrameInactive; + static const SkColor kDefaultColorFrameIncognito; + static const SkColor kDefaultColorFrameIncognitoInactive; + static const SkColor kDefaultColorToolbar; + static const SkColor kDefaultColorTabText; + static const SkColor kDefaultColorBackgroundTabText; + static const SkColor kDefaultColorBookmarkText; + static const SkColor kDefaultColorNTPBackground; + static const SkColor kDefaultColorNTPText; + static const SkColor kDefaultColorNTPLink; + static const SkColor kDefaultColorNTPSection; + static const SkColor kDefaultColorNTPSectionText; + static const SkColor kDefaultColorNTPSectionLink; + static const SkColor kDefaultColorControlBackground; + static const SkColor kDefaultColorButtonBackground; + + static const skia::HSL kDefaultTintButtons; + static const skia::HSL kDefaultTintFrame; + static const skia::HSL kDefaultTintFrameInactive; + static const skia::HSL kDefaultTintFrameIncognito; + static const skia::HSL kDefaultTintFrameIncognitoInactive; + static const skia::HSL kDefaultTintBackgroundTab; + + public: BrowserThemeProvider(); virtual ~BrowserThemeProvider(); @@ -127,7 +127,7 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, ALIGN_BOTTOM = 0x8, } AlignmentMasks; - void Init(Profile* profile); + virtual void Init(Profile* profile); // ThemeProvider implementation. virtual SkBitmap* GetBitmapNamed(int id); @@ -181,7 +181,7 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, virtual void LoadThemePrefs(); // Let all the browser views know that themes have changed. - void NotifyThemeChanged(); + virtual void NotifyThemeChanged(); // Loads a bitmap from the theme, which may be tinted or // otherwise modified, or an application default. |