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

Unified Diff: trunk/src/components/json_schema/json_schema_validator.cc

Issue 47403003: Revert 231982 "Docserver: Display enum value descriptions in API..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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
Index: trunk/src/components/json_schema/json_schema_validator.cc
===================================================================
--- trunk/src/components/json_schema/json_schema_validator.cc (revision 232015)
+++ trunk/src/components/json_schema/json_schema_validator.cc (working copy)
@@ -53,18 +53,6 @@
return entry.key < key;
}
-// If |value| is a dictionary, returns the "name" attribute of |value| or NULL
-// if |value| does not contain a "name" attribute. Otherwise, returns |value|.
-const base::Value* ExtractNameFromDictionary(const base::Value* value) {
- const base::DictionaryValue* value_dict = NULL;
- const base::Value* name_value = NULL;
- if (value->GetAsDictionary(&value_dict)) {
- value_dict->Get("name", &name_value);
- return name_value;
- }
- return value;
-}
-
bool IsValidSchema(const base::DictionaryValue* dict, std::string* error) {
// This array must be sorted, so that std::lower_bound can perform a
// binary search.
@@ -207,13 +195,6 @@
for (size_t i = 0; i < list_value->GetSize(); ++i) {
const base::Value* value = NULL;
list_value->Get(i, &value);
- // Sometimes the enum declaration is a dictionary with the enum value
- // under "name".
- value = ExtractNameFromDictionary(value);
- if (!value) {
- *error = "Invalid value in enum attribute";
- return false;
- }
switch (value->GetType()) {
case base::Value::TYPE_NULL:
case base::Value::TYPE_BOOLEAN:
@@ -498,12 +479,6 @@
for (size_t i = 0; i < choices->GetSize(); ++i) {
const base::Value* choice = NULL;
CHECK(choices->Get(i, &choice));
- // Sometimes the enum declaration is a dictionary with the enum value under
- // "name".
- choice = ExtractNameFromDictionary(choice);
- if (!choice) {
- NOTREACHED();
- }
switch (choice->GetType()) {
case base::Value::TYPE_NULL:
case base::Value::TYPE_BOOLEAN:

Powered by Google App Engine
This is Rietveld 408576698