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

Side by Side Diff: components/url_matcher/url_matcher_factory.cc

Issue 108603005: Update uses of Value in chromeos/, cloud_print/, components/, content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
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 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const base::DictionaryValue* url_filter_dict, 107 const base::DictionaryValue* url_filter_dict,
108 URLMatcherConditionSet::ID id, 108 URLMatcherConditionSet::ID id,
109 std::string* error) { 109 std::string* error) {
110 scoped_ptr<URLMatcherSchemeFilter> url_matcher_schema_filter; 110 scoped_ptr<URLMatcherSchemeFilter> url_matcher_schema_filter;
111 scoped_ptr<URLMatcherPortFilter> url_matcher_port_filter; 111 scoped_ptr<URLMatcherPortFilter> url_matcher_port_filter;
112 URLMatcherConditionSet::Conditions url_matcher_conditions; 112 URLMatcherConditionSet::Conditions url_matcher_conditions;
113 113
114 for (base::DictionaryValue::Iterator iter(*url_filter_dict); 114 for (base::DictionaryValue::Iterator iter(*url_filter_dict);
115 !iter.IsAtEnd(); iter.Advance()) { 115 !iter.IsAtEnd(); iter.Advance()) {
116 const std::string& condition_attribute_name = iter.key(); 116 const std::string& condition_attribute_name = iter.key();
117 const Value& condition_attribute_value = iter.value(); 117 const base::Value& condition_attribute_value = iter.value();
118 if (IsURLMatcherConditionAttribute(condition_attribute_name)) { 118 if (IsURLMatcherConditionAttribute(condition_attribute_name)) {
119 // Handle {host, path, ...}{Prefix, Suffix, Contains, Equals}. 119 // Handle {host, path, ...}{Prefix, Suffix, Contains, Equals}.
120 URLMatcherCondition url_matcher_condition = 120 URLMatcherCondition url_matcher_condition =
121 CreateURLMatcherCondition( 121 CreateURLMatcherCondition(
122 url_matcher_condition_factory, 122 url_matcher_condition_factory,
123 condition_attribute_name, 123 condition_attribute_name,
124 &condition_attribute_value, 124 &condition_attribute_value,
125 error); 125 error);
126 if (!error->empty()) 126 if (!error->empty())
127 return scoped_refptr<URLMatcherConditionSet>(NULL); 127 return scoped_refptr<URLMatcherConditionSet>(NULL);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 scoped_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts( 238 scoped_ptr<URLMatcherPortFilter> URLMatcherFactory::CreateURLMatcherPorts(
239 const base::Value* value, 239 const base::Value* value,
240 std::string* error) { 240 std::string* error) {
241 std::vector<URLMatcherPortFilter::Range> ranges; 241 std::vector<URLMatcherPortFilter::Range> ranges;
242 const base::ListValue* value_list = NULL; 242 const base::ListValue* value_list = NULL;
243 if (!value->GetAsList(&value_list)) { 243 if (!value->GetAsList(&value_list)) {
244 *error = kInvalidPortRanges; 244 *error = kInvalidPortRanges;
245 return scoped_ptr<URLMatcherPortFilter>(); 245 return scoped_ptr<URLMatcherPortFilter>();
246 } 246 }
247 247
248 for (ListValue::const_iterator i = value_list->begin(); 248 for (base::ListValue::const_iterator i = value_list->begin();
249 i != value_list->end(); ++i) { 249 i != value_list->end(); ++i) {
250 Value* entry = *i; 250 base::Value* entry = *i;
251 int port = 0; 251 int port = 0;
252 base::ListValue* range = NULL; 252 base::ListValue* range = NULL;
253 if (entry->GetAsInteger(&port)) { 253 if (entry->GetAsInteger(&port)) {
254 ranges.push_back(URLMatcherPortFilter::CreateRange(port)); 254 ranges.push_back(URLMatcherPortFilter::CreateRange(port));
255 } else if (entry->GetAsList(&range)) { 255 } else if (entry->GetAsList(&range)) {
256 int from = 0, to = 0; 256 int from = 0, to = 0;
257 if (range->GetSize() != 2u || 257 if (range->GetSize() != 2u ||
258 !range->GetInteger(0, &from) || 258 !range->GetInteger(0, &from) ||
259 !range->GetInteger(1, &to)) { 259 !range->GetInteger(1, &to)) {
260 *error = kInvalidPortRanges; 260 *error = kInvalidPortRanges;
261 return scoped_ptr<URLMatcherPortFilter>(); 261 return scoped_ptr<URLMatcherPortFilter>();
262 } 262 }
263 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to)); 263 ranges.push_back(URLMatcherPortFilter::CreateRange(from, to));
264 } else { 264 } else {
265 *error = kInvalidPortRanges; 265 *error = kInvalidPortRanges;
266 return scoped_ptr<URLMatcherPortFilter>(); 266 return scoped_ptr<URLMatcherPortFilter>();
267 } 267 }
268 } 268 }
269 269
270 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges)); 270 return scoped_ptr<URLMatcherPortFilter>(new URLMatcherPortFilter(ranges));
271 } 271 }
272 272
273 } // namespace url_matcher 273 } // namespace url_matcher
OLDNEW
« no previous file with comments | « components/policy/core/common/registry_dict_win.cc ('k') | components/url_matcher/url_matcher_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698