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

Unified Diff: generated_files_will_not_submit/experimental.declarative.cc

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: support for choices Created 8 years, 10 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: generated_files_will_not_submit/experimental.declarative.cc
diff --git a/generated_files_will_not_submit/experimental.declarative.cc b/generated_files_will_not_submit/experimental.declarative.cc
new file mode 100644
index 0000000000000000000000000000000000000000..647c0af2445dc7379a340ffbd8b637010231ad06
--- /dev/null
+++ b/generated_files_will_not_submit/experimental.declarative.cc
@@ -0,0 +1,150 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// GENERATED FROM THE API DEFINITION IN
+// chrome/common/extensions/api/experimental.declarative.json
+// DO NOT EDIT.
+
+#include "tools/json_schema_compiler/util.h"
+#include "chrome/common/extensions/api/experimental.declarative.h"
+
+namespace extensions {
+namespace api {
+namespace experimental_declarative {
+
+//
+// Types
+//
+
+Rule::Rule() {}
+Rule::~Rule() {}
+
+// static
+bool Rule::Populate(const Value& value, Rule* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ {
+ int priority_temp;
+ if (dict->GetInteger("priority", &priority_temp))
+ out->priority.reset(new int(priority_temp));
+ }
+ if (!json_schema_compiler::util::GetArrayFromDictionary(*dict, "conditions", &out->conditions))
+ return false;
+ {
+ std::string id_temp;
+ if (dict->GetString("id", &id_temp))
+ out->id.reset(new std::string(id_temp));
+ }
+ if (!json_schema_compiler::util::GetArrayFromDictionary(*dict, "actions", &out->actions))
+ return false;
+ return true;
+}
+
+DictionaryValue* Rule::ToValue() const {
+ DictionaryValue* value = new DictionaryValue();
+
+ if (priority.get())
+ value->SetWithoutPathExpansion("priority", Value::CreateIntegerValue(*priority));
+ json_schema_compiler::util::SetArrayToDictionary(conditions, "conditions", value);
+ if (id.get())
+ value->SetWithoutPathExpansion("id", Value::CreateStringValue(*id));
+ json_schema_compiler::util::SetArrayToDictionary(actions, "actions", value);
+
+ return value;
+}
+
+
+//
+// Functions
+//
+
+GetRules::Params::Params() {}
+GetRules::Params::~Params() {}
+
+// static
+scoped_ptr<GetRules::Params> GetRules::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ if (!args.GetString(0, &params->event))
+ return scoped_ptr<Params>();
+
+ ListValue* rule_identifiers_param = NULL;
+ if (!args.GetList(1, &rule_identifiers_param))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::GetArrayFromList(*rule_identifiers_param, &params->rule_identifiers))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+// Rules that were registered, the optional parameters are filled with values.
+Value* GetRules::Result::Create(const std::vector<linked_ptr<Rule> > rules) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetArrayToList(rules, value);
+ return value;
+}
+
+RemoveRules::Params::Params() {}
+RemoveRules::Params::~Params() {}
+
+// static
+scoped_ptr<RemoveRules::Params> RemoveRules::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ if (!args.GetString(0, &params->event))
+ return scoped_ptr<Params>();
+
+ ListValue* rule_identifiers_param = NULL;
+ if (!args.GetList(1, &rule_identifiers_param))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::GetArrayFromList(*rule_identifiers_param, &params->rule_identifiers))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+Value* RemoveRules::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+AddRules::Params::Params() {}
+AddRules::Params::~Params() {}
+
+// static
+scoped_ptr<AddRules::Params> AddRules::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ if (!args.GetString(0, &params->event))
+ return scoped_ptr<Params>();
+
+ ListValue* rules_param = NULL;
+ if (!args.GetList(1, &rules_param))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::GetArrayFromList(*rules_param, &params->rules))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+// Rules that were registered, the optional parameters are filled with values.
+Value* AddRules::Result::Create(const std::vector<linked_ptr<Rule> > rules) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetArrayToList(rules, value);
+ return value;
+}
+
+} // experimental_declarative
+} // api
+} // extensions

Powered by Google App Engine
This is Rietveld 408576698