| Index: generated_files_will_not_submit/permissions.cc
|
| diff --git a/generated_files_will_not_submit/permissions.cc b/generated_files_will_not_submit/permissions.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dba311f2726e59347836834f1ac2c67c311681cc
|
| --- /dev/null
|
| +++ b/generated_files_will_not_submit/permissions.cc
|
| @@ -0,0 +1,174 @@
|
| +// 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/permissions.json
|
| +// DO NOT EDIT.
|
| +
|
| +#include "tools/json_schema_compiler/util.h"
|
| +#include "chrome/common/extensions/api/permissions.h"
|
| +
|
| +using base::Value;
|
| +using base::DictionaryValue;
|
| +using base::ListValue;
|
| +
|
| +namespace extensions {
|
| +namespace api {
|
| +namespace permissions {
|
| +
|
| +//
|
| +// Types
|
| +//
|
| +
|
| +Permissions::Permissions() {}
|
| +Permissions::~Permissions() {}
|
| +
|
| +// static
|
| +bool Permissions::Populate(const Value& value, Permissions* out) {
|
| + if (!value.IsType(Value::TYPE_DICTIONARY))
|
| + return false;
|
| + const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
|
| +
|
| + Value* origins_value = NULL;
|
| + if (dict->GetWithoutPathExpansion("origins", &origins_value)) {
|
| + {
|
| + if (!origins_value->IsType(Value::TYPE_LIST))
|
| + return false;
|
| + ListValue* list = NULL;
|
| + if (!origins_value->GetAsList(&list))
|
| + return false;
|
| + if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &out->origins))
|
| + return false;
|
| + }
|
| + }
|
| +
|
| + Value* permissions_value = NULL;
|
| + if (dict->GetWithoutPathExpansion("permissions", &permissions_value)) {
|
| + {
|
| + if (!permissions_value->IsType(Value::TYPE_LIST))
|
| + return false;
|
| + ListValue* list = NULL;
|
| + if (!permissions_value->GetAsList(&list))
|
| + return false;
|
| + if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &out->permissions))
|
| + return false;
|
| + }
|
| + }
|
| +
|
| + return true;
|
| +}
|
| +
|
| +scoped_ptr<DictionaryValue> Permissions::ToValue() const {
|
| + scoped_ptr<DictionaryValue> value(new DictionaryValue());
|
| +
|
| + if (origins.get())
|
| + json_schema_compiler::util::PopulateDictionaryFromOptionalArray(origins, "origins", value.get());
|
| + if (permissions.get())
|
| + json_schema_compiler::util::PopulateDictionaryFromOptionalArray(permissions, "permissions", value.get());
|
| +
|
| + return value.Pass();
|
| +}
|
| +
|
| +
|
| +//
|
| +// Functions
|
| +//
|
| +
|
| +Contains::Params::Params() {}
|
| +Contains::Params::~Params() {}
|
| +
|
| +// static
|
| +scoped_ptr<Contains::Params> Contains::Params::Create(const ListValue& args) {
|
| + if (args.GetSize() != 1)
|
| + return scoped_ptr<Params>();
|
| + scoped_ptr<Params> params(new Params());
|
| +
|
| + Value* permissions_value = NULL;
|
| + if (!args.Get(0, &permissions_value) || permissions_value->IsType(Value::TYPE_NULL))
|
| + return scoped_ptr<Params>();
|
| + {
|
| + if (!permissions_value->IsType(Value::TYPE_DICTIONARY))
|
| + return scoped_ptr<Params>();
|
| + DictionaryValue* dictionary = NULL;
|
| + if (!permissions_value->GetAsDictionary(&dictionary))
|
| + return scoped_ptr<Params>();
|
| + if (!Permissions::Populate(*dictionary, ¶ms->permissions))
|
| + return scoped_ptr<Params>();
|
| + }
|
| +
|
| + return params.Pass();
|
| +}
|
| +
|
| +
|
| +Value* Contains::Result::Create(const bool result) {
|
| + return Value::CreateBooleanValue(result);
|
| +}
|
| +
|
| +Value* GetAll::Result::Create(const Permissions& permissions) {
|
| + return permissions.ToValue().release();
|
| +}
|
| +
|
| +Request::Params::Params() {}
|
| +Request::Params::~Params() {}
|
| +
|
| +// static
|
| +scoped_ptr<Request::Params> Request::Params::Create(const ListValue& args) {
|
| + if (args.GetSize() != 1)
|
| + return scoped_ptr<Params>();
|
| + scoped_ptr<Params> params(new Params());
|
| +
|
| + Value* permissions_value = NULL;
|
| + if (!args.Get(0, &permissions_value) || permissions_value->IsType(Value::TYPE_NULL))
|
| + return scoped_ptr<Params>();
|
| + {
|
| + if (!permissions_value->IsType(Value::TYPE_DICTIONARY))
|
| + return scoped_ptr<Params>();
|
| + DictionaryValue* dictionary = NULL;
|
| + if (!permissions_value->GetAsDictionary(&dictionary))
|
| + return scoped_ptr<Params>();
|
| + if (!Permissions::Populate(*dictionary, ¶ms->permissions))
|
| + return scoped_ptr<Params>();
|
| + }
|
| +
|
| + return params.Pass();
|
| +}
|
| +
|
| +
|
| +Value* Request::Result::Create(const bool granted) {
|
| + return Value::CreateBooleanValue(granted);
|
| +}
|
| +
|
| +Remove::Params::Params() {}
|
| +Remove::Params::~Params() {}
|
| +
|
| +// static
|
| +scoped_ptr<Remove::Params> Remove::Params::Create(const ListValue& args) {
|
| + if (args.GetSize() != 1)
|
| + return scoped_ptr<Params>();
|
| + scoped_ptr<Params> params(new Params());
|
| +
|
| + Value* permissions_value = NULL;
|
| + if (!args.Get(0, &permissions_value) || permissions_value->IsType(Value::TYPE_NULL))
|
| + return scoped_ptr<Params>();
|
| + {
|
| + if (!permissions_value->IsType(Value::TYPE_DICTIONARY))
|
| + return scoped_ptr<Params>();
|
| + DictionaryValue* dictionary = NULL;
|
| + if (!permissions_value->GetAsDictionary(&dictionary))
|
| + return scoped_ptr<Params>();
|
| + if (!Permissions::Populate(*dictionary, ¶ms->permissions))
|
| + return scoped_ptr<Params>();
|
| + }
|
| +
|
| + return params.Pass();
|
| +}
|
| +
|
| +
|
| +Value* Remove::Result::Create(const bool removed) {
|
| + return Value::CreateBooleanValue(removed);
|
| +}
|
| +
|
| +} // permissions
|
| +} // api
|
| +} // extensions
|
|
|