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

Side by Side Diff: components/url_matcher/url_matcher_factory.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/url_matcher/url_matcher_factory.h" 5 #include "components/url_matcher/url_matcher_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cctype> 8 #include <cctype>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 std::string* error) { 243 std::string* error) {
244 std::vector<URLMatcherPortFilter::Range> ranges; 244 std::vector<URLMatcherPortFilter::Range> ranges;
245 const base::ListValue* value_list = NULL; 245 const base::ListValue* value_list = NULL;
246 if (!value->GetAsList(&value_list)) { 246 if (!value->GetAsList(&value_list)) {
247 *error = kInvalidPortRanges; 247 *error = kInvalidPortRanges;
248 return nullptr; 248 return nullptr;
249 } 249 }
250 250
251 for (const auto& entry : *value_list) { 251 for (const auto& entry : *value_list) {
252 int port = 0; 252 int port = 0;
253 const base::ListValue* range = NULL; 253 base::ListValue* range = NULL;
254 if (entry.GetAsInteger(&port)) { 254 if (entry->GetAsInteger(&port)) {
255 ranges.push_back(URLMatcherPortFilter::CreateRange(port)); 255 ranges.push_back(URLMatcherPortFilter::CreateRange(port));
256 } else if (entry.GetAsList(&range)) { 256 } else if (entry->GetAsList(&range)) {
257 int from = 0, to = 0; 257 int from = 0, to = 0;
258 if (range->GetSize() != 2u || 258 if (range->GetSize() != 2u ||
259 !range->GetInteger(0, &from) || 259 !range->GetInteger(0, &from) ||
260 !range->GetInteger(1, &to)) { 260 !range->GetInteger(1, &to)) {
261 *error = kInvalidPortRanges; 261 *error = kInvalidPortRanges;
262 return nullptr; 262 return nullptr;
263 } 263 }
264 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to)); 264 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to));
265 } else { 265 } else {
266 *error = kInvalidPortRanges; 266 *error = kInvalidPortRanges;
267 return nullptr; 267 return nullptr;
268 } 268 }
269 } 269 }
270 270
271 return base::MakeUnique<URLMatcherPortFilter>(ranges); 271 return base::MakeUnique<URLMatcherPortFilter>(ranges);
272 } 272 }
273 273
274 } // namespace url_matcher 274 } // namespace url_matcher
OLDNEW
« no previous file with comments | « components/update_client/component_patcher.cc ('k') | content/browser/accessibility/accessibility_tree_formatter_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698