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

Side by Side Diff: extensions/common/url_pattern_set.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/url_pattern_set.h" 5 #include "extensions/common/url_pattern_set.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 return false; 229 return false;
230 } 230 }
231 231
232 std::unique_ptr<base::ListValue> URLPatternSet::ToValue() const { 232 std::unique_ptr<base::ListValue> URLPatternSet::ToValue() const {
233 std::unique_ptr<base::ListValue> value(new base::ListValue); 233 std::unique_ptr<base::ListValue> value(new base::ListValue);
234 for (URLPatternSet::const_iterator i = patterns_.begin(); 234 for (URLPatternSet::const_iterator i = patterns_.begin();
235 i != patterns_.end(); ++i) 235 i != patterns_.end(); ++i)
236 value->AppendIfNotPresent( 236 value->AppendIfNotPresent(base::MakeUnique<base::Value>(i->GetAsString()));
237 base::MakeUnique<base::StringValue>(i->GetAsString()));
238 return value; 237 return value;
239 } 238 }
240 239
241 bool URLPatternSet::Populate(const std::vector<std::string>& patterns, 240 bool URLPatternSet::Populate(const std::vector<std::string>& patterns,
242 int valid_schemes, 241 int valid_schemes,
243 bool allow_file_access, 242 bool allow_file_access,
244 std::string* error) { 243 std::string* error) {
245 ClearPatterns(); 244 ClearPatterns();
246 for (size_t i = 0; i < patterns.size(); ++i) { 245 for (size_t i = 0; i < patterns.size(); ++i) {
247 URLPattern pattern(valid_schemes); 246 URLPattern pattern(valid_schemes);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 for (size_t i = 0; i < value.GetSize(); ++i) { 281 for (size_t i = 0; i < value.GetSize(); ++i) {
283 std::string item; 282 std::string item;
284 if (!value.GetString(i, &item)) 283 if (!value.GetString(i, &item))
285 return false; 284 return false;
286 patterns.push_back(item); 285 patterns.push_back(item);
287 } 286 }
288 return Populate(patterns, valid_schemes, allow_file_access, error); 287 return Populate(patterns, valid_schemes, allow_file_access, error);
289 } 288 }
290 289
291 } // namespace extensions 290 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/socket_permission_data.cc ('k') | extensions/common/value_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698