Chromium Code Reviews| 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..960d25461ba5e5d9463811d1f7243acff4ca43e8 |
| --- /dev/null |
| +++ b/generated_files_will_not_submit/windows.cc |
| @@ -0,0 +1,431 @@ |
| +// 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); |
| + |
| + 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; |
| +} |
| + |
| +scoped_ptr<DictionaryValue> Window::ToValue() const { |
| + scoped_ptr<DictionaryValue> value(new DictionaryValue()); |
| + |
| + if (tabs.get()) |
| + json_schema_compiler::util::SetOptionalArrayToDictionary(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); |
| + |
| + { |
| + 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() < 1 || args.GetSize() > 2) |
| + return scoped_ptr<Params>(); |
| + scoped_ptr<Params> params(new Params()); |
| + |
| + if (!args.GetInteger(0, ¶ms->window_id)) |
| + return scoped_ptr<Params>(); |
| + |
| + DictionaryValue* get_info_param = NULL; |
| + if (!args.GetDictionary(1, &get_info_param)) |
| + return params.Pass(); |
|
Yoyo Zhou
2012/02/10 01:49:33
So invalid optional arguments are treated as thoug
calamity
2012/02/10 03:52:50
Good catch. This is a big-ish change. I think it s
|
| + params->get_info.reset(new GetInfo()); |
| + if (!GetInfo::Populate(*get_info_param, params->get_info.get())) |
| + return params.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); |
| + |
| + { |
| + 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(); |
| +} |
| + |
| +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); |
| + |
| + { |
| + 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(); |
| +} |
| + |
| +Value* Create::Result::Create(const scoped_ptr<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); |
| + |
| + { |
| + 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(); |
| +} |
| + |
| +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, ¶ms->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, ¶ms->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()); |
| + |
| + if (!args.GetInteger(0, ¶ms->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); |
| + |
| + { |
| + 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(); |
| +} |
| + |
| +Value* GetLastFocused::Result::Create(const Window& window) { |
| + return window.ToValue().release(); |
| +} |
| + |
| +} // windows |
| +} // api |
| +} // extensions |