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

Side by Side Diff: extensions/common/matcher/url_matcher_helpers.cc

Issue 12092096: Move c/c/extensions/matcher/ to top level extension dir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TOT Created 7 years, 10 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 "chrome/common/extensions/matcher/url_matcher_helpers.h" 5 #include "extensions/common/matcher/url_matcher_helpers.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 namespace url_matcher_helpers { 10 namespace url_matcher_helpers {
11 11
12 // Converts a ValueList |value| of strings into a vector. Returns true if 12 // Converts a ValueList |value| of strings into a vector. Returns true if
13 // successful. 13 // successful.
14 bool GetAsStringVector(const base::Value* value, 14 bool GetAsStringVector(const base::Value* value,
15 std::vector<std::string>* out) { 15 std::vector<std::string>* out) {
16 const ListValue* value_as_list = 0; 16 const ListValue* value_as_list = 0;
17 if (!value->GetAsList(&value_as_list)) 17 if (!value->GetAsList(&value_as_list))
18 return false; 18 return false;
19 19
20 size_t number_types = value_as_list->GetSize(); 20 size_t number_types = value_as_list->GetSize();
21 for (size_t i = 0; i < number_types; ++i) { 21 for (size_t i = 0; i < number_types; ++i) {
22 std::string item; 22 std::string item;
23 if (!value_as_list->GetString(i, &item)) 23 if (!value_as_list->GetString(i, &item))
24 return false; 24 return false;
25 out->push_back(item); 25 out->push_back(item);
26 } 26 }
27 return true; 27 return true;
28 } 28 }
29 29
30 } // namespace url_matcher_helpers 30 } // namespace url_matcher_helpers
31 } // namespace extensions 31 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/matcher/url_matcher_helpers.h ('k') | extensions/common/matcher/url_matcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698