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

Unified Diff: generated_files_will_not_submit/windows.cc

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rework, add a couple of tests 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
« no previous file with comments | « generated_files_will_not_submit/windows.h ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: generated_files_will_not_submit/windows.cc
diff --git a/generated_files_will_not_submit/windows.cc b/generated_files_will_not_submit/windows.cc
new file mode 100644
index 0000000000000000000000000000000000000000..908aed15f2b60d41ba104800e77211edfd18c145
--- /dev/null
+++ b/generated_files_will_not_submit/windows.cc
@@ -0,0 +1,709 @@
+// 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/windows.json
+// DO NOT EDIT.
+
+#include "tools/json_schema_compiler/util.h"
+#include "chrome/common/extensions/api/windows.h"
+#include "chrome/common/extensions/api/tabs.h"
+
+
+using base::Value;
+using base::DictionaryValue;
+using base::ListValue;
+
+namespace extensions {
+namespace api {
+namespace windows {
+
+//
+// Types
+//
+
+Window::Window() {}
+Window::~Window() {}
+
+// static
+bool Window::Populate(const Value& value, Window* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* tabs_value = NULL;
+ if (dict->GetWithoutPathExpansion("tabs", &tabs_value)) {
+ {
+ if (!tabs_value->IsType(Value::TYPE_LIST))
+ return false;
+ ListValue* list = NULL;
+ if (!tabs_value->GetAsList(&list))
+ return false;
+ if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &out->tabs))
+ return false;
+ }
+ }
+
+ Value* top_value = NULL;
+ if (!dict->GetWithoutPathExpansion("top", &top_value))
+ return false;
+ {
+ if (!top_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!top_value->GetAsInteger(&out->top))
+ return false;
+ }
+
+ Value* height_value = NULL;
+ if (!dict->GetWithoutPathExpansion("height", &height_value))
+ return false;
+ {
+ if (!height_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!height_value->GetAsInteger(&out->height))
+ return false;
+ }
+
+ Value* width_value = NULL;
+ if (!dict->GetWithoutPathExpansion("width", &width_value))
+ return false;
+ {
+ if (!width_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!width_value->GetAsInteger(&out->width))
+ return false;
+ }
+
+ Value* state_value = NULL;
+ if (!dict->GetWithoutPathExpansion("state", &state_value))
+ return false;
+ {
+ if (!state_value->IsType(Value::TYPE_STRING))
+ return false;
+ if (!state_value->GetAsString(&out->state))
+ return false;
+ }
+
+ Value* focused_value = NULL;
+ if (!dict->GetWithoutPathExpansion("focused", &focused_value))
+ return false;
+ {
+ if (!focused_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!focused_value->GetAsBoolean(&out->focused))
+ return false;
+ }
+
+ Value* left_value = NULL;
+ if (!dict->GetWithoutPathExpansion("left", &left_value))
+ return false;
+ {
+ if (!left_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!left_value->GetAsInteger(&out->left))
+ return false;
+ }
+
+ Value* type_value = NULL;
+ if (!dict->GetWithoutPathExpansion("type", &type_value))
+ return false;
+ {
+ if (!type_value->IsType(Value::TYPE_STRING))
+ return false;
+ if (!type_value->GetAsString(&out->type))
+ return false;
+ }
+
+ Value* id_value = NULL;
+ if (!dict->GetWithoutPathExpansion("id", &id_value))
+ return false;
+ {
+ if (!id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!id_value->GetAsInteger(&out->id))
+ return false;
+ }
+
+ Value* incognito_value = NULL;
+ if (!dict->GetWithoutPathExpansion("incognito", &incognito_value))
+ return false;
+ {
+ if (!incognito_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!incognito_value->GetAsBoolean(&out->incognito))
+ return false;
+ }
+
+ return true;
+}
+
+scoped_ptr<DictionaryValue> Window::ToValue() const {
+ scoped_ptr<DictionaryValue> value(new DictionaryValue());
+
+ if (tabs.get())
+ json_schema_compiler::util::PopulateDictionaryFromOptionalArray(tabs, "tabs", value.get());
+ value->SetWithoutPathExpansion("top", Value::CreateIntegerValue(top));
+ value->SetWithoutPathExpansion("height", Value::CreateIntegerValue(height));
+ value->SetWithoutPathExpansion("width", Value::CreateIntegerValue(width));
+ value->SetWithoutPathExpansion("state", Value::CreateStringValue(state));
+ value->SetWithoutPathExpansion("focused", Value::CreateBooleanValue(focused));
+ value->SetWithoutPathExpansion("left", Value::CreateIntegerValue(left));
+ value->SetWithoutPathExpansion("type", Value::CreateStringValue(type));
+ value->SetWithoutPathExpansion("id", Value::CreateIntegerValue(id));
+ value->SetWithoutPathExpansion("incognito", Value::CreateBooleanValue(incognito));
+
+ return value.Pass();
+}
+
+
+//
+// Functions
+//
+
+Get::Params::GetInfo::GetInfo() {}
+Get::Params::GetInfo::~GetInfo() {}
+
+// static
+bool Get::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* populate_value = NULL;
+ if (dict->GetWithoutPathExpansion("populate", &populate_value)) {
+ {
+ if (!populate_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (populate_value->GetAsBoolean(&temp))
+ out->populate.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Get::Params::Params() {}
+Get::Params::~Params() {}
+
+// static
+scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 1 || args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* window_id_value = NULL;
+ if (!args.Get(0, &window_id_value) || window_id_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ if (!window_id_value->GetAsInteger(&params->window_id))
+ return scoped_ptr<Params>();
+ }
+
+ Value* get_info_value = NULL;
+ if (!args.Get(1, &get_info_value) || get_info_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!get_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!get_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<GetInfo> temp(new GetInfo());
+ if (!GetInfo::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->get_info = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Get::Result::Create(const Window& window) {
+ return window.ToValue().release();
+}
+
+GetCurrent::Params::GetInfo::GetInfo() {}
+GetCurrent::Params::GetInfo::~GetInfo() {}
+
+// static
+bool GetCurrent::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* populate_value = NULL;
+ if (dict->GetWithoutPathExpansion("populate", &populate_value)) {
+ {
+ if (!populate_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (populate_value->GetAsBoolean(&temp))
+ out->populate.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+GetCurrent::Params::Params() {}
+GetCurrent::Params::~Params() {}
+
+// static
+scoped_ptr<GetCurrent::Params> GetCurrent::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* get_info_value = NULL;
+ if (!args.Get(0, &get_info_value) || get_info_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!get_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!get_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<GetInfo> temp(new GetInfo());
+ if (!GetInfo::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->get_info = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* GetCurrent::Result::Create(const Window& window) {
+ return window.ToValue().release();
+}
+
+Create::Params::CreateData::CreateData() {}
+Create::Params::CreateData::~CreateData() {}
+
+// static
+bool Create::Params::CreateData::Populate(const Value& value, CreateData* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* tab_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("tabId", &tab_id_value)) {
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ out->tab_id.reset(new int(temp));
+ }
+ }
+
+ Value* url_value = NULL;
+ if (dict->GetWithoutPathExpansion("url", &url_value)) {
+ {
+ if (!url_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (url_value->GetAsString(&temp))
+ out->url.reset(new std::string(temp));
+ }
+ }
+
+ Value* top_value = NULL;
+ if (dict->GetWithoutPathExpansion("top", &top_value)) {
+ {
+ if (!top_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (top_value->GetAsInteger(&temp))
+ out->top.reset(new int(temp));
+ }
+ }
+
+ Value* height_value = NULL;
+ if (dict->GetWithoutPathExpansion("height", &height_value)) {
+ {
+ if (!height_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (height_value->GetAsInteger(&temp))
+ out->height.reset(new int(temp));
+ }
+ }
+
+ Value* width_value = NULL;
+ if (dict->GetWithoutPathExpansion("width", &width_value)) {
+ {
+ if (!width_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (width_value->GetAsInteger(&temp))
+ out->width.reset(new int(temp));
+ }
+ }
+
+ Value* focused_value = NULL;
+ if (dict->GetWithoutPathExpansion("focused", &focused_value)) {
+ {
+ if (!focused_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (focused_value->GetAsBoolean(&temp))
+ out->focused.reset(new bool(temp));
+ }
+ }
+
+ Value* left_value = NULL;
+ if (dict->GetWithoutPathExpansion("left", &left_value)) {
+ {
+ if (!left_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (left_value->GetAsInteger(&temp))
+ out->left.reset(new int(temp));
+ }
+ }
+
+ Value* type_value = NULL;
+ if (dict->GetWithoutPathExpansion("type", &type_value)) {
+ {
+ if (!type_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (type_value->GetAsString(&temp))
+ out->type.reset(new std::string(temp));
+ }
+ }
+
+ Value* incognito_value = NULL;
+ if (dict->GetWithoutPathExpansion("incognito", &incognito_value)) {
+ {
+ if (!incognito_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (incognito_value->GetAsBoolean(&temp))
+ out->incognito.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Create::Params::Params() {}
+Create::Params::~Params() {}
+
+// static
+scoped_ptr<Create::Params> Create::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* create_data_value = NULL;
+ if (!args.Get(0, &create_data_value) || create_data_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!create_data_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!create_data_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<CreateData> temp(new CreateData());
+ if (!CreateData::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->create_data = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Create::Result::Create(const Window& window) {
+ return window.ToValue().release();
+}
+
+GetAll::Params::GetInfo::GetInfo() {}
+GetAll::Params::GetInfo::~GetInfo() {}
+
+// static
+bool GetAll::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* populate_value = NULL;
+ if (dict->GetWithoutPathExpansion("populate", &populate_value)) {
+ {
+ if (!populate_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (populate_value->GetAsBoolean(&temp))
+ out->populate.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+GetAll::Params::Params() {}
+GetAll::Params::~Params() {}
+
+// static
+scoped_ptr<GetAll::Params> GetAll::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* get_info_value = NULL;
+ if (!args.Get(0, &get_info_value) || get_info_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!get_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!get_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<GetInfo> temp(new GetInfo());
+ if (!GetInfo::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->get_info = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* GetAll::Result::Create(const std::vector<linked_ptr<Window> >& windows) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::PopulateListFromArray(windows, value);
+ return value;
+}
+
+Update::Params::UpdateInfo::UpdateInfo() {}
+Update::Params::UpdateInfo::~UpdateInfo() {}
+
+// static
+bool Update::Params::UpdateInfo::Populate(const Value& value, UpdateInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* top_value = NULL;
+ if (dict->GetWithoutPathExpansion("top", &top_value)) {
+ {
+ if (!top_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (top_value->GetAsInteger(&temp))
+ out->top.reset(new int(temp));
+ }
+ }
+
+ Value* draw_attention_value = NULL;
+ if (dict->GetWithoutPathExpansion("drawAttention", &draw_attention_value)) {
+ {
+ if (!draw_attention_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (draw_attention_value->GetAsBoolean(&temp))
+ out->draw_attention.reset(new bool(temp));
+ }
+ }
+
+ Value* height_value = NULL;
+ if (dict->GetWithoutPathExpansion("height", &height_value)) {
+ {
+ if (!height_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (height_value->GetAsInteger(&temp))
+ out->height.reset(new int(temp));
+ }
+ }
+
+ Value* width_value = NULL;
+ if (dict->GetWithoutPathExpansion("width", &width_value)) {
+ {
+ if (!width_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (width_value->GetAsInteger(&temp))
+ out->width.reset(new int(temp));
+ }
+ }
+
+ Value* state_value = NULL;
+ if (dict->GetWithoutPathExpansion("state", &state_value)) {
+ {
+ if (!state_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (state_value->GetAsString(&temp))
+ out->state.reset(new std::string(temp));
+ }
+ }
+
+ Value* focused_value = NULL;
+ if (dict->GetWithoutPathExpansion("focused", &focused_value)) {
+ {
+ if (!focused_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (focused_value->GetAsBoolean(&temp))
+ out->focused.reset(new bool(temp));
+ }
+ }
+
+ Value* left_value = NULL;
+ if (dict->GetWithoutPathExpansion("left", &left_value)) {
+ {
+ if (!left_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (left_value->GetAsInteger(&temp))
+ out->left.reset(new int(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Update::Params::Params() {}
+Update::Params::~Params() {}
+
+// static
+scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) {
+ if (args.GetSize() != 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* window_id_value = NULL;
+ if (!args.Get(0, &window_id_value) || window_id_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ if (!window_id_value->GetAsInteger(&params->window_id))
+ return scoped_ptr<Params>();
+ }
+
+ Value* update_info_value = NULL;
+ if (!args.Get(1, &update_info_value) || update_info_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!update_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!update_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!UpdateInfo::Populate(*dictionary, &params->update_info))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Update::Result::Create(const Window& window) {
+ return window.ToValue().release();
+}
+
+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* window_id_value = NULL;
+ if (!args.Get(0, &window_id_value) || window_id_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ if (!window_id_value->GetAsInteger(&params->window_id))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Remove::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+GetLastFocused::Params::GetInfo::GetInfo() {}
+GetLastFocused::Params::GetInfo::~GetInfo() {}
+
+// static
+bool GetLastFocused::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* populate_value = NULL;
+ if (dict->GetWithoutPathExpansion("populate", &populate_value)) {
+ {
+ if (!populate_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (populate_value->GetAsBoolean(&temp))
+ out->populate.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+GetLastFocused::Params::Params() {}
+GetLastFocused::Params::~Params() {}
+
+// static
+scoped_ptr<GetLastFocused::Params> GetLastFocused::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* get_info_value = NULL;
+ if (!args.Get(0, &get_info_value) || get_info_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!get_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!get_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<GetInfo> temp(new GetInfo());
+ if (!GetInfo::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->get_info = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* GetLastFocused::Result::Create(const Window& window) {
+ return window.ToValue().release();
+}
+
+} // windows
+} // api
+} // extensions
« no previous file with comments | « generated_files_will_not_submit/windows.h ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698