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

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

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « extensions/renderer/api_signature.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/api_signature.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698