| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/renderer/argument_spec.h" | 5 #include "extensions/renderer/argument_spec.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 | 55 |
| 56 { | 56 { |
| 57 const base::ListValue* choices = nullptr; | 57 const base::ListValue* choices = nullptr; |
| 58 if (dict->GetList("choices", &choices)) { | 58 if (dict->GetList("choices", &choices)) { |
| 59 DCHECK(!choices->empty()); | 59 DCHECK(!choices->empty()); |
| 60 type_ = ArgumentType::CHOICES; | 60 type_ = ArgumentType::CHOICES; |
| 61 choices_.reserve(choices->GetSize()); | 61 choices_.reserve(choices->GetSize()); |
| 62 for (const auto& choice : *choices) | 62 for (const auto& choice : *choices) |
| 63 choices_.push_back(base::MakeUnique<ArgumentSpec>(choice)); | 63 choices_.push_back(base::MakeUnique<ArgumentSpec>(*choice)); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::string type_string; | 68 std::string type_string; |
| 69 CHECK(dict->GetString("type", &type_string)); | 69 CHECK(dict->GetString("type", &type_string)); |
| 70 if (type_string == "integer") | 70 if (type_string == "integer") |
| 71 type_ = ArgumentType::INTEGER; | 71 type_ = ArgumentType::INTEGER; |
| 72 else if (type_string == "number") | 72 else if (type_string == "number") |
| 73 type_ = ArgumentType::DOUBLE; | 73 type_ = ArgumentType::DOUBLE; |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 return false; | 437 return false; |
| 438 } | 438 } |
| 439 if (type_ == ArgumentType::BINARY) | 439 if (type_ == ArgumentType::BINARY) |
| 440 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType()); | 440 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType()); |
| 441 *out_value = std::move(converted); | 441 *out_value = std::move(converted); |
| 442 } | 442 } |
| 443 return true; | 443 return true; |
| 444 } | 444 } |
| 445 | 445 |
| 446 } // namespace extensions | 446 } // namespace extensions |
| OLD | NEW |