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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 7714004: base: Add AsList() function to Value API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OVERRIDE Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 if (args->HasKey(keys::kUrlKey)) { 410 if (args->HasKey(keys::kUrlKey)) {
411 Value* url_value; 411 Value* url_value;
412 std::vector<std::string> url_strings; 412 std::vector<std::string> url_strings;
413 args->Get(keys::kUrlKey, &url_value); 413 args->Get(keys::kUrlKey, &url_value);
414 414
415 // First, get all the URLs the client wants to open. 415 // First, get all the URLs the client wants to open.
416 if (url_value->IsType(Value::TYPE_STRING)) { 416 if (url_value->IsType(Value::TYPE_STRING)) {
417 std::string url_string; 417 std::string url_string;
418 url_value->GetAsString(&url_string); 418 url_value->GetAsString(&url_string);
419 url_strings.push_back(url_string); 419 url_strings.push_back(url_string);
420 } else if (url_value->IsType(Value::TYPE_LIST)) { 420 } else if (url_value->AsList()) {
421 const ListValue* url_list = static_cast<const ListValue*>(url_value); 421 const ListValue* url_list = static_cast<const ListValue*>(url_value);
Evan Martin 2011/08/23 18:15:26 same transformation here (can set url_list in the
tfarina 2011/08/23 18:26:36 Done.
422 for (size_t i = 0; i < url_list->GetSize(); ++i) { 422 for (size_t i = 0; i < url_list->GetSize(); ++i) {
423 std::string url_string; 423 std::string url_string;
424 EXTENSION_FUNCTION_VALIDATE(url_list->GetString(i, &url_string)); 424 EXTENSION_FUNCTION_VALIDATE(url_list->GetString(i, &url_string));
425 url_strings.push_back(url_string); 425 url_strings.push_back(url_string);
426 } 426 }
427 } 427 }
428 428
429 // Second, resolve, validate and convert them to GURLs. 429 // Second, resolve, validate and convert them to GURLs.
430 for (std::vector<std::string>::iterator i = url_strings.begin(); 430 for (std::vector<std::string>::iterator i = url_strings.begin();
431 i != url_strings.end(); ++i) { 431 i != url_strings.end(); ++i) {
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 // called for every API call the extension made. 1376 // called for every API call the extension made.
1377 GotLanguage(language); 1377 GotLanguage(language);
1378 } 1378 }
1379 1379
1380 void DetectTabLanguageFunction::GotLanguage(const std::string& language) { 1380 void DetectTabLanguageFunction::GotLanguage(const std::string& language) {
1381 result_.reset(Value::CreateStringValue(language.c_str())); 1381 result_.reset(Value::CreateStringValue(language.c_str()));
1382 SendResponse(true); 1382 SendResponse(true);
1383 1383
1384 Release(); // Balanced in Run() 1384 Release(); // Balanced in Run()
1385 } 1385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698