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

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: 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/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..07f942b30be8fe9f31b367bac192a522be93fb8b
--- /dev/null
+++ b/generated_files_will_not_submit/tabs.cc
@@ -0,0 +1,796 @@
+// 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"
+
+
+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);
+
+ {
+ std::string status_temp;
+ if (dict->GetString("status", &status_temp))
+ out->status.reset(new std::string(status_temp));
+ }
+ if (!dict->GetInteger("index", &out->index))
+ return false;
+ {
+ int opener_tab_id_temp;
+ if (dict->GetInteger("openerTabId", &opener_tab_id_temp))
+ out->opener_tab_id.reset(new int(opener_tab_id_temp));
+ }
+ if (!dict->GetBoolean("pinned", &out->pinned))
+ return false;
+ {
+ std::string title_temp;
+ if (dict->GetString("title", &title_temp))
+ out->title.reset(new std::string(title_temp));
+ }
+ if (!dict->GetString("url", &out->url))
+ return false;
+ if (!dict->GetBoolean("selected", &out->selected))
+ return false;
+ if (!dict->GetBoolean("highlighted", &out->highlighted))
+ return false;
+ if (!dict->GetInteger("windowId", &out->window_id))
+ return false;
+ if (!dict->GetBoolean("active", &out->active))
+ return false;
+ {
+ std::string fav_icon_url_temp;
+ if (dict->GetString("favIconUrl", &fav_icon_url_temp))
+ out->fav_icon_url.reset(new std::string(fav_icon_url_temp));
+ }
+ if (!dict->GetInteger("id", &out->id))
+ return false;
+ if (!dict->GetBoolean("incognito", &out->incognito))
+ return false;
+ return true;
+}
+
+DictionaryValue* Tab::ToValue() const {
+ 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;
+}
+
+
+//
+// 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);
+
+ {
+ bool all_frames_temp;
+ if (dict->GetBoolean("allFrames", &all_frames_temp))
+ out->all_frames.reset(new bool(all_frames_temp));
+ }
+ {
+ std::string code_temp;
+ if (dict->GetString("code", &code_temp))
+ out->code.reset(new std::string(code_temp));
+ }
+ {
+ std::string file_temp;
+ if (dict->GetString("file", &file_temp))
+ out->file.reset(new std::string(file_temp));
+ }
+ return true;
+}
+
+
+
+ExecuteScript::Params::Params() {}
+ExecuteScript::Params::~Params() {}
+
+// static
+scoped_ptr<ExecuteScript::Params> ExecuteScript::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->tab_id.get()))
+ return params.Pass();
+
+ DictionaryValue* details_param = NULL;
+ if (!args.GetDictionary(1, &details_param))
+ return scoped_ptr<Params>();
+ if (!Details::Populate(*details_param, &params->details))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+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());
+
+ if (!args.GetInteger(0, &params->tab_id))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+Value* Get::Result::Create(const Tab& tab) {
+ return tab.ToValue();
+}
+
+// static
+Value* GetCurrent::Result::Create(const scoped_ptr<Tab>& tab) {
+ return tab->ToValue();
+}
+
+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);
+
+ {
+ int index_temp;
+ if (dict->GetInteger("index", &index_temp))
+ out->index.reset(new int(index_temp));
+ }
+ {
+ int opener_tab_id_temp;
+ if (dict->GetInteger("openerTabId", &opener_tab_id_temp))
+ out->opener_tab_id.reset(new int(opener_tab_id_temp));
+ }
+ {
+ std::string url_temp;
+ if (dict->GetString("url", &url_temp))
+ out->url.reset(new std::string(url_temp));
+ }
+ {
+ bool selected_temp;
+ if (dict->GetBoolean("selected", &selected_temp))
+ out->selected.reset(new bool(selected_temp));
+ }
+ {
+ bool pinned_temp;
+ if (dict->GetBoolean("pinned", &pinned_temp))
+ out->pinned.reset(new bool(pinned_temp));
+ }
+ {
+ int window_id_temp;
+ if (dict->GetInteger("windowId", &window_id_temp))
+ out->window_id.reset(new int(window_id_temp));
+ }
+ {
+ bool active_temp;
+ if (dict->GetBoolean("active", &active_temp))
+ out->active.reset(new bool(active_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_properties_param = NULL;
+ if (!args.GetDictionary(0, &create_properties_param))
+ return scoped_ptr<Params>();
+ if (!CreateProperties::Populate(*create_properties_param, &params->create_properties))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+// Details about the created tab. Will contain the ID of the new tab.
+Value* Create::Result::Create(const Tab& tab) {
+ return tab.ToValue();
+}
+
+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);
+
+ if (!dict->GetInteger("index", &out->index))
+ return false;
+ {
+ int window_id_temp;
+ if (dict->GetInteger("windowId", &window_id_temp))
+ out->window_id.reset(new int(window_id_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());
+
+ params->tab_ids_type = TAB_IDS_NONE;
+ Value* tab_ids_value = NULL;
+ if (!args.Get(0, &tab_ids_value))
+ return scoped_ptr<Params>();
+ switch (tab_ids_value->GetType()) {
+ case Value::TYPE_INTEGER: {
+ params->tab_ids_type = TAB_IDS_INTEGER;
+ tab_ids_value->GetAsInteger(params->tab_ids_integer.get());
+ break;
+ }
+ case Value::TYPE_LIST: {
+ params->tab_ids_type = TAB_IDS_ARRAY;
+ if (!json_schema_compiler::util::GetOptionalArrayFromList(*static_cast<ListValue*>(tab_ids_value), &params->tab_ids_array))
+ return scoped_ptr<Params>();
+ break;
+ }
+ default:
+ return scoped_ptr<Params>();
+ }
+
+ DictionaryValue* move_properties_param = NULL;
+ if (!args.GetDictionary(1, &move_properties_param))
+ return scoped_ptr<Params>();
+ if (!MoveProperties::Populate(*move_properties_param, &params->move_properties))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+Value* Move::Result::Create(const scoped_ptr<Tab>& tabs_ref) {
+ return tabs_ref->ToValue();
+}
+Value* Move::Result::Create(const scoped_ptr<std::vector<linked_ptr<Tab> > > tabs_array) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetOptionalArrayToList(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);
+
+ {
+ bool highlighted_temp;
+ if (dict->GetBoolean("highlighted", &highlighted_temp))
+ out->highlighted.reset(new bool(highlighted_temp));
+ }
+ {
+ int opener_tab_id_temp;
+ if (dict->GetInteger("openerTabId", &opener_tab_id_temp))
+ out->opener_tab_id.reset(new int(opener_tab_id_temp));
+ }
+ {
+ std::string url_temp;
+ if (dict->GetString("url", &url_temp))
+ out->url.reset(new std::string(url_temp));
+ }
+ {
+ bool selected_temp;
+ if (dict->GetBoolean("selected", &selected_temp))
+ out->selected.reset(new bool(selected_temp));
+ }
+ {
+ bool pinned_temp;
+ if (dict->GetBoolean("pinned", &pinned_temp))
+ out->pinned.reset(new bool(pinned_temp));
+ }
+ {
+ bool active_temp;
+ if (dict->GetBoolean("active", &active_temp))
+ out->active.reset(new bool(active_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>();
+ if (args.GetSize() < 1)
+ return scoped_ptr<Params>();
+ scoped_ptr<Params> params(new Params());
+
+ if (!args.GetInteger(0, params->tab_id.get()))
+ return params.Pass();
+
+ DictionaryValue* update_properties_param = NULL;
+ if (!args.GetDictionary(1, &update_properties_param))
+ return scoped_ptr<Params>();
+ if (!UpdateProperties::Populate(*update_properties_param, &params->update_properties))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+// Details about the updated tab, or <code>null</code> if the 'tabs' permission
+// has not been requested.
+Value* Update::Result::Create(const scoped_ptr<Tab>& tab) {
+ return tab->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());
+
+ params->tab_ids_type = TAB_IDS_NONE;
+ Value* tab_ids_value = NULL;
+ if (!args.Get(0, &tab_ids_value))
+ return scoped_ptr<Params>();
+ switch (tab_ids_value->GetType()) {
+ case Value::TYPE_INTEGER: {
+ params->tab_ids_type = TAB_IDS_INTEGER;
+ tab_ids_value->GetAsInteger(params->tab_ids_integer.get());
+ break;
+ }
+ case Value::TYPE_LIST: {
+ params->tab_ids_type = TAB_IDS_ARRAY;
+ if (!json_schema_compiler::util::GetOptionalArrayFromList(*static_cast<ListValue*>(tab_ids_value), &params->tab_ids_array))
+ return scoped_ptr<Params>();
+ break;
+ }
+ default:
+ return scoped_ptr<Params>();
+ }
+
+ return params.Pass();
+}
+
+// static
+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);
+
+ {
+ int quality_temp;
+ if (dict->GetInteger("quality", &quality_temp))
+ out->quality.reset(new int(quality_temp));
+ }
+ {
+ std::string format_temp;
+ if (dict->GetString("format", &format_temp))
+ out->format.reset(new std::string(format_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());
+
+ if (!args.GetInteger(0, params->window_id.get()))
+ return params.Pass();
+
+ DictionaryValue* options_param = NULL;
+ if (!args.GetDictionary(1, &options_param))
+ return params.Pass();
+ params->options.reset(new Options());
+ if (!Options::Populate(*options_param, params->options.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+// A data URL which encodes an image of the visible area of the captured tab.
+// May be assigned to the 'src' property of an HTML Image element for display.
+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);
+
+ {
+ bool bypass_cache_temp;
+ if (dict->GetBoolean("bypassCache", &bypass_cache_temp))
+ out->bypass_cache.reset(new bool(bypass_cache_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());
+
+ if (!args.GetInteger(0, params->tab_id.get()))
+ return params.Pass();
+
+ DictionaryValue* reload_properties_param = NULL;
+ if (!args.GetDictionary(1, &reload_properties_param))
+ return params.Pass();
+ params->reload_properties.reset(new ReloadProperties());
+ if (!ReloadProperties::Populate(*reload_properties_param, params->reload_properties.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+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());
+
+ if (!args.GetInteger(0, params->tab_id.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+// An ISO language code such as <code>en</code> or <code>fr</code>. For a
+// complete list of languages supported by this method, see <a
+// href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languag
+// es/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns
+// will be checked and the first non-NULL value will be returned except for
+// Simplified Chinese for which zh-CN will be returned. For an unknown
+// language, <code>und</code> will be returned.
+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);
+
+ {
+ bool all_frames_temp;
+ if (dict->GetBoolean("allFrames", &all_frames_temp))
+ out->all_frames.reset(new bool(all_frames_temp));
+ }
+ {
+ std::string code_temp;
+ if (dict->GetString("code", &code_temp))
+ out->code.reset(new std::string(code_temp));
+ }
+ {
+ std::string file_temp;
+ if (dict->GetString("file", &file_temp))
+ out->file.reset(new std::string(file_temp));
+ }
+ return true;
+}
+
+
+
+InsertCSS::Params::Params() {}
+InsertCSS::Params::~Params() {}
+
+// static
+scoped_ptr<InsertCSS::Params> InsertCSS::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->tab_id.get()))
+ return params.Pass();
+
+ DictionaryValue* details_param = NULL;
+ if (!args.GetDictionary(1, &details_param))
+ return scoped_ptr<Params>();
+ if (!Details::Populate(*details_param, &params->details))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+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);
+
+ if (!json_schema_compiler::util::GetOptionalArrayFromDictionary(*dict, "tabs", &out->tabs_array))
+ return false;
+ {
+ int tabs_integer_temp;
+ if (dict->GetInteger("tabs", &tabs_integer_temp)) {
+ out->tabs_integer.reset(new int(tabs_integer_temp));
+ out->tabs_type = TABS_INTEGER;
+ }
+ }
+ if (!dict->GetInteger("windowId", &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());
+
+ DictionaryValue* highlight_info_param = NULL;
+ if (!args.GetDictionary(0, &highlight_info_param))
+ return scoped_ptr<Params>();
+ if (!HighlightInfo::Populate(*highlight_info_param, &params->highlight_info))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+// Contains details about the window whose tabs were highlighted.
+Value* Highlight::Result::Create(const windows::Window& window) {
+ return window.ToValue();
+}
+
+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);
+
+ {
+ std::string status_temp;
+ if (dict->GetString("status", &status_temp))
+ out->status.reset(new std::string(status_temp));
+ }
+ {
+ bool pinned_temp;
+ if (dict->GetBoolean("pinned", &pinned_temp))
+ out->pinned.reset(new bool(pinned_temp));
+ }
+ {
+ int index_temp;
+ if (dict->GetInteger("index", &index_temp))
+ out->index.reset(new int(index_temp));
+ }
+ {
+ std::string url_temp;
+ if (dict->GetString("url", &url_temp))
+ out->url.reset(new std::string(url_temp));
+ }
+ {
+ std::string title_temp;
+ if (dict->GetString("title", &title_temp))
+ out->title.reset(new std::string(title_temp));
+ }
+ {
+ bool highlighted_temp;
+ if (dict->GetBoolean("highlighted", &highlighted_temp))
+ out->highlighted.reset(new bool(highlighted_temp));
+ }
+ {
+ int window_id_temp;
+ if (dict->GetInteger("windowId", &window_id_temp))
+ out->window_id.reset(new int(window_id_temp));
+ }
+ {
+ std::string window_type_temp;
+ if (dict->GetString("windowType", &window_type_temp))
+ out->window_type.reset(new std::string(window_type_temp));
+ }
+ {
+ bool active_temp;
+ if (dict->GetBoolean("active", &active_temp))
+ out->active.reset(new bool(active_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());
+
+ DictionaryValue* query_info_param = NULL;
+ if (!args.GetDictionary(0, &query_info_param))
+ return scoped_ptr<Params>();
+ if (!QueryInfo::Populate(*query_info_param, &params->query_info))
+ return scoped_ptr<Params>();
+
+ return params.Pass();
+}
+
+// static
+Value* Query::Result::Create(const std::vector<linked_ptr<Tab> > result) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetArrayToList(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());
+
+ if (!args.GetInteger(0, params->window_id.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* GetSelected::Result::Create(const Tab& tab) {
+ return tab.ToValue();
+}
+
+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());
+
+ if (!args.GetInteger(0, params->window_id.get()))
+ return params.Pass();
+
+ return params.Pass();
+}
+
+// static
+Value* GetAllInWindow::Result::Create(const std::vector<linked_ptr<Tab> > tabs) {
+ ListValue* value = new ListValue();
+ json_schema_compiler::util::SetArrayToList(tabs, value);
+ return value;
+}
+
+} // tabs
+} // api
+} // extensions

Powered by Google App Engine
This is Rietveld 408576698