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

Unified Diff: generated_files_will_not_submit/tabs.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/tabs.h ('k') | generated_files_will_not_submit/windows.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: generated_files_will_not_submit/tabs.cc
diff --git a/generated_files_will_not_submit/tabs.cc b/generated_files_will_not_submit/tabs.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4a75885f7ea73be624afe820714cda5780210be4
--- /dev/null
+++ b/generated_files_will_not_submit/tabs.cc
@@ -0,0 +1,1258 @@
+// 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/tabs.json
+// DO NOT EDIT.
+
+#include "tools/json_schema_compiler/util.h"
+#include "chrome/common/extensions/api/tabs.h"
+#include "chrome/common/extensions/api/windows.h"
+
+
+using base::Value;
+using base::DictionaryValue;
+using base::ListValue;
+
+namespace extensions {
+namespace api {
+namespace tabs {
+
+//
+// Types
+//
+
+Tab::Tab() {}
+Tab::~Tab() {}
+
+// static
+bool Tab::Populate(const Value& value, Tab* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* status_value = NULL;
+ if (dict->GetWithoutPathExpansion("status", &status_value)) {
+ {
+ if (!status_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (status_value->GetAsString(&temp))
+ out->status.reset(new std::string(temp));
+ }
+ }
+
+ Value* index_value = NULL;
+ if (!dict->GetWithoutPathExpansion("index", &index_value))
+ return false;
+ {
+ if (!index_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!index_value->GetAsInteger(&out->index))
+ return false;
+ }
+
+ Value* opener_tab_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("openerTabId", &opener_tab_id_value)) {
+ {
+ if (!opener_tab_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (opener_tab_id_value->GetAsInteger(&temp))
+ out->opener_tab_id.reset(new int(temp));
+ }
+ }
+
+ Value* pinned_value = NULL;
+ if (!dict->GetWithoutPathExpansion("pinned", &pinned_value))
+ return false;
+ {
+ if (!pinned_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!pinned_value->GetAsBoolean(&out->pinned))
+ return false;
+ }
+
+ Value* title_value = NULL;
+ if (dict->GetWithoutPathExpansion("title", &title_value)) {
+ {
+ if (!title_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (title_value->GetAsString(&temp))
+ out->title.reset(new std::string(temp));
+ }
+ }
+
+ Value* url_value = NULL;
+ if (!dict->GetWithoutPathExpansion("url", &url_value))
+ return false;
+ {
+ if (!url_value->IsType(Value::TYPE_STRING))
+ return false;
+ if (!url_value->GetAsString(&out->url))
+ return false;
+ }
+
+ Value* selected_value = NULL;
+ if (!dict->GetWithoutPathExpansion("selected", &selected_value))
+ return false;
+ {
+ if (!selected_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!selected_value->GetAsBoolean(&out->selected))
+ return false;
+ }
+
+ Value* highlighted_value = NULL;
+ if (!dict->GetWithoutPathExpansion("highlighted", &highlighted_value))
+ return false;
+ {
+ if (!highlighted_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!highlighted_value->GetAsBoolean(&out->highlighted))
+ return false;
+ }
+
+ Value* window_id_value = NULL;
+ if (!dict->GetWithoutPathExpansion("windowId", &window_id_value))
+ return false;
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!window_id_value->GetAsInteger(&out->window_id))
+ return false;
+ }
+
+ Value* active_value = NULL;
+ if (!dict->GetWithoutPathExpansion("active", &active_value))
+ return false;
+ {
+ if (!active_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ if (!active_value->GetAsBoolean(&out->active))
+ return false;
+ }
+
+ Value* fav_icon_url_value = NULL;
+ if (dict->GetWithoutPathExpansion("favIconUrl", &fav_icon_url_value)) {
+ {
+ if (!fav_icon_url_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (fav_icon_url_value->GetAsString(&temp))
+ out->fav_icon_url.reset(new std::string(temp));
+ }
+ }
+
+ 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> Tab::ToValue() const {
+ scoped_ptr<DictionaryValue> value(new DictionaryValue());
+
+ if (status.get())
+ value->SetWithoutPathExpansion("status", Value::CreateStringValue(*status));
+ value->SetWithoutPathExpansion("index", Value::CreateIntegerValue(index));
+ if (opener_tab_id.get())
+ value->SetWithoutPathExpansion("openerTabId", Value::CreateIntegerValue(*opener_tab_id));
+ value->SetWithoutPathExpansion("pinned", Value::CreateBooleanValue(pinned));
+ if (title.get())
+ value->SetWithoutPathExpansion("title", Value::CreateStringValue(*title));
+ value->SetWithoutPathExpansion("url", Value::CreateStringValue(url));
+ value->SetWithoutPathExpansion("selected", Value::CreateBooleanValue(selected));
+ value->SetWithoutPathExpansion("highlighted", Value::CreateBooleanValue(highlighted));
+ value->SetWithoutPathExpansion("windowId", Value::CreateIntegerValue(window_id));
+ value->SetWithoutPathExpansion("active", Value::CreateBooleanValue(active));
+ if (fav_icon_url.get())
+ value->SetWithoutPathExpansion("favIconUrl", Value::CreateStringValue(*fav_icon_url));
+ value->SetWithoutPathExpansion("id", Value::CreateIntegerValue(id));
+ value->SetWithoutPathExpansion("incognito", Value::CreateBooleanValue(incognito));
+
+ return value.Pass();
+}
+
+
+//
+// Functions
+//
+
+ExecuteScript::Params::Details::Details() {}
+ExecuteScript::Params::Details::~Details() {}
+
+// static
+bool ExecuteScript::Params::Details::Populate(const Value& value, Details* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* all_frames_value = NULL;
+ if (dict->GetWithoutPathExpansion("allFrames", &all_frames_value)) {
+ {
+ if (!all_frames_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (all_frames_value->GetAsBoolean(&temp))
+ out->all_frames.reset(new bool(temp));
+ }
+ }
+
+ Value* code_value = NULL;
+ if (dict->GetWithoutPathExpansion("code", &code_value)) {
+ {
+ if (!code_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (code_value->GetAsString(&temp))
+ out->code.reset(new std::string(temp));
+ }
+ }
+
+ Value* file_value = NULL;
+ if (dict->GetWithoutPathExpansion("file", &file_value)) {
+ {
+ if (!file_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (file_value->GetAsString(&temp))
+ out->file.reset(new std::string(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+ExecuteScript::Params::Params() {}
+ExecuteScript::Params::~Params() {}
+
+// static
+scoped_ptr<ExecuteScript::Params> ExecuteScript::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 1 || args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ params->tab_id.reset(new int(temp));
+ }
+
+ Value* details_value = NULL;
+ if (!args.Get(1, &details_value) || details_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!details_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!details_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!Details::Populate(*dictionary, &params->details))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* ExecuteScript::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+Get::Params::Params() {}
+Get::Params::~Params() {}
+
+// static
+scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) {
+ if (args.GetSize() != 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ if (!tab_id_value->GetAsInteger(&params->tab_id))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Get::Result::Create(const Tab& tab) {
+ return tab.ToValue().release();
+}
+
+Value* GetCurrent::Result::Create(const Tab& tab) {
+ return tab.ToValue().release();
+}
+
+Create::Params::CreateProperties::CreateProperties() {}
+Create::Params::CreateProperties::~CreateProperties() {}
+
+// static
+bool Create::Params::CreateProperties::Populate(const Value& value, CreateProperties* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* index_value = NULL;
+ if (dict->GetWithoutPathExpansion("index", &index_value)) {
+ {
+ if (!index_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (index_value->GetAsInteger(&temp))
+ out->index.reset(new int(temp));
+ }
+ }
+
+ Value* opener_tab_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("openerTabId", &opener_tab_id_value)) {
+ {
+ if (!opener_tab_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (opener_tab_id_value->GetAsInteger(&temp))
+ out->opener_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* selected_value = NULL;
+ if (dict->GetWithoutPathExpansion("selected", &selected_value)) {
+ {
+ if (!selected_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (selected_value->GetAsBoolean(&temp))
+ out->selected.reset(new bool(temp));
+ }
+ }
+
+ Value* pinned_value = NULL;
+ if (dict->GetWithoutPathExpansion("pinned", &pinned_value)) {
+ {
+ if (!pinned_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (pinned_value->GetAsBoolean(&temp))
+ out->pinned.reset(new bool(temp));
+ }
+ }
+
+ Value* window_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("windowId", &window_id_value)) {
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ out->window_id.reset(new int(temp));
+ }
+ }
+
+ Value* active_value = NULL;
+ if (dict->GetWithoutPathExpansion("active", &active_value)) {
+ {
+ if (!active_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (active_value->GetAsBoolean(&temp))
+ out->active.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_properties_value = NULL;
+ if (!args.Get(0, &create_properties_value) || create_properties_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!create_properties_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!create_properties_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!CreateProperties::Populate(*dictionary, &params->create_properties))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Create::Result::Create(const Tab& tab) {
+ return tab.ToValue().release();
+}
+
+Move::Params::MoveProperties::MoveProperties() {}
+Move::Params::MoveProperties::~MoveProperties() {}
+
+// static
+bool Move::Params::MoveProperties::Populate(const Value& value, MoveProperties* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* index_value = NULL;
+ if (!dict->GetWithoutPathExpansion("index", &index_value))
+ return false;
+ {
+ if (!index_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!index_value->GetAsInteger(&out->index))
+ return false;
+ }
+
+ Value* window_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("windowId", &window_id_value)) {
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ out->window_id.reset(new int(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Move::Params::Params() {}
+Move::Params::~Params() {}
+
+// static
+scoped_ptr<Move::Params> Move::Params::Create(const ListValue& args) {
+ if (args.GetSize() != 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_ids_value = NULL;
+ if (!args.Get(0, &tab_ids_value) || tab_ids_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ params->tab_ids_type = TAB_IDS_NONE;
+ switch (tab_ids_value->GetType()) {
+ case Value::TYPE_INTEGER: {
+ {
+ int temp;
+ if (tab_ids_value->GetAsInteger(&temp))
+ params->tab_ids_integer.reset(new int(temp));
+ }
+ params->tab_ids_type = TAB_IDS_INTEGER;
+ break;
+ }
+ case Value::TYPE_LIST: {
+ {
+ ListValue* list = NULL;
+ if (!tab_ids_value->GetAsList(&list))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &params->tab_ids_array))
+ return scoped_ptr<Params>();
+ }
+ params->tab_ids_type = TAB_IDS_ARRAY;
+ break;
+ }
+ default:
+ return scoped_ptr<Params>();
+ }
+
+ Value* move_properties_value = NULL;
+ if (!args.Get(1, &move_properties_value) || move_properties_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!move_properties_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!move_properties_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!MoveProperties::Populate(*dictionary, &params->move_properties))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Move::Result::Create(const Tab& tabs_ref) {
+ return tabs_ref.ToValue().release();
+}
+Value* Move::Result::Create(const std::vector<linked_ptr<Tab> >& tabs_array) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::PopulateListFromArray(tabs_array, value);
+ return value;
+}
+
+Update::Params::UpdateProperties::UpdateProperties() {}
+Update::Params::UpdateProperties::~UpdateProperties() {}
+
+// static
+bool Update::Params::UpdateProperties::Populate(const Value& value, UpdateProperties* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* highlighted_value = NULL;
+ if (dict->GetWithoutPathExpansion("highlighted", &highlighted_value)) {
+ {
+ if (!highlighted_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (highlighted_value->GetAsBoolean(&temp))
+ out->highlighted.reset(new bool(temp));
+ }
+ }
+
+ Value* opener_tab_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("openerTabId", &opener_tab_id_value)) {
+ {
+ if (!opener_tab_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (opener_tab_id_value->GetAsInteger(&temp))
+ out->opener_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* selected_value = NULL;
+ if (dict->GetWithoutPathExpansion("selected", &selected_value)) {
+ {
+ if (!selected_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (selected_value->GetAsBoolean(&temp))
+ out->selected.reset(new bool(temp));
+ }
+ }
+
+ Value* pinned_value = NULL;
+ if (dict->GetWithoutPathExpansion("pinned", &pinned_value)) {
+ {
+ if (!pinned_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (pinned_value->GetAsBoolean(&temp))
+ out->pinned.reset(new bool(temp));
+ }
+ }
+
+ Value* active_value = NULL;
+ if (dict->GetWithoutPathExpansion("active", &active_value)) {
+ {
+ if (!active_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (active_value->GetAsBoolean(&temp))
+ out->active.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Update::Params::Params() {}
+Update::Params::~Params() {}
+
+// static
+scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 1 || args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ params->tab_id.reset(new int(temp));
+ }
+
+ Value* update_properties_value = NULL;
+ if (!args.Get(1, &update_properties_value) || update_properties_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!update_properties_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!update_properties_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!UpdateProperties::Populate(*dictionary, &params->update_properties))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Update::Result::Create(const Tab& tab) {
+ return tab.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* tab_ids_value = NULL;
+ if (!args.Get(0, &tab_ids_value) || tab_ids_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ params->tab_ids_type = TAB_IDS_NONE;
+ switch (tab_ids_value->GetType()) {
+ case Value::TYPE_INTEGER: {
+ {
+ int temp;
+ if (tab_ids_value->GetAsInteger(&temp))
+ params->tab_ids_integer.reset(new int(temp));
+ }
+ params->tab_ids_type = TAB_IDS_INTEGER;
+ break;
+ }
+ case Value::TYPE_LIST: {
+ {
+ ListValue* list = NULL;
+ if (!tab_ids_value->GetAsList(&list))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &params->tab_ids_array))
+ return scoped_ptr<Params>();
+ }
+ params->tab_ids_type = TAB_IDS_ARRAY;
+ break;
+ }
+ default:
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Remove::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+CaptureVisibleTab::Params::Options::Options() {}
+CaptureVisibleTab::Params::Options::~Options() {}
+
+// static
+bool CaptureVisibleTab::Params::Options::Populate(const Value& value, Options* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* quality_value = NULL;
+ if (dict->GetWithoutPathExpansion("quality", &quality_value)) {
+ {
+ if (!quality_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (quality_value->GetAsInteger(&temp))
+ out->quality.reset(new int(temp));
+ }
+ }
+
+ Value* format_value = NULL;
+ if (dict->GetWithoutPathExpansion("format", &format_value)) {
+ {
+ if (!format_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (format_value->GetAsString(&temp))
+ out->format.reset(new std::string(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+CaptureVisibleTab::Params::Params() {}
+CaptureVisibleTab::Params::~Params() {}
+
+// static
+scoped_ptr<CaptureVisibleTab::Params> CaptureVisibleTab::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 params.Pass();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ params->window_id.reset(new int(temp));
+ }
+
+ Value* options_value = NULL;
+ if (!args.Get(1, &options_value) || options_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!options_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!options_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<Options> temp(new Options());
+ if (!Options::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->options = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* CaptureVisibleTab::Result::Create(const std::string data_url) {
+ return Value::CreateStringValue(data_url);
+}
+
+Reload::Params::ReloadProperties::ReloadProperties() {}
+Reload::Params::ReloadProperties::~ReloadProperties() {}
+
+// static
+bool Reload::Params::ReloadProperties::Populate(const Value& value, ReloadProperties* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* bypass_cache_value = NULL;
+ if (dict->GetWithoutPathExpansion("bypassCache", &bypass_cache_value)) {
+ {
+ if (!bypass_cache_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (bypass_cache_value->GetAsBoolean(&temp))
+ out->bypass_cache.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Reload::Params::Params() {}
+Reload::Params::~Params() {}
+
+// static
+scoped_ptr<Reload::Params> Reload::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ params->tab_id.reset(new int(temp));
+ }
+
+ Value* reload_properties_value = NULL;
+ if (!args.Get(1, &reload_properties_value) || reload_properties_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!reload_properties_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!reload_properties_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ scoped_ptr<ReloadProperties> temp(new ReloadProperties());
+ if (!ReloadProperties::Populate(*dictionary, temp.get()))
+ return scoped_ptr<Params>();
+ params->reload_properties = temp.Pass();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Reload::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+DetectLanguage::Params::Params() {}
+DetectLanguage::Params::~Params() {}
+
+// static
+scoped_ptr<DetectLanguage::Params> DetectLanguage::Params::Create(const ListValue& args) {
+ if (args.GetSize() > 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ params->tab_id.reset(new int(temp));
+ }
+
+ return params.Pass();
+}
+
+
+Value* DetectLanguage::Result::Create(const std::string language) {
+ return Value::CreateStringValue(language);
+}
+
+InsertCSS::Params::Details::Details() {}
+InsertCSS::Params::Details::~Details() {}
+
+// static
+bool InsertCSS::Params::Details::Populate(const Value& value, Details* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* all_frames_value = NULL;
+ if (dict->GetWithoutPathExpansion("allFrames", &all_frames_value)) {
+ {
+ if (!all_frames_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (all_frames_value->GetAsBoolean(&temp))
+ out->all_frames.reset(new bool(temp));
+ }
+ }
+
+ Value* code_value = NULL;
+ if (dict->GetWithoutPathExpansion("code", &code_value)) {
+ {
+ if (!code_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (code_value->GetAsString(&temp))
+ out->code.reset(new std::string(temp));
+ }
+ }
+
+ Value* file_value = NULL;
+ if (dict->GetWithoutPathExpansion("file", &file_value)) {
+ {
+ if (!file_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (file_value->GetAsString(&temp))
+ out->file.reset(new std::string(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+InsertCSS::Params::Params() {}
+InsertCSS::Params::~Params() {}
+
+// static
+scoped_ptr<InsertCSS::Params> InsertCSS::Params::Create(const ListValue& args) {
+ if (args.GetSize() < 1 || args.GetSize() > 2)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* tab_id_value = NULL;
+ if (!args.Get(0, &tab_id_value) || tab_id_value->IsType(Value::TYPE_NULL))
+ return params.Pass();
+ {
+ if (!tab_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (tab_id_value->GetAsInteger(&temp))
+ params->tab_id.reset(new int(temp));
+ }
+
+ Value* details_value = NULL;
+ if (!args.Get(1, &details_value) || details_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!details_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!details_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!Details::Populate(*dictionary, &params->details))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* InsertCSS::Result::Create() {
+ return Value::CreateNullValue();
+}
+
+Highlight::Params::HighlightInfo::HighlightInfo() {}
+Highlight::Params::HighlightInfo::~HighlightInfo() {}
+
+// static
+bool Highlight::Params::HighlightInfo::Populate(const Value& value, HighlightInfo* 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))
+ return false;
+ out->tabs_type = TABS_NONE;
+ switch (tabs_value->GetType()) {
+ case Value::TYPE_LIST: {
+ {
+ ListValue* list = NULL;
+ if (!tabs_value->GetAsList(&list))
+ return false;
+ if (!json_schema_compiler::util::PopulateOptionalArrayFromList(*list, &out->tabs_array))
+ return false;
+ }
+ out->tabs_type = TABS_ARRAY;
+ break;
+ }
+ case Value::TYPE_INTEGER: {
+ {
+ int temp;
+ if (tabs_value->GetAsInteger(&temp))
+ out->tabs_integer.reset(new int(temp));
+ }
+ out->tabs_type = TABS_INTEGER;
+ break;
+ }
+ default:
+ return false;
+ }
+
+ Value* window_id_value = NULL;
+ if (!dict->GetWithoutPathExpansion("windowId", &window_id_value))
+ return false;
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ if (!window_id_value->GetAsInteger(&out->window_id))
+ return false;
+ }
+
+ return true;
+}
+
+
+
+Highlight::Params::Params() {}
+Highlight::Params::~Params() {}
+
+// static
+scoped_ptr<Highlight::Params> Highlight::Params::Create(const ListValue& args) {
+ if (args.GetSize() != 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* highlight_info_value = NULL;
+ if (!args.Get(0, &highlight_info_value) || highlight_info_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!highlight_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!highlight_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!HighlightInfo::Populate(*dictionary, &params->highlight_info))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Highlight::Result::Create(const windows::Window& window) {
+ return window.ToValue().release();
+}
+
+Query::Params::QueryInfo::QueryInfo() {}
+Query::Params::QueryInfo::~QueryInfo() {}
+
+// static
+bool Query::Params::QueryInfo::Populate(const Value& value, QueryInfo* out) {
+ if (!value.IsType(Value::TYPE_DICTIONARY))
+ return false;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
+
+ Value* status_value = NULL;
+ if (dict->GetWithoutPathExpansion("status", &status_value)) {
+ {
+ if (!status_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (status_value->GetAsString(&temp))
+ out->status.reset(new std::string(temp));
+ }
+ }
+
+ Value* pinned_value = NULL;
+ if (dict->GetWithoutPathExpansion("pinned", &pinned_value)) {
+ {
+ if (!pinned_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (pinned_value->GetAsBoolean(&temp))
+ out->pinned.reset(new bool(temp));
+ }
+ }
+
+ Value* index_value = NULL;
+ if (dict->GetWithoutPathExpansion("index", &index_value)) {
+ {
+ if (!index_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (index_value->GetAsInteger(&temp))
+ out->index.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* title_value = NULL;
+ if (dict->GetWithoutPathExpansion("title", &title_value)) {
+ {
+ if (!title_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (title_value->GetAsString(&temp))
+ out->title.reset(new std::string(temp));
+ }
+ }
+
+ Value* highlighted_value = NULL;
+ if (dict->GetWithoutPathExpansion("highlighted", &highlighted_value)) {
+ {
+ if (!highlighted_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (highlighted_value->GetAsBoolean(&temp))
+ out->highlighted.reset(new bool(temp));
+ }
+ }
+
+ Value* window_id_value = NULL;
+ if (dict->GetWithoutPathExpansion("windowId", &window_id_value)) {
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return false;
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ out->window_id.reset(new int(temp));
+ }
+ }
+
+ Value* window_type_value = NULL;
+ if (dict->GetWithoutPathExpansion("windowType", &window_type_value)) {
+ {
+ if (!window_type_value->IsType(Value::TYPE_STRING))
+ return false;
+ std::string temp;
+ if (window_type_value->GetAsString(&temp))
+ out->window_type.reset(new std::string(temp));
+ }
+ }
+
+ Value* active_value = NULL;
+ if (dict->GetWithoutPathExpansion("active", &active_value)) {
+ {
+ if (!active_value->IsType(Value::TYPE_BOOLEAN))
+ return false;
+ bool temp;
+ if (active_value->GetAsBoolean(&temp))
+ out->active.reset(new bool(temp));
+ }
+ }
+
+ return true;
+}
+
+
+
+Query::Params::Params() {}
+Query::Params::~Params() {}
+
+// static
+scoped_ptr<Query::Params> Query::Params::Create(const ListValue& args) {
+ if (args.GetSize() != 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ Value* query_info_value = NULL;
+ if (!args.Get(0, &query_info_value) || query_info_value->IsType(Value::TYPE_NULL))
+ return scoped_ptr<Params>();
+ {
+ if (!query_info_value->IsType(Value::TYPE_DICTIONARY))
+ return scoped_ptr<Params>();
+ DictionaryValue* dictionary = NULL;
+ if (!query_info_value->GetAsDictionary(&dictionary))
+ return scoped_ptr<Params>();
+ if (!QueryInfo::Populate(*dictionary, &params->query_info))
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+
+Value* Query::Result::Create(const std::vector<linked_ptr<Tab> >& result) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::PopulateListFromArray(result, value);
+ return value;
+}
+
+GetSelected::Params::Params() {}
+GetSelected::Params::~Params() {}
+
+// static
+scoped_ptr<GetSelected::Params> GetSelected::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 params.Pass();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ params->window_id.reset(new int(temp));
+ }
+
+ return params.Pass();
+}
+
+
+Value* GetSelected::Result::Create(const Tab& tab) {
+ return tab.ToValue().release();
+}
+
+GetAllInWindow::Params::Params() {}
+GetAllInWindow::Params::~Params() {}
+
+// static
+scoped_ptr<GetAllInWindow::Params> GetAllInWindow::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 params.Pass();
+ {
+ if (!window_id_value->IsType(Value::TYPE_INTEGER))
+ return scoped_ptr<Params>();
+ int temp;
+ if (window_id_value->GetAsInteger(&temp))
+ params->window_id.reset(new int(temp));
+ }
+
+ return params.Pass();
+}
+
+
+Value* GetAllInWindow::Result::Create(const std::vector<linked_ptr<Tab> >& tabs) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::PopulateListFromArray(tabs, value);
+ return value;
+}
+
+} // tabs
+} // api
+} // extensions
« no previous file with comments | « generated_files_will_not_submit/tabs.h ('k') | generated_files_will_not_submit/windows.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698