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

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: DictionaryValue* to linked_ptr<DictionaryValue> Created 8 years, 11 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..55929d5d752159d9ee4799fab0706bad42672e06
--- /dev/null
+++ b/generated_files_will_not_submit/experimental.declarative.cc
@@ -0,0 +1,143 @@
+// 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);
+
+ out->priority.reset(new int);
+ dict->GetInteger("priority", out->priority.get());
not at google - send to devlin 2012/02/02 03:37:43 I don't think this is right. priority is optional,
calamity 2012/02/03 02:42:35 Done.
+ if(!json_schema_compiler::util::GetArrayFromDictionary(*dict, "conditions", &out->conditions))
+ return false;
+ out->id.reset(new std::string);
+ dict->GetString("id", out->id.get());
+ if(!json_schema_compiler::util::GetArrayFromDictionary(*dict, "actions", &out->actions))
+ return false;
+ return true;
+}
+
+DictionaryValue* Rule::ToValue() const {
+ DictionaryValue* value = new DictionaryValue();
+
+ value->SetWithoutPathExpansion("priority", Value::CreateIntegerValue(*priority));
not at google - send to devlin 2012/02/02 03:37:43 Ditto, priority is optional. Maybe the optional/no
calamity 2012/02/03 02:42:35 Done.
+ json_schema_compiler::util::SetArrayFromDictionary(conditions, "conditions", value);
+ value->SetWithoutPathExpansion("id", Value::CreateStringValue(*id));
not at google - send to devlin 2012/02/02 03:37:43 ditto
calamity 2012/02/03 02:42:35 Done.
+ json_schema_compiler::util::SetArrayFromDictionary(actions, "actions", value);
+
+ return value;
+}
+
+
+//
+// Functions
+//
+
+GetRules::Params::Params() {}
+GetRules::Params::~Params() {}
+
+// static
+scoped_ptr<GetRules::Params> GetRules::Params::Create(const ListValue& args) {
+
+ 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* l = new ListValue();
+ for (std::vector<linked_ptr<Rule> >::const_iterator it = rules.begin(); it != rules.end(); ++it) {
+ l->Append((**it).ToValue());
+ }
+ return l;
+}
+
+RemoveRules::Params::Params() {}
+RemoveRules::Params::~Params() {}
+
+// static
+scoped_ptr<RemoveRules::Params> RemoveRules::Params::Create(const ListValue& args) {
+
+ 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) {
+
+ 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* l = new ListValue();
+ for (std::vector<linked_ptr<Rule> >::const_iterator it = rules.begin(); it != rules.end(); ++it) {
+ l->Append((**it).ToValue());
+ }
+ return l;
+}
+
+} // experimental_declarative
+} // api
+} // extensions
« no previous file with comments | « generated_files_will_not_submit/experimental.declarative.h ('k') | generated_files_will_not_submit/permissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698