diff options
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 25 | ||||
-rw-r--r-- | chrome/common/extensions/extension.cc | 13 |
2 files changed, 25 insertions, 13 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; diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index fc13d3a..b0324d6 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -637,7 +637,9 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id, color_list->GetInteger(2, &color)) { if (color_list->GetSize() == 4) { double alpha; - if (color_list->GetReal(3, &alpha)) { + int alpha_int; + if (color_list->GetReal(3, &alpha) || + color_list->GetInteger(3, &alpha_int)) { ++iter; continue; } @@ -662,12 +664,13 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id, DictionaryValue::key_iterator iter = tints_value->begin_keys(); while (iter != tints_value->end_keys()) { ListValue* tint_list; - double hue = 0; + double v = 0; + int vi = 0; if (!tints_value->GetList(*iter, &tint_list) || tint_list->GetSize() != 3 || - !tint_list->GetReal(0, &hue) || - !tint_list->GetReal(1, &hue) || - !tint_list->GetReal(2, &hue)) { + !(tint_list->GetReal(0, &v) || tint_list->GetInteger(0, &vi)) || + !(tint_list->GetReal(1, &v) || tint_list->GetInteger(1, &vi)) || + !(tint_list->GetReal(2, &v) || tint_list->GetInteger(2, &vi))) { *error = errors::kInvalidThemeTints; return false; } |