diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 20:00:09 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 20:00:09 +0000 |
commit | b5d079536bcbf33c657fd96079bb7b2bd9644c0e (patch) | |
tree | b9f4a20f69bbd3252464cf96e13b21d3d5b5ca09 /chrome/browser/browser_theme_provider.h | |
parent | 89beb4c0dc72aeb590a8944bf2f24b95b9c90425 (diff) | |
download | chromium_src-b5d079536bcbf33c657fd96079bb7b2bd9644c0e.zip chromium_src-b5d079536bcbf33c657fd96079bb7b2bd9644c0e.tar.gz chromium_src-b5d079536bcbf33c657fd96079bb7b2bd9644c0e.tar.bz2 |
Make the ThemeProvider methods const.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/266037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.h')
-rw-r--r-- | chrome/browser/browser_theme_provider.h | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index 64eb871..02fec9b 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -157,19 +157,19 @@ class BrowserThemeProvider : public NonThreadSafe, // ThemeProvider implementation. virtual void Init(Profile* profile); - virtual SkBitmap* GetBitmapNamed(int id); - virtual SkColor GetColor(int id); - virtual bool GetDisplayProperty(int id, int* result); - virtual bool ShouldUseNativeFrame(); - virtual bool HasCustomImage(int id); - virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data); + virtual SkBitmap* GetBitmapNamed(int id) const; + virtual SkColor GetColor(int id) const; + virtual bool GetDisplayProperty(int id, int* result) const; + virtual bool ShouldUseNativeFrame() const; + virtual bool HasCustomImage(int id) const; + virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data) const; #if defined(OS_LINUX) - virtual GdkPixbuf* GetPixbufNamed(int id); - virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); + virtual GdkPixbuf* GetPixbufNamed(int id) const; + virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const; #elif defined(OS_MACOSX) - virtual NSImage* GetNSImageNamed(int id); - virtual NSColor* GetNSColor(int id); - virtual NSColor* GetNSColorTint(int id); + virtual NSImage* GetNSImageNamed(int id) const; + virtual NSColor* GetNSColor(int id) const; + virtual NSColor* GetNSColorTint(int id) const; #endif // Set the current theme to the theme defined in |extension|. @@ -184,11 +184,11 @@ class BrowserThemeProvider : public NonThreadSafe, // Gets the id of the last installed theme. (The theme may have been further // locally customized.) - std::string GetThemeID(); + std::string GetThemeID() const; // Reads the image data from the theme file into the specified vector. Returns // true on success. - bool ReadThemeFileData(int id, std::vector<unsigned char>* raw_data); + bool ReadThemeFileData(int id, std::vector<unsigned char>* raw_data) const; // Convert a bitfield alignment into a string like "top left". Public so that // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. @@ -227,7 +227,7 @@ class BrowserThemeProvider : public NonThreadSafe, void SetTint(const char* id, const color_utils::HSL& tint); // Get the specified tint - |id| is one of the TINT_* enum values. - color_utils::HSL GetTint(int id); + color_utils::HSL GetTint(int id) const; // Generate any frame colors that weren't specified. void GenerateFrameColors(); @@ -235,11 +235,11 @@ class BrowserThemeProvider : public NonThreadSafe, // Generate any frame images that weren't specified. The resulting images // will be stored in our cache and written to disk. If images have already // been generated and cached, load them from disk. - void GenerateFrameImages(); + void GenerateFrameImages() const; // Generate any tab images that weren't specified. The resulting images // will be stored in our cache. - void GenerateTabImages(); + void GenerateTabImages() const; // Clears all the override fields and saves the dictionary. void ClearAllThemeData(); @@ -252,10 +252,10 @@ class BrowserThemeProvider : public NonThreadSafe, // Loads a bitmap from the theme, which may be tinted or // otherwise modified, or an application default. - virtual SkBitmap* LoadThemeBitmap(int id); + virtual SkBitmap* LoadThemeBitmap(int id) const; // Save the modified bitmap at image_cache_[id]. - virtual void SaveThemeBitmap(std::string resource_name, int id); + virtual void SaveThemeBitmap(std::string resource_name, int id) const; // Clears the platform-specific caches. Do not call directly; it's called // from ClearCaches(). @@ -264,7 +264,7 @@ class BrowserThemeProvider : public NonThreadSafe, // The implementation of GenerateTabBackgroundBitmap(). That function also // must be locked and touches caches; this function only deals with image // generation. - SkBitmap* GenerateTabBackgroundBitmapImpl(int id); + SkBitmap* GenerateTabBackgroundBitmapImpl(int id) const; Profile* profile() { return profile_; } @@ -281,19 +281,19 @@ class BrowserThemeProvider : public NonThreadSafe, typedef std::map<const int, std::string> ResourceNameMap; // Returns the string key for the given tint |id| TINT_* enum value. - const std::string GetTintKey(int id); + const std::string GetTintKey(int id) const; // Returns the default tint for the given tint |id| TINT_* enum value. - color_utils::HSL GetDefaultTint(int id); + color_utils::HSL GetDefaultTint(int id) const; // Returns the string key for the given color |id| COLOR_* enum value. - const std::string GetColorKey(int id); + const std::string GetColorKey(int id) const; // Returns the default color for the given color |id| COLOR_* enum value. - SkColor GetDefaultColor(int id); + SkColor GetDefaultColor(int id) const; // Tint |bitmap| with the tint specified by |hsl_id| - SkBitmap TintBitmap(const SkBitmap& bitmap, int hsl_id); + SkBitmap TintBitmap(const SkBitmap& bitmap, int hsl_id) const; // The following load data from specified dictionaries (either from // preferences or from an extension manifest) and update our theme @@ -318,17 +318,17 @@ class BrowserThemeProvider : public NonThreadSafe, void SetDisplayPropertyData(DictionaryValue* display_properties); // Create any images that aren't pregenerated (e.g. background tab images). - SkBitmap* GenerateTabBackgroundBitmap(int id); + SkBitmap* GenerateTabBackgroundBitmap(int id) const; // Save our data - when saving images we need the original dictionary // from the extension because it contains the text ids that we want to save. - void SaveImageData(DictionaryValue* images); - void SaveColorData(); - void SaveTintData(); - void SaveDisplayPropertyData(); + void SaveImageData(DictionaryValue* images) const; + void SaveColorData() const; + void SaveTintData() const; + void SaveDisplayPropertyData() const; // Save the paths of data we have written to disk in prefs. - void SaveCachedImageData(); + void SaveCachedImageData() const; // Save the id of the last theme installed. void SaveThemeID(const std::string& id); @@ -337,35 +337,35 @@ class BrowserThemeProvider : public NonThreadSafe, void ClearCaches(); // Encode image at image_cache_[id] as PNG and write to disk. - void WriteImagesToDisk(); + void WriteImagesToDisk() const; // Do we have a custom frame image or custom tints? - bool ShouldTintFrames(); + bool ShouldTintFrames() const; #if defined(OS_LINUX) // Loads an image and flips it horizontally if |rtl_enabled| is true. - GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); + GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; #endif - ImageCache image_cache_; + mutable ImageCache image_cache_; // Keep images generated for theme cache in their own place, so we can lock // them on WRITE from UI thread and READ from file thread. Read from UI // thread will be allowed unlocked, because no other thread has write // access to the cache. - ImageCache themed_image_cache_; + mutable ImageCache themed_image_cache_; #if defined(OS_LINUX) typedef std::map<int, GdkPixbuf*> GdkPixbufMap; - GdkPixbufMap gdk_pixbufs_; + mutable GdkPixbufMap gdk_pixbufs_; #elif defined(OS_MACOSX) typedef std::map<int, NSImage*> NSImageMap; - NSImageMap nsimage_cache_; + mutable NSImageMap nsimage_cache_; typedef std::map<int, NSColor*> NSColorMap; - NSColorMap nscolor_cache_; + mutable NSColorMap nscolor_cache_; #endif - ImagesDiskCache images_disk_cache_; + mutable ImagesDiskCache images_disk_cache_; ResourceBundle& rb_; Profile* profile_; @@ -373,7 +373,7 @@ class BrowserThemeProvider : public NonThreadSafe, ImageMap images_; ColorMap colors_; TintMap tints_; - RawDataMap raw_data_; + mutable RawDataMap raw_data_; DisplayPropertyMap display_properties_; // Reverse of theme_resources_map, so we can cache images properly. |