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