Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9551)

Unified Diff: chrome/common/extensions/extension.cc

Issue 6901084: Use new APIs in base/values.h: Value::GetAsNumber and DictionaryValue::GetNumber. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, 2010->2011 Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/common/json_schema_validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 815e23e1afabaf4c5ce77bc52524ee1f66668095..050d6b8c8404c4f1daadd73f4ccc3ec3ab1e4956 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1882,16 +1882,15 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
iter != colors_value->end_keys(); ++iter) {
ListValue* color_list = NULL;
double alpha = 0.0;
- int alpha_int = 0;
int color = 0;
// The color must be a list
if (!colors_value->GetListWithoutPathExpansion(*iter, &color_list) ||
// And either 3 items (RGB) or 4 (RGBA)
((color_list->GetSize() != 3) &&
((color_list->GetSize() != 4) ||
- // For RGBA, the fourth item must be a real or int alpha value
- (!color_list->GetDouble(3, &alpha) &&
- !color_list->GetInteger(3, &alpha_int)))) ||
+ // For RGBA, the fourth item must be a real or int alpha value.
+ // Note that GetDouble() can get an integer value.
+ !color_list->GetDouble(3, &alpha))) ||
// For both RGB and RGBA, the first three items must be ints (R,G,B)
!color_list->GetInteger(0, &color) ||
!color_list->GetInteger(1, &color) ||
@@ -1910,12 +1909,11 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
iter != tints_value->end_keys(); ++iter) {
ListValue* tint_list = NULL;
double v = 0.0;
- int vi = 0;
if (!tints_value->GetListWithoutPathExpansion(*iter, &tint_list) ||
tint_list->GetSize() != 3 ||
- !(tint_list->GetDouble(0, &v) || tint_list->GetInteger(0, &vi)) ||
- !(tint_list->GetDouble(1, &v) || tint_list->GetInteger(1, &vi)) ||
- !(tint_list->GetDouble(2, &v) || tint_list->GetInteger(2, &vi))) {
+ !tint_list->GetDouble(0, &v) ||
+ !tint_list->GetDouble(1, &v) ||
+ !tint_list->GetDouble(2, &v)) {
*error = errors::kInvalidThemeTints;
return false;
}
« no previous file with comments | « chrome/browser/themes/browser_theme_pack.cc ('k') | chrome/common/json_schema_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698