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

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: DictionaryValue* to linked_ptr<DictionaryValue> Created 8 years, 11 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..926d1e80052061bc80ba2543d944d1603d72bd2c
--- /dev/null
+++ b/generated_files_will_not_submit/tabs.cc
@@ -0,0 +1,641 @@
+// 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);
+
+ out->status.reset(new std::string);
+ dict->GetString("status", out->status.get());
+ if(!dict->GetInteger("index", &out->index))
+ return false;
+ out->opener_tab_id.reset(new int);
+ dict->GetInteger("openerTabId", out->opener_tab_id.get());
+ if(!dict->GetBoolean("pinned", &out->pinned))
+ return false;
+ out->title.reset(new std::string);
+ dict->GetString("title", out->title.get());
+ 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;
+ out->fav_icon_url.reset(new std::string);
+ dict->GetString("favIconUrl", out->fav_icon_url.get());
+ 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();
+
+ value->SetWithoutPathExpansion("status", Value::CreateStringValue(*status));
+ value->SetWithoutPathExpansion("index", Value::CreateIntegerValue(index));
+ value->SetWithoutPathExpansion("openerTabId", Value::CreateIntegerValue(*opener_tab_id));
+ value->SetWithoutPathExpansion("pinned", Value::CreateBooleanValue(pinned));
+ 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));
+ 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);
+
+ out->all_frames.reset(new bool);
+ dict->GetBoolean("allFrames", out->all_frames.get());
+ out->code.reset(new std::string);
+ dict->GetString("code", out->code.get());
+ out->file.reset(new std::string);
+ dict->GetString("file", out->file.get());
+ return true;
+}
+
+
+
+ExecuteScript::Params::Params() {}
+ExecuteScript::Params::~Params() {}
+
+// static
+scoped_ptr<ExecuteScript::Params> ExecuteScript::Params::Create(const ListValue& args) {
+
+ 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) {
+
+ 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 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);
+
+ out->index.reset(new int);
+ dict->GetInteger("index", out->index.get());
+ out->opener_tab_id.reset(new int);
+ dict->GetInteger("openerTabId", out->opener_tab_id.get());
+ out->url.reset(new std::string);
+ dict->GetString("url", out->url.get());
+ out->selected.reset(new bool);
+ dict->GetBoolean("selected", out->selected.get());
+ out->pinned.reset(new bool);
+ dict->GetBoolean("pinned", out->pinned.get());
+ out->window_id.reset(new int);
+ dict->GetInteger("windowId", out->window_id.get());
+ out->active.reset(new bool);
+ dict->GetBoolean("active", out->active.get());
+ return true;
+}
+
+
+
+Create::Params::Params() {}
+Create::Params::~Params() {}
+
+// static
+scoped_ptr<Create::Params> Create::Params::Create(const ListValue& args) {
+
+ 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;
+ out->window_id.reset(new int);
+ dict->GetInteger("windowId", out->window_id.get());
+ return true;
+}
+
+
+
+Move::Params::Params() {}
+Move::Params::~Params() {}
+
+// static
+scoped_ptr<Move::Params> Move::Params::Create(const ListValue& args) {
+
+ scoped_ptr<Params> params(new Params());
+
+ if(!args.GetInteger(0, &params->move_integer))
+ return scoped_ptr<Params>();
+
+ ListValue* move_array_param = NULL;
+ if (!args.GetList(1, &move_array_param))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::GetArrayFromList(*move_array_param, &params->move_array))
+ return scoped_ptr<Params>();
+
+ DictionaryValue* move_properties_param = NULL;
+ if (!args.GetDictionary(2, &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 Tab& callback_tab) {
+ return callback_tab.ToValue();
+}
+Value* Move::Result::Create(const std::vector<linked_ptr<Tab> > callback_array) {
+ ListValue* l = new ListValue();
+ for (std::vector<linked_ptr<Tab> >::const_iterator it = callback_array.begin(); it != callback_array.end(); ++it) {
+ l->Append((**it).ToValue());
+ }
+ return l;
+}
+
+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);
+
+ out->highlighted.reset(new bool);
+ dict->GetBoolean("highlighted", out->highlighted.get());
+ out->opener_tab_id.reset(new int);
+ dict->GetInteger("openerTabId", out->opener_tab_id.get());
+ out->url.reset(new std::string);
+ dict->GetString("url", out->url.get());
+ out->selected.reset(new bool);
+ dict->GetBoolean("selected", out->selected.get());
+ out->pinned.reset(new bool);
+ dict->GetBoolean("pinned", out->pinned.get());
+ out->active.reset(new bool);
+ dict->GetBoolean("active", out->active.get());
+ return true;
+}
+
+
+
+Update::Params::Params() {}
+Update::Params::~Params() {}
+
+// static
+scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) {
+
+ 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 Tab& tab) {
+ return tab.ToValue();
+}
+
+Remove::Params::Params() {}
+Remove::Params::~Params() {}
+
+// static
+scoped_ptr<Remove::Params> Remove::Params::Create(const ListValue& args) {
+
+ scoped_ptr<Params> params(new Params());
+
+ if(!args.GetInteger(0, &params->remove_integer))
+ return scoped_ptr<Params>();
+
+ ListValue* remove_array_param = NULL;
+ if (!args.GetList(1, &remove_array_param))
+ return scoped_ptr<Params>();
+ if (!json_schema_compiler::util::GetArrayFromList(*remove_array_param, &params->remove_array))
+ 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);
+
+ out->quality.reset(new int);
+ dict->GetInteger("quality", out->quality.get());
+ out->format.reset(new std::string);
+ dict->GetString("format", out->format.get());
+ return true;
+}
+
+
+
+CaptureVisibleTab::Params::Params() {}
+CaptureVisibleTab::Params::~Params() {}
+
+// static
+scoped_ptr<CaptureVisibleTab::Params> CaptureVisibleTab::Params::Create(const ListValue& args) {
+
+ 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);
+
+ out->bypass_cache.reset(new bool);
+ dict->GetBoolean("bypassCache", out->bypass_cache.get());
+ return true;
+}
+
+
+
+Reload::Params::Params() {}
+Reload::Params::~Params() {}
+
+// static
+scoped_ptr<Reload::Params> Reload::Params::Create(const ListValue& args) {
+
+ 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) {
+
+ 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);
+
+ out->all_frames.reset(new bool);
+ dict->GetBoolean("allFrames", out->all_frames.get());
+ out->code.reset(new std::string);
+ dict->GetString("code", out->code.get());
+ out->file.reset(new std::string);
+ dict->GetString("file", out->file.get());
+ return true;
+}
+
+
+
+InsertCSS::Params::Params() {}
+InsertCSS::Params::~Params() {}
+
+// static
+scoped_ptr<InsertCSS::Params> InsertCSS::Params::Create(const ListValue& args) {
+
+ 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(!dict->GetInteger("highlightInfo", &out->highlight_info_integer))
+ return false;
+ 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) {
+
+ 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);
+
+ out->status.reset(new std::string);
+ dict->GetString("status", out->status.get());
+ out->pinned.reset(new bool);
+ dict->GetBoolean("pinned", out->pinned.get());
+ out->index.reset(new int);
+ dict->GetInteger("index", out->index.get());
+ out->url.reset(new std::string);
+ dict->GetString("url", out->url.get());
+ out->title.reset(new std::string);
+ dict->GetString("title", out->title.get());
+ out->highlighted.reset(new bool);
+ dict->GetBoolean("highlighted", out->highlighted.get());
+ out->window_id.reset(new int);
+ dict->GetInteger("windowId", out->window_id.get());
+ out->window_type.reset(new std::string);
+ dict->GetString("windowType", out->window_type.get());
+ out->active.reset(new bool);
+ dict->GetBoolean("active", out->active.get());
+ return true;
+}
+
+
+
+Query::Params::Params() {}
+Query::Params::~Params() {}
+
+// static
+scoped_ptr<Query::Params> Query::Params::Create(const ListValue& args) {
+
+ 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* l = new ListValue();
+ for (std::vector<linked_ptr<Tab> >::const_iterator it = result.begin(); it != result.end(); ++it) {
+ l->Append((**it).ToValue());
+ }
+ return l;
+}
+
+GetSelected::Params::Params() {}
+GetSelected::Params::~Params() {}
+
+// static
+scoped_ptr<GetSelected::Params> GetSelected::Params::Create(const ListValue& args) {
+
+ 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) {
+
+ 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* l = new ListValue();
+ for (std::vector<linked_ptr<Tab> >::const_iterator it = tabs.begin(); it != tabs.end(); ++it) {
+ l->Append((**it).ToValue());
+ }
+ return l;
+}
+
+} // tabs
+} // api
+} // extensions

Powered by Google App Engine
This is Rietveld 408576698