summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/gtk_theme_provider.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 01:40:30 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 01:40:30 +0000
commitfd9c35f41bcab4966a5db8d24de812b1e9f87967 (patch)
treee896d02bd840995415ce362ff498c460f14e6601 /chrome/browser/gtk/gtk_theme_provider.cc
parent28fe69ab1bb9362a1ee105821ec4631b574417d3 (diff)
downloadchromium_src-fd9c35f41bcab4966a5db8d24de812b1e9f87967.zip
chromium_src-fd9c35f41bcab4966a5db8d24de812b1e9f87967.tar.gz
chromium_src-fd9c35f41bcab4966a5db8d24de812b1e9f87967.tar.bz2
Misc. cleanup for theme provider code, including:
* Use correct indentation/alignment in a number of places * Use early-return to avoid long code block indenting * Use for() instead of while() in cases where that's what the code is actually doing * Consistent naming for iterators ("foo_iter", "bar_iter" instead of sometimes that way and sometimes "found") * Use {} when needed, don't use when not * Do not use "else" after "return" * Shorten overly-verbose code * Pull some trivial functions into the header * Eliminate unused function * Use STLDeleteValues() helper where appropriate Some of this was originally in my patch that modified constness, but I've split it out to make that more sane. BUG=none TEST=none Review URL: http://codereview.chromium.org/272033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/gtk_theme_provider.cc')
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index 63dccfd..dc8b084 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -127,12 +127,9 @@ void GtkThemeProvider::SetNativeTheme() {
void GtkThemeProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NotificationType::PREF_CHANGED) {
- std::wstring key = *Details<std::wstring>(details).ptr();
- if (key == prefs::kUsesSystemTheme) {
- use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
- }
- }
+ if ((type == NotificationType::PREF_CHANGED) &&
+ (*Details<std::wstring>(details).ptr() == prefs::kUsesSystemTheme))
+ use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
}
GtkWidget* GtkThemeProvider::BuildChromeButton() {
@@ -268,10 +265,10 @@ SkBitmap* GtkThemeProvider::LoadThemeBitmap(int id) {
bitmap->allocPixels();
bitmap->eraseRGB(color->red >> 8, color->green >> 8, color->blue >> 8);
return bitmap;
- } else if ((id == IDR_THEME_TAB_BACKGROUND ||
- id == IDR_THEME_TAB_BACKGROUND_INCOGNITO)) {
- return GenerateTabBackgroundBitmapImpl(id);
}
+ if ((id == IDR_THEME_TAB_BACKGROUND) ||
+ (id == IDR_THEME_TAB_BACKGROUND_INCOGNITO))
+ return GenerateTabBackgroundBitmapImpl(id);
}
return BrowserThemeProvider::LoadThemeBitmap(id);