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

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: 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/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..4a8a92952917f6d27d5ac50b23ed660cf77020b2
--- /dev/null
+++ b/generated_files_will_not_submit/windows.cc
@@ -0,0 +1,437 @@
+// 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"
+
+
+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);
+
+ if (!json_schema_compiler::util::GetOptionalArrayFromDictionary(*dict, "tabs", &out->tabs))
+ return false;
+ if (!dict->GetInteger("top", &out->top))
+ return false;
+ if (!dict->GetInteger("height", &out->height))
+ return false;
+ if (!dict->GetInteger("width", &out->width))
+ return false;
+ if (!dict->GetString("state", &out->state))
+ return false;
+ if (!dict->GetBoolean("focused", &out->focused))
+ return false;
+ if (!dict->GetInteger("left", &out->left))
+ return false;
+ if (!dict->GetString("type", &out->type))
+ return false;
+ if (!dict->GetInteger("id", &out->id))
+ return false;
+ if (!dict->GetBoolean("incognito", &out->incognito))
+ return false;
+ return true;
+}
+
+DictionaryValue* Window::ToValue() const {
+ DictionaryValue* value = new DictionaryValue();
+
+ if (tabs.get())
+ json_schema_compiler::util::SetOptionalArrayToDictionary(tabs, "tabs", value);
+ 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;
+}
+
+
+//
+// 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);
+
+ {
+ bool populate_temp;
+ if (dict->GetBoolean("populate", &populate_temp))
+ out->populate.reset(new bool(populate_temp));
+ }
+ return true;
+}
+
+
+
+Get::Params::Params() {}
+Get::Params::~Params() {}
+
+// static
+scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ if (args.GetSize() < 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ if (!args.GetInteger(0, &params->window_id))
+ return scoped_ptr<Params>();
+
+ DictionaryValue* get_info_param = NULL;
+ if (!args.GetDictionary(1, &get_info_param))
+ return params.Pass();
+ params->get_info.reset(new GetInfo());
+ if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* Get::Result::Create(const Window& window) {
+ return window.ToValue();
+}
+
+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);
+
+ {
+ bool populate_temp;
+ if (dict->GetBoolean("populate", &populate_temp))
+ out->populate.reset(new bool(populate_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());
+
+ DictionaryValue* get_info_param = NULL;
+ if (!args.GetDictionary(0, &get_info_param))
+ return params.Pass();
+ params->get_info.reset(new GetInfo());
+ if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* GetCurrent::Result::Create(const Window& window) {
+ return window.ToValue();
+}
+
+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);
+
+ {
+ int tab_id_temp;
+ if (dict->GetInteger("tabId", &tab_id_temp))
+ out->tab_id.reset(new int(tab_id_temp));
+ }
+ {
+ std::string url_temp;
+ if (dict->GetString("url", &url_temp))
+ out->url.reset(new std::string(url_temp));
+ }
+ {
+ int top_temp;
+ if (dict->GetInteger("top", &top_temp))
+ out->top.reset(new int(top_temp));
+ }
+ {
+ int height_temp;
+ if (dict->GetInteger("height", &height_temp))
+ out->height.reset(new int(height_temp));
+ }
+ {
+ int width_temp;
+ if (dict->GetInteger("width", &width_temp))
+ out->width.reset(new int(width_temp));
+ }
+ {
+ bool focused_temp;
+ if (dict->GetBoolean("focused", &focused_temp))
+ out->focused.reset(new bool(focused_temp));
+ }
+ {
+ int left_temp;
+ if (dict->GetInteger("left", &left_temp))
+ out->left.reset(new int(left_temp));
+ }
+ {
+ std::string type_temp;
+ if (dict->GetString("type", &type_temp))
+ out->type.reset(new std::string(type_temp));
+ }
+ {
+ bool incognito_temp;
+ if (dict->GetBoolean("incognito", &incognito_temp))
+ out->incognito.reset(new bool(incognito_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());
+
+ DictionaryValue* create_data_param = NULL;
+ if (!args.GetDictionary(0, &create_data_param))
+ return params.Pass();
+ params->create_data.reset(new CreateData());
+ if (!CreateData::Populate(*create_data_param, params->create_data.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+// Contains details about the created window.
+Value* Create::Result::Create(const scoped_ptr<Window>& window) {
+ return window->ToValue();
+}
+
+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);
+
+ {
+ bool populate_temp;
+ if (dict->GetBoolean("populate", &populate_temp))
+ out->populate.reset(new bool(populate_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());
+
+ DictionaryValue* get_info_param = NULL;
+ if (!args.GetDictionary(0, &get_info_param))
+ return params.Pass();
+ params->get_info.reset(new GetInfo());
+ if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* GetAll::Result::Create(const std::vector<linked_ptr<Window> > windows) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetArrayToList(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);
+
+ {
+ int top_temp;
+ if (dict->GetInteger("top", &top_temp))
+ out->top.reset(new int(top_temp));
+ }
+ {
+ bool draw_attention_temp;
+ if (dict->GetBoolean("drawAttention", &draw_attention_temp))
+ out->draw_attention.reset(new bool(draw_attention_temp));
+ }
+ {
+ int height_temp;
+ if (dict->GetInteger("height", &height_temp))
+ out->height.reset(new int(height_temp));
+ }
+ {
+ int width_temp;
+ if (dict->GetInteger("width", &width_temp))
+ out->width.reset(new int(width_temp));
+ }
+ {
+ std::string state_temp;
+ if (dict->GetString("state", &state_temp))
+ out->state.reset(new std::string(state_temp));
+ }
+ {
+ bool focused_temp;
+ if (dict->GetBoolean("focused", &focused_temp))
+ out->focused.reset(new bool(focused_temp));
+ }
+ {
+ int left_temp;
+ if (dict->GetInteger("left", &left_temp))
+ out->left.reset(new int(left_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());
+
+ if (!args.GetInteger(0, &params->window_id))
+ return scoped_ptr<Params>();
+
+ DictionaryValue* update_info_param = NULL;
+ if (!args.GetDictionary(1, &update_info_param))
+ return scoped_ptr<Params>();
+ if (!UpdateInfo::Populate(*update_info_param, &params->update_info))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+Value* Update::Result::Create(const Window& window) {
+ return window.ToValue();
+}
+
+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());
+
+ if (!args.GetInteger(0, &params->window_id))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+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);
+
+ {
+ bool populate_temp;
+ if (dict->GetBoolean("populate", &populate_temp))
+ out->populate.reset(new bool(populate_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());
+
+ DictionaryValue* get_info_param = NULL;
+ if (!args.GetDictionary(0, &get_info_param))
+ return params.Pass();
+ params->get_info.reset(new GetInfo());
+ if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* GetLastFocused::Result::Create(const Window& window) {
+ return window.ToValue();
+}
+
+} // windows
+} // api
+} // extensions

Powered by Google App Engine
This is Rietveld 408576698