| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 #include <stddef.h> | |
| 6 | |
| 7 #include "extensions/browser/extension_function_util.h" | |
| 8 | |
| 9 namespace extensions { | |
| 10 | |
| 11 bool ReadOneOrMoreIntegers(base::Value* value, std::vector<int>* result) { | |
| 12 if (value->IsType(base::Value::TYPE_INTEGER)) { | |
| 13 int v = -1; | |
| 14 if (!value->GetAsInteger(&v)) | |
| 15 return false; | |
| 16 result->push_back(v); | |
| 17 return true; | |
| 18 | |
| 19 } else if (value->IsType(base::Value::TYPE_LIST)) { | |
| 20 base::ListValue* values = static_cast<base::ListValue*>(value); | |
| 21 for (size_t i = 0; i < values->GetSize(); ++i) { | |
| 22 int v = -1; | |
| 23 if (!values->GetInteger(i, &v)) | |
| 24 return false; | |
| 25 result->push_back(v); | |
| 26 } | |
| 27 return true; | |
| 28 } | |
| 29 return false; | |
| 30 } | |
| 31 | |
| 32 } // namespace extensions | |
| OLD | NEW |