OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // GENERATED FROM THE API DEFINITION IN |
| 6 // chrome/common/extensions/api/tabs.json |
| 7 // DO NOT EDIT. |
| 8 |
| 9 #include "tools/json_schema_compiler/util.h" |
| 10 #include "chrome/common/extensions/api/tabs.h" |
| 11 #include "chrome/common/extensions/api/windows.h" |
| 12 |
| 13 |
| 14 namespace extensions { |
| 15 namespace api { |
| 16 namespace tabs { |
| 17 |
| 18 // |
| 19 // Types |
| 20 // |
| 21 |
| 22 Tab::Tab() {} |
| 23 Tab::~Tab() {} |
| 24 |
| 25 // static |
| 26 bool Tab::Populate(const Value& value, Tab* out) { |
| 27 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 28 return false; |
| 29 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 30 |
| 31 out->status.reset(new std::string); |
| 32 dict->GetString("status", out->status.get()); |
| 33 if(!dict->GetInteger("index", &out->index)) |
| 34 return false; |
| 35 out->opener_tab_id.reset(new int); |
| 36 dict->GetInteger("openerTabId", out->opener_tab_id.get()); |
| 37 if(!dict->GetBoolean("pinned", &out->pinned)) |
| 38 return false; |
| 39 out->title.reset(new std::string); |
| 40 dict->GetString("title", out->title.get()); |
| 41 if(!dict->GetString("url", &out->url)) |
| 42 return false; |
| 43 if(!dict->GetBoolean("selected", &out->selected)) |
| 44 return false; |
| 45 if(!dict->GetBoolean("highlighted", &out->highlighted)) |
| 46 return false; |
| 47 if(!dict->GetInteger("windowId", &out->window_id)) |
| 48 return false; |
| 49 if(!dict->GetBoolean("active", &out->active)) |
| 50 return false; |
| 51 out->fav_icon_url.reset(new std::string); |
| 52 dict->GetString("favIconUrl", out->fav_icon_url.get()); |
| 53 if(!dict->GetInteger("id", &out->id)) |
| 54 return false; |
| 55 if(!dict->GetBoolean("incognito", &out->incognito)) |
| 56 return false; |
| 57 return true; |
| 58 } |
| 59 |
| 60 DictionaryValue* Tab::ToValue() const { |
| 61 DictionaryValue* value = new DictionaryValue(); |
| 62 |
| 63 value->SetWithoutPathExpansion("status", Value::CreateStringValue(*status)); |
| 64 value->SetWithoutPathExpansion("index", Value::CreateIntegerValue(index)); |
| 65 value->SetWithoutPathExpansion("openerTabId", Value::CreateIntegerValue(*opene
r_tab_id)); |
| 66 value->SetWithoutPathExpansion("pinned", Value::CreateBooleanValue(pinned)); |
| 67 value->SetWithoutPathExpansion("title", Value::CreateStringValue(*title)); |
| 68 value->SetWithoutPathExpansion("url", Value::CreateStringValue(url)); |
| 69 value->SetWithoutPathExpansion("selected", Value::CreateBooleanValue(selected)
); |
| 70 value->SetWithoutPathExpansion("highlighted", Value::CreateBooleanValue(highli
ghted)); |
| 71 value->SetWithoutPathExpansion("windowId", Value::CreateIntegerValue(window_id
)); |
| 72 value->SetWithoutPathExpansion("active", Value::CreateBooleanValue(active)); |
| 73 value->SetWithoutPathExpansion("favIconUrl", Value::CreateStringValue(*fav_ico
n_url)); |
| 74 value->SetWithoutPathExpansion("id", Value::CreateIntegerValue(id)); |
| 75 value->SetWithoutPathExpansion("incognito", Value::CreateBooleanValue(incognit
o)); |
| 76 |
| 77 return value; |
| 78 } |
| 79 |
| 80 |
| 81 // |
| 82 // Functions |
| 83 // |
| 84 |
| 85 ExecuteScript::Params::Details::Details() {} |
| 86 ExecuteScript::Params::Details::~Details() {} |
| 87 |
| 88 // static |
| 89 bool ExecuteScript::Params::Details::Populate(const Value& value, Details* out)
{ |
| 90 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 91 return false; |
| 92 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 93 |
| 94 out->all_frames.reset(new bool); |
| 95 dict->GetBoolean("allFrames", out->all_frames.get()); |
| 96 out->code.reset(new std::string); |
| 97 dict->GetString("code", out->code.get()); |
| 98 out->file.reset(new std::string); |
| 99 dict->GetString("file", out->file.get()); |
| 100 return true; |
| 101 } |
| 102 |
| 103 |
| 104 |
| 105 ExecuteScript::Params::Params() {} |
| 106 ExecuteScript::Params::~Params() {} |
| 107 |
| 108 // static |
| 109 scoped_ptr<ExecuteScript::Params> ExecuteScript::Params::Create(const ListValue&
args) { |
| 110 |
| 111 scoped_ptr<Params> params(new Params()); |
| 112 |
| 113 if(!args.GetInteger(0, params->tab_id.get())) |
| 114 return params.Pass(); |
| 115 |
| 116 DictionaryValue* details_param = NULL; |
| 117 if (!args.GetDictionary(1, &details_param)) |
| 118 return scoped_ptr<Params>(); |
| 119 if(!Details::Populate(*details_param, ¶ms->details)) |
| 120 return scoped_ptr<Params>(); |
| 121 |
| 122 return params.Pass(); |
| 123 } |
| 124 |
| 125 // static |
| 126 Value* ExecuteScript::Result::Create() { |
| 127 return Value::CreateNullValue(); |
| 128 } |
| 129 |
| 130 Get::Params::Params() {} |
| 131 Get::Params::~Params() {} |
| 132 |
| 133 // static |
| 134 scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) { |
| 135 |
| 136 scoped_ptr<Params> params(new Params()); |
| 137 |
| 138 if(!args.GetInteger(0, ¶ms->tab_id)) |
| 139 return scoped_ptr<Params>(); |
| 140 |
| 141 return params.Pass(); |
| 142 } |
| 143 |
| 144 // static |
| 145 Value* Get::Result::Create(const Tab& tab) { |
| 146 return tab.ToValue(); |
| 147 } |
| 148 |
| 149 // static |
| 150 Value* GetCurrent::Result::Create(const Tab& tab) { |
| 151 return tab.ToValue(); |
| 152 } |
| 153 |
| 154 Create::Params::CreateProperties::CreateProperties() {} |
| 155 Create::Params::CreateProperties::~CreateProperties() {} |
| 156 |
| 157 // static |
| 158 bool Create::Params::CreateProperties::Populate(const Value& value, CreateProper
ties* out) { |
| 159 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 160 return false; |
| 161 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 162 |
| 163 out->index.reset(new int); |
| 164 dict->GetInteger("index", out->index.get()); |
| 165 out->opener_tab_id.reset(new int); |
| 166 dict->GetInteger("openerTabId", out->opener_tab_id.get()); |
| 167 out->url.reset(new std::string); |
| 168 dict->GetString("url", out->url.get()); |
| 169 out->selected.reset(new bool); |
| 170 dict->GetBoolean("selected", out->selected.get()); |
| 171 out->pinned.reset(new bool); |
| 172 dict->GetBoolean("pinned", out->pinned.get()); |
| 173 out->window_id.reset(new int); |
| 174 dict->GetInteger("windowId", out->window_id.get()); |
| 175 out->active.reset(new bool); |
| 176 dict->GetBoolean("active", out->active.get()); |
| 177 return true; |
| 178 } |
| 179 |
| 180 |
| 181 |
| 182 Create::Params::Params() {} |
| 183 Create::Params::~Params() {} |
| 184 |
| 185 // static |
| 186 scoped_ptr<Create::Params> Create::Params::Create(const ListValue& args) { |
| 187 |
| 188 scoped_ptr<Params> params(new Params()); |
| 189 |
| 190 DictionaryValue* create_properties_param = NULL; |
| 191 if (!args.GetDictionary(0, &create_properties_param)) |
| 192 return scoped_ptr<Params>(); |
| 193 if(!CreateProperties::Populate(*create_properties_param, ¶ms->create_prope
rties)) |
| 194 return scoped_ptr<Params>(); |
| 195 |
| 196 return params.Pass(); |
| 197 } |
| 198 |
| 199 // static |
| 200 // Details about the created tab. Will contain the ID of the new tab. |
| 201 Value* Create::Result::Create(const Tab& tab) { |
| 202 return tab.ToValue(); |
| 203 } |
| 204 |
| 205 Move::Params::MoveProperties::MoveProperties() {} |
| 206 Move::Params::MoveProperties::~MoveProperties() {} |
| 207 |
| 208 // static |
| 209 bool Move::Params::MoveProperties::Populate(const Value& value, MoveProperties*
out) { |
| 210 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 211 return false; |
| 212 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 213 |
| 214 if(!dict->GetInteger("index", &out->index)) |
| 215 return false; |
| 216 out->window_id.reset(new int); |
| 217 dict->GetInteger("windowId", out->window_id.get()); |
| 218 return true; |
| 219 } |
| 220 |
| 221 |
| 222 |
| 223 Move::Params::Params() {} |
| 224 Move::Params::~Params() {} |
| 225 |
| 226 // static |
| 227 scoped_ptr<Move::Params> Move::Params::Create(const ListValue& args) { |
| 228 |
| 229 scoped_ptr<Params> params(new Params()); |
| 230 |
| 231 if(!args.GetInteger(0, ¶ms->move_integer)) |
| 232 return scoped_ptr<Params>(); |
| 233 |
| 234 ListValue* move_array_param = NULL; |
| 235 if (!args.GetList(1, &move_array_param)) |
| 236 return scoped_ptr<Params>(); |
| 237 if (!json_schema_compiler::util::GetArrayFromList(*move_array_param, ¶ms->
move_array)) |
| 238 return scoped_ptr<Params>(); |
| 239 |
| 240 DictionaryValue* move_properties_param = NULL; |
| 241 if (!args.GetDictionary(2, &move_properties_param)) |
| 242 return scoped_ptr<Params>(); |
| 243 if(!MoveProperties::Populate(*move_properties_param, ¶ms->move_properties)
) |
| 244 return scoped_ptr<Params>(); |
| 245 |
| 246 return params.Pass(); |
| 247 } |
| 248 |
| 249 // static |
| 250 Value* Move::Result::Create(const Tab& callback_tab) { |
| 251 return callback_tab.ToValue(); |
| 252 } |
| 253 Value* Move::Result::Create(const std::vector<linked_ptr<Tab> > callback_array)
{ |
| 254 ListValue* l = new ListValue(); |
| 255 for (std::vector<linked_ptr<Tab> >::const_iterator it = callback_array.begin()
; it != callback_array.end(); ++it) { |
| 256 l->Append((**it).ToValue()); |
| 257 } |
| 258 return l; |
| 259 } |
| 260 |
| 261 Update::Params::UpdateProperties::UpdateProperties() {} |
| 262 Update::Params::UpdateProperties::~UpdateProperties() {} |
| 263 |
| 264 // static |
| 265 bool Update::Params::UpdateProperties::Populate(const Value& value, UpdateProper
ties* out) { |
| 266 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 267 return false; |
| 268 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 269 |
| 270 out->highlighted.reset(new bool); |
| 271 dict->GetBoolean("highlighted", out->highlighted.get()); |
| 272 out->opener_tab_id.reset(new int); |
| 273 dict->GetInteger("openerTabId", out->opener_tab_id.get()); |
| 274 out->url.reset(new std::string); |
| 275 dict->GetString("url", out->url.get()); |
| 276 out->selected.reset(new bool); |
| 277 dict->GetBoolean("selected", out->selected.get()); |
| 278 out->pinned.reset(new bool); |
| 279 dict->GetBoolean("pinned", out->pinned.get()); |
| 280 out->active.reset(new bool); |
| 281 dict->GetBoolean("active", out->active.get()); |
| 282 return true; |
| 283 } |
| 284 |
| 285 |
| 286 |
| 287 Update::Params::Params() {} |
| 288 Update::Params::~Params() {} |
| 289 |
| 290 // static |
| 291 scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) { |
| 292 |
| 293 scoped_ptr<Params> params(new Params()); |
| 294 |
| 295 if(!args.GetInteger(0, params->tab_id.get())) |
| 296 return params.Pass(); |
| 297 |
| 298 DictionaryValue* update_properties_param = NULL; |
| 299 if (!args.GetDictionary(1, &update_properties_param)) |
| 300 return scoped_ptr<Params>(); |
| 301 if(!UpdateProperties::Populate(*update_properties_param, ¶ms->update_prope
rties)) |
| 302 return scoped_ptr<Params>(); |
| 303 |
| 304 return params.Pass(); |
| 305 } |
| 306 |
| 307 // static |
| 308 // Details about the updated tab, or <code>null</code> if the 'tabs' permission |
| 309 // has not been requested. |
| 310 Value* Update::Result::Create(const Tab& tab) { |
| 311 return tab.ToValue(); |
| 312 } |
| 313 |
| 314 Remove::Params::Params() {} |
| 315 Remove::Params::~Params() {} |
| 316 |
| 317 // static |
| 318 scoped_ptr<Remove::Params> Remove::Params::Create(const ListValue& args) { |
| 319 |
| 320 scoped_ptr<Params> params(new Params()); |
| 321 |
| 322 if(!args.GetInteger(0, ¶ms->remove_integer)) |
| 323 return scoped_ptr<Params>(); |
| 324 |
| 325 ListValue* remove_array_param = NULL; |
| 326 if (!args.GetList(1, &remove_array_param)) |
| 327 return scoped_ptr<Params>(); |
| 328 if (!json_schema_compiler::util::GetArrayFromList(*remove_array_param, ¶ms
->remove_array)) |
| 329 return scoped_ptr<Params>(); |
| 330 |
| 331 return params.Pass(); |
| 332 } |
| 333 |
| 334 // static |
| 335 Value* Remove::Result::Create() { |
| 336 return Value::CreateNullValue(); |
| 337 } |
| 338 |
| 339 CaptureVisibleTab::Params::Options::Options() {} |
| 340 CaptureVisibleTab::Params::Options::~Options() {} |
| 341 |
| 342 // static |
| 343 bool CaptureVisibleTab::Params::Options::Populate(const Value& value, Options* o
ut) { |
| 344 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 345 return false; |
| 346 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 347 |
| 348 out->quality.reset(new int); |
| 349 dict->GetInteger("quality", out->quality.get()); |
| 350 out->format.reset(new std::string); |
| 351 dict->GetString("format", out->format.get()); |
| 352 return true; |
| 353 } |
| 354 |
| 355 |
| 356 |
| 357 CaptureVisibleTab::Params::Params() {} |
| 358 CaptureVisibleTab::Params::~Params() {} |
| 359 |
| 360 // static |
| 361 scoped_ptr<CaptureVisibleTab::Params> CaptureVisibleTab::Params::Create(const Li
stValue& args) { |
| 362 |
| 363 scoped_ptr<Params> params(new Params()); |
| 364 |
| 365 if(!args.GetInteger(0, params->window_id.get())) |
| 366 return params.Pass(); |
| 367 |
| 368 DictionaryValue* options_param = NULL; |
| 369 if (!args.GetDictionary(1, &options_param)) |
| 370 return params.Pass(); |
| 371 params->options.reset(new Options()); |
| 372 if(!Options::Populate(*options_param, params->options.get())) |
| 373 return params.Pass(); |
| 374 |
| 375 return params.Pass(); |
| 376 } |
| 377 |
| 378 // static |
| 379 // A data URL which encodes an image of the visible area of the captured tab. |
| 380 // May be assigned to the 'src' property of an HTML Image element for display. |
| 381 Value* CaptureVisibleTab::Result::Create(const std::string data_url) { |
| 382 return Value::CreateStringValue(data_url); |
| 383 } |
| 384 |
| 385 Reload::Params::ReloadProperties::ReloadProperties() {} |
| 386 Reload::Params::ReloadProperties::~ReloadProperties() {} |
| 387 |
| 388 // static |
| 389 bool Reload::Params::ReloadProperties::Populate(const Value& value, ReloadProper
ties* out) { |
| 390 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 391 return false; |
| 392 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 393 |
| 394 out->bypass_cache.reset(new bool); |
| 395 dict->GetBoolean("bypassCache", out->bypass_cache.get()); |
| 396 return true; |
| 397 } |
| 398 |
| 399 |
| 400 |
| 401 Reload::Params::Params() {} |
| 402 Reload::Params::~Params() {} |
| 403 |
| 404 // static |
| 405 scoped_ptr<Reload::Params> Reload::Params::Create(const ListValue& args) { |
| 406 |
| 407 scoped_ptr<Params> params(new Params()); |
| 408 |
| 409 if(!args.GetInteger(0, params->tab_id.get())) |
| 410 return params.Pass(); |
| 411 |
| 412 DictionaryValue* reload_properties_param = NULL; |
| 413 if (!args.GetDictionary(1, &reload_properties_param)) |
| 414 return params.Pass(); |
| 415 params->reload_properties.reset(new ReloadProperties()); |
| 416 if(!ReloadProperties::Populate(*reload_properties_param, params->reload_proper
ties.get())) |
| 417 return params.Pass(); |
| 418 |
| 419 return params.Pass(); |
| 420 } |
| 421 |
| 422 // static |
| 423 Value* Reload::Result::Create() { |
| 424 return Value::CreateNullValue(); |
| 425 } |
| 426 |
| 427 DetectLanguage::Params::Params() {} |
| 428 DetectLanguage::Params::~Params() {} |
| 429 |
| 430 // static |
| 431 scoped_ptr<DetectLanguage::Params> DetectLanguage::Params::Create(const ListValu
e& args) { |
| 432 |
| 433 scoped_ptr<Params> params(new Params()); |
| 434 |
| 435 if(!args.GetInteger(0, params->tab_id.get())) |
| 436 return params.Pass(); |
| 437 |
| 438 return params.Pass(); |
| 439 } |
| 440 |
| 441 // static |
| 442 // An ISO language code such as <code>en</code> or <code>fr</code>. For a |
| 443 // complete list of languages supported by this method, see <a |
| 444 // href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languag |
| 445 // es/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns |
| 446 // will be checked and the first non-NULL value will be returned except for |
| 447 // Simplified Chinese for which zh-CN will be returned. For an unknown |
| 448 // language, <code>und</code> will be returned. |
| 449 Value* DetectLanguage::Result::Create(const std::string language) { |
| 450 return Value::CreateStringValue(language); |
| 451 } |
| 452 |
| 453 InsertCSS::Params::Details::Details() {} |
| 454 InsertCSS::Params::Details::~Details() {} |
| 455 |
| 456 // static |
| 457 bool InsertCSS::Params::Details::Populate(const Value& value, Details* out) { |
| 458 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 459 return false; |
| 460 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 461 |
| 462 out->all_frames.reset(new bool); |
| 463 dict->GetBoolean("allFrames", out->all_frames.get()); |
| 464 out->code.reset(new std::string); |
| 465 dict->GetString("code", out->code.get()); |
| 466 out->file.reset(new std::string); |
| 467 dict->GetString("file", out->file.get()); |
| 468 return true; |
| 469 } |
| 470 |
| 471 |
| 472 |
| 473 InsertCSS::Params::Params() {} |
| 474 InsertCSS::Params::~Params() {} |
| 475 |
| 476 // static |
| 477 scoped_ptr<InsertCSS::Params> InsertCSS::Params::Create(const ListValue& args) { |
| 478 |
| 479 scoped_ptr<Params> params(new Params()); |
| 480 |
| 481 if(!args.GetInteger(0, params->tab_id.get())) |
| 482 return params.Pass(); |
| 483 |
| 484 DictionaryValue* details_param = NULL; |
| 485 if (!args.GetDictionary(1, &details_param)) |
| 486 return scoped_ptr<Params>(); |
| 487 if(!Details::Populate(*details_param, ¶ms->details)) |
| 488 return scoped_ptr<Params>(); |
| 489 |
| 490 return params.Pass(); |
| 491 } |
| 492 |
| 493 // static |
| 494 Value* InsertCSS::Result::Create() { |
| 495 return Value::CreateNullValue(); |
| 496 } |
| 497 |
| 498 Highlight::Params::HighlightInfo::HighlightInfo() {} |
| 499 Highlight::Params::HighlightInfo::~HighlightInfo() {} |
| 500 |
| 501 // static |
| 502 bool Highlight::Params::HighlightInfo::Populate(const Value& value, HighlightInf
o* out) { |
| 503 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 504 return false; |
| 505 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 506 |
| 507 if(!dict->GetInteger("highlightInfo", &out->highlight_info_integer)) |
| 508 return false; |
| 509 if(!dict->GetInteger("windowId", &out->window_id)) |
| 510 return false; |
| 511 return true; |
| 512 } |
| 513 |
| 514 |
| 515 |
| 516 Highlight::Params::Params() {} |
| 517 Highlight::Params::~Params() {} |
| 518 |
| 519 // static |
| 520 scoped_ptr<Highlight::Params> Highlight::Params::Create(const ListValue& args) { |
| 521 |
| 522 scoped_ptr<Params> params(new Params()); |
| 523 |
| 524 DictionaryValue* highlight_info_param = NULL; |
| 525 if (!args.GetDictionary(0, &highlight_info_param)) |
| 526 return scoped_ptr<Params>(); |
| 527 if(!HighlightInfo::Populate(*highlight_info_param, ¶ms->highlight_info)) |
| 528 return scoped_ptr<Params>(); |
| 529 |
| 530 return params.Pass(); |
| 531 } |
| 532 |
| 533 // static |
| 534 // Contains details about the window whose tabs were highlighted. |
| 535 Value* Highlight::Result::Create(const windows::Window& window) { |
| 536 return window.ToValue(); |
| 537 } |
| 538 |
| 539 Query::Params::QueryInfo::QueryInfo() {} |
| 540 Query::Params::QueryInfo::~QueryInfo() {} |
| 541 |
| 542 // static |
| 543 bool Query::Params::QueryInfo::Populate(const Value& value, QueryInfo* out) { |
| 544 if (!value.IsType(Value::TYPE_DICTIONARY)) |
| 545 return false; |
| 546 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value); |
| 547 |
| 548 out->status.reset(new std::string); |
| 549 dict->GetString("status", out->status.get()); |
| 550 out->pinned.reset(new bool); |
| 551 dict->GetBoolean("pinned", out->pinned.get()); |
| 552 out->index.reset(new int); |
| 553 dict->GetInteger("index", out->index.get()); |
| 554 out->url.reset(new std::string); |
| 555 dict->GetString("url", out->url.get()); |
| 556 out->title.reset(new std::string); |
| 557 dict->GetString("title", out->title.get()); |
| 558 out->highlighted.reset(new bool); |
| 559 dict->GetBoolean("highlighted", out->highlighted.get()); |
| 560 out->window_id.reset(new int); |
| 561 dict->GetInteger("windowId", out->window_id.get()); |
| 562 out->window_type.reset(new std::string); |
| 563 dict->GetString("windowType", out->window_type.get()); |
| 564 out->active.reset(new bool); |
| 565 dict->GetBoolean("active", out->active.get()); |
| 566 return true; |
| 567 } |
| 568 |
| 569 |
| 570 |
| 571 Query::Params::Params() {} |
| 572 Query::Params::~Params() {} |
| 573 |
| 574 // static |
| 575 scoped_ptr<Query::Params> Query::Params::Create(const ListValue& args) { |
| 576 |
| 577 scoped_ptr<Params> params(new Params()); |
| 578 |
| 579 DictionaryValue* query_info_param = NULL; |
| 580 if (!args.GetDictionary(0, &query_info_param)) |
| 581 return scoped_ptr<Params>(); |
| 582 if(!QueryInfo::Populate(*query_info_param, ¶ms->query_info)) |
| 583 return scoped_ptr<Params>(); |
| 584 |
| 585 return params.Pass(); |
| 586 } |
| 587 |
| 588 // static |
| 589 Value* Query::Result::Create(const std::vector<linked_ptr<Tab> > result) { |
| 590 ListValue* l = new ListValue(); |
| 591 for (std::vector<linked_ptr<Tab> >::const_iterator it = result.begin(); it !=
result.end(); ++it) { |
| 592 l->Append((**it).ToValue()); |
| 593 } |
| 594 return l; |
| 595 } |
| 596 |
| 597 GetSelected::Params::Params() {} |
| 598 GetSelected::Params::~Params() {} |
| 599 |
| 600 // static |
| 601 scoped_ptr<GetSelected::Params> GetSelected::Params::Create(const ListValue& arg
s) { |
| 602 |
| 603 scoped_ptr<Params> params(new Params()); |
| 604 |
| 605 if(!args.GetInteger(0, params->window_id.get())) |
| 606 return params.Pass(); |
| 607 |
| 608 return params.Pass(); |
| 609 } |
| 610 |
| 611 // static |
| 612 Value* GetSelected::Result::Create(const Tab& tab) { |
| 613 return tab.ToValue(); |
| 614 } |
| 615 |
| 616 GetAllInWindow::Params::Params() {} |
| 617 GetAllInWindow::Params::~Params() {} |
| 618 |
| 619 // static |
| 620 scoped_ptr<GetAllInWindow::Params> GetAllInWindow::Params::Create(const ListValu
e& args) { |
| 621 |
| 622 scoped_ptr<Params> params(new Params()); |
| 623 |
| 624 if(!args.GetInteger(0, params->window_id.get())) |
| 625 return params.Pass(); |
| 626 |
| 627 return params.Pass(); |
| 628 } |
| 629 |
| 630 // static |
| 631 Value* GetAllInWindow::Result::Create(const std::vector<linked_ptr<Tab> > tabs)
{ |
| 632 ListValue* l = new ListValue(); |
| 633 for (std::vector<linked_ptr<Tab> >::const_iterator it = tabs.begin(); it != ta
bs.end(); ++it) { |
| 634 l->Append((**it).ToValue()); |
| 635 } |
| 636 return l; |
| 637 } |
| 638 |
| 639 } // tabs |
| 640 } // api |
| 641 } // extensions |
OLD | NEW |