summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 07:33:56 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 07:33:56 +0000
commitece6966482dc410c602f2c7086d71cf261305530 (patch)
tree05009343e4ad2decf50ee44bdc0ff1c8c547234c /chrome/browser
parentca5c4e5bd40a8f2f59c53f5a29bcde2591633ee8 (diff)
downloadchromium_src-ece6966482dc410c602f2c7086d71cf261305530.zip
chromium_src-ece6966482dc410c602f2c7086d71cf261305530.tar.gz
chromium_src-ece6966482dc410c602f2c7086d71cf261305530.tar.bz2
Let theme values that previous had to be real be specified as ints.
Also bonus update to background_tab_text naming. BUG=16892 TEST=Create and install a theme with integer values for ntp_section opacity or tint values. Review URL: http://codereview.chromium.org/160093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_theme_provider.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc
index c993bef..295b2dc 100644
--- a/chrome/browser/browser_theme_provider.cc
+++ b/chrome/browser/browser_theme_provider.cc
@@ -39,7 +39,7 @@ const char* BrowserThemeProvider::kColorFrameIncognitoInactive =
const char* BrowserThemeProvider::kColorToolbar = "toolbar";
const char* BrowserThemeProvider::kColorTabText = "tab_text";
const char* BrowserThemeProvider::kColorBackgroundTabText =
- "background_tab_text";
+ "tab_background_text";
const char* BrowserThemeProvider::kColorBookmarkText = "bookmark_text";
const char* BrowserThemeProvider::kColorNTPBackground = "ntp_background";
const char* BrowserThemeProvider::kColorNTPText = "ntp_text";
@@ -536,9 +536,14 @@ void BrowserThemeProvider::SetColorData(DictionaryValue* colors_value) {
color_list->GetInteger(2, &b);
if (color_list->GetSize() == 4) {
double alpha;
- color_list->GetReal(3, &alpha);
- colors_[WideToUTF8(*iter)] = SkColorSetARGB(
- static_cast<int>(alpha * 255), r, g, b);
+ int alpha_int;
+ if (color_list->GetReal(3, &alpha)) {
+ colors_[WideToUTF8(*iter)] = SkColorSetARGB(
+ static_cast<int>(alpha * 255), r, g, b);
+ } else if (color_list->GetInteger(3, &alpha_int)) {
+ colors_[WideToUTF8(*iter)] = SkColorSetARGB(
+ alpha_int * 255, r, g, b);
+ }
} else {
colors_[WideToUTF8(*iter)] = SkColorSetRGB(r, g, b);
}
@@ -559,10 +564,14 @@ void BrowserThemeProvider::SetTintData(DictionaryValue* tints_value) {
if (tints_value->GetList(*iter, &tint_list) &&
tint_list->GetSize() == 3) {
skia::HSL hsl = { -1, -1, -1 };
- // TODO(glen): Make this work with integer values.
- tint_list->GetReal(0, &hsl.h);
- tint_list->GetReal(1, &hsl.s);
- tint_list->GetReal(2, &hsl.l);
+ int value = 0;
+ if (!tint_list->GetReal(0, &hsl.h) && tint_list->GetInteger(0, &value))
+ hsl.h = value;
+ if (!tint_list->GetReal(1, &hsl.s) && tint_list->GetInteger(1, &value))
+ hsl.s = value;
+ if (!tint_list->GetReal(2, &hsl.l) && tint_list->GetInteger(2, &value))
+ hsl.l = value;
+
tints_[WideToUTF8(*iter)] = hsl;
}
++iter;