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

Side by Side Diff: content/browser/accessibility/accessibility_tree_formatter.cc

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 "content/browser/accessibility/accessibility_tree_formatter.h" 5 #include "content/browser/accessibility/accessibility_tree_formatter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/pattern.h"
9 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "content/browser/accessibility/browser_accessibility_manager.h" 14 #include "content/browser/accessibility/browser_accessibility_manager.h"
14 #include "content/browser/renderer_host/render_widget_host_view_base.h" 15 #include "content/browser/renderer_host/render_widget_host_view_base.h"
15 #include "content/browser/web_contents/web_contents_impl.h" 16 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 18
18 namespace content { 19 namespace content {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 147 }
147 148
148 // static 149 // static
149 bool AccessibilityTreeFormatter::MatchesFilters( 150 bool AccessibilityTreeFormatter::MatchesFilters(
150 const std::vector<Filter>& filters, 151 const std::vector<Filter>& filters,
151 const base::string16& text, 152 const base::string16& text,
152 bool default_result) { 153 bool default_result) {
153 std::vector<Filter>::const_iterator iter = filters.begin(); 154 std::vector<Filter>::const_iterator iter = filters.begin();
154 bool allow = default_result; 155 bool allow = default_result;
155 for (iter = filters.begin(); iter != filters.end(); ++iter) { 156 for (iter = filters.begin(); iter != filters.end(); ++iter) {
156 if (MatchPattern(text, iter->match_str)) { 157 if (base::MatchPattern(text, iter->match_str)) {
157 if (iter->type == Filter::ALLOW_EMPTY) 158 if (iter->type == Filter::ALLOW_EMPTY)
158 allow = true; 159 allow = true;
159 else if (iter->type == Filter::ALLOW) 160 else if (iter->type == Filter::ALLOW)
160 allow = (!MatchPattern(text, base::UTF8ToUTF16("*=''"))); 161 allow = (!base::MatchPattern(text, base::UTF8ToUTF16("*=''")));
161 else 162 else
162 allow = false; 163 allow = false;
163 } 164 }
164 } 165 }
165 return allow; 166 return allow;
166 } 167 }
167 168
168 bool AccessibilityTreeFormatter::MatchesFilters( 169 bool AccessibilityTreeFormatter::MatchesFilters(
169 const base::string16& text, bool default_result) const { 170 const base::string16& text, bool default_result) const {
170 return MatchesFilters(filters_, text, default_result); 171 return MatchesFilters(filters_, text, default_result);
(...skipping 20 matching lines...) Expand all
191 if (attr.empty()) 192 if (attr.empty())
192 return; 193 return;
193 if (!MatchesFilters(attr, include_by_default)) 194 if (!MatchesFilters(attr, include_by_default))
194 return; 195 return;
195 if (!line->empty()) 196 if (!line->empty())
196 *line += base::ASCIIToUTF16(" "); 197 *line += base::ASCIIToUTF16(" ");
197 *line += attr; 198 *line += attr;
198 } 199 }
199 200
200 } // namespace content 201 } // namespace content
OLDNEW
« no previous file with comments | « components/domain_reliability/config.cc ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698