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

Side by Side Diff: extensions/renderer/argument_spec.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Fix Android Compilation Error Created 3 years, 9 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
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return; 52 return;
53 } 53 }
54 54
55 { 55 {
56 const base::ListValue* choices = nullptr; 56 const base::ListValue* choices = nullptr;
57 if (dict->GetList("choices", &choices)) { 57 if (dict->GetList("choices", &choices)) {
58 DCHECK(!choices->empty()); 58 DCHECK(!choices->empty());
59 type_ = ArgumentType::CHOICES; 59 type_ = ArgumentType::CHOICES;
60 choices_.reserve(choices->GetSize()); 60 choices_.reserve(choices->GetSize());
61 for (const auto& choice : *choices) 61 for (const auto& choice : *choices)
62 choices_.push_back(base::MakeUnique<ArgumentSpec>(*choice)); 62 choices_.push_back(base::MakeUnique<ArgumentSpec>(choice));
63 return; 63 return;
64 } 64 }
65 } 65 }
66 66
67 std::string type_string; 67 std::string type_string;
68 CHECK(dict->GetString("type", &type_string)); 68 CHECK(dict->GetString("type", &type_string));
69 if (type_string == "integer") 69 if (type_string == "integer")
70 type_ = ArgumentType::INTEGER; 70 type_ = ArgumentType::INTEGER;
71 else if (type_string == "number") 71 else if (type_string == "number")
72 type_ = ArgumentType::DOUBLE; 72 type_ = ArgumentType::DOUBLE;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return false; 393 return false;
394 } 394 }
395 if (type_ == ArgumentType::BINARY) 395 if (type_ == ArgumentType::BINARY)
396 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType()); 396 DCHECK_EQ(base::Value::Type::BINARY, converted->GetType());
397 *out_value = std::move(converted); 397 *out_value = std::move(converted);
398 } 398 }
399 return true; 399 return true;
400 } 400 }
401 401
402 } // namespace extensions 402 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698