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/values.h" | 8 #include "base/values.h" |
9 #include "content/public/child/v8_value_converter.h" | 9 #include "content/public/child/v8_value_converter.h" |
10 #include "extensions/renderer/api_type_reference_map.h" | 10 #include "extensions/renderer/api_type_reference_map.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 { | 53 { |
54 const base::ListValue* choices = nullptr; | 54 const base::ListValue* choices = nullptr; |
55 if (dict->GetList("choices", &choices)) { | 55 if (dict->GetList("choices", &choices)) { |
56 DCHECK(!choices->empty()); | 56 DCHECK(!choices->empty()); |
57 type_ = ArgumentType::CHOICES; | 57 type_ = ArgumentType::CHOICES; |
58 choices_.reserve(choices->GetSize()); | 58 choices_.reserve(choices->GetSize()); |
59 for (const auto& choice : *choices) | 59 for (const auto& choice : *choices) |
60 choices_.push_back(base::MakeUnique<ArgumentSpec>(*choice)); | 60 choices_.push_back(base::MakeUnique<ArgumentSpec>(choice)); |
61 return; | 61 return; |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 std::string type_string; | 65 std::string type_string; |
66 CHECK(dict->GetString("type", &type_string)); | 66 CHECK(dict->GetString("type", &type_string)); |
67 if (type_string == "integer") | 67 if (type_string == "integer") |
68 type_ = ArgumentType::INTEGER; | 68 type_ = ArgumentType::INTEGER; |
69 else if (type_string == "number") | 69 else if (type_string == "number") |
70 type_ = ArgumentType::DOUBLE; | 70 type_ = ArgumentType::DOUBLE; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return false; | 391 return false; |
392 } | 392 } |
393 if (type_ == ArgumentType::BINARY) | 393 if (type_ == ArgumentType::BINARY) |
394 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType()); | 394 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType()); |
395 *out_value = std::move(converted); | 395 *out_value = std::move(converted); |
396 } | 396 } |
397 return true; | 397 return true; |
398 } | 398 } |
399 | 399 |
400 } // namespace extensions | 400 } // namespace extensions |
OLD | NEW |