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

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

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/regex_set_matcher.h" 5 #include "components/url_matcher/regex_set_matcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "components/url_matcher/substring_set_matcher.h" 10 #include "components/url_matcher/substring_set_matcher.h"
(...skipping 30 matching lines...) Expand all
41 if (regexes_.empty()) 41 if (regexes_.empty())
42 return false; 42 return false;
43 if (!filtered_re2_.get()) { 43 if (!filtered_re2_.get()) {
44 LOG(ERROR) << "RegexSetMatcher was not initialized"; 44 LOG(ERROR) << "RegexSetMatcher was not initialized";
45 return false; 45 return false;
46 } 46 }
47 47
48 // FilteredRE2 expects lowercase for prefiltering, but we still 48 // FilteredRE2 expects lowercase for prefiltering, but we still
49 // match case-sensitively. 49 // match case-sensitively.
50 std::vector<RE2ID> atoms(FindSubstringMatches( 50 std::vector<RE2ID> atoms(FindSubstringMatches(
51 StringToLowerASCII(text))); 51 base::StringToLowerASCII(text)));
52 52
53 std::vector<RE2ID> re2_ids; 53 std::vector<RE2ID> re2_ids;
54 filtered_re2_->AllMatches(text, atoms, &re2_ids); 54 filtered_re2_->AllMatches(text, atoms, &re2_ids);
55 55
56 for (size_t i = 0; i < re2_ids.size(); ++i) { 56 for (size_t i = 0; i < re2_ids.size(); ++i) {
57 StringPattern::ID id = re2_id_map_[re2_ids[i]]; 57 StringPattern::ID id = re2_id_map_[re2_ids[i]];
58 matches->insert(id); 58 matches->insert(id);
59 } 59 }
60 return old_number_of_matches != matches->size(); 60 return old_number_of_matches != matches->size();
61 } 61 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 new StringPattern(strings_to_match[i], i)); 104 new StringPattern(strings_to_match[i], i));
105 } 105 }
106 substring_matcher_->RegisterPatterns(substring_patterns_); 106 substring_matcher_->RegisterPatterns(substring_patterns_);
107 } 107 }
108 108
109 void RegexSetMatcher::DeleteSubstringPatterns() { 109 void RegexSetMatcher::DeleteSubstringPatterns() {
110 STLDeleteElements(&substring_patterns_); 110 STLDeleteElements(&substring_patterns_);
111 } 111 }
112 112
113 } // namespace url_matcher 113 } // namespace url_matcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698