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

Side by Side Diff: extensions/common/user_script.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 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 "extensions/common/user_script.h" 5 #include "extensions/common/user_script.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/strings/pattern.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "extensions/common/switches.h" 12 #include "extensions/common/switches.h"
12 13
13 namespace { 14 namespace {
14 15
15 // This cannot be a plain int or int64 because we need to generate unique IDs 16 // This cannot be a plain int or int64 because we need to generate unique IDs
16 // from multiple threads. 17 // from multiple threads.
17 base::StaticAtomicSequenceNumber g_user_script_id_generator; 18 base::StaticAtomicSequenceNumber g_user_script_id_generator;
18 19
19 bool UrlMatchesGlobs(const std::vector<std::string>* globs, 20 bool UrlMatchesGlobs(const std::vector<std::string>* globs,
20 const GURL& url) { 21 const GURL& url) {
21 for (std::vector<std::string>::const_iterator glob = globs->begin(); 22 for (std::vector<std::string>::const_iterator glob = globs->begin();
22 glob != globs->end(); ++glob) { 23 glob != globs->end(); ++glob) {
23 if (MatchPattern(url.spec(), *glob)) 24 if (base::MatchPattern(url.spec(), *glob))
24 return true; 25 return true;
25 } 26 }
26 27
27 return false; 28 return false;
28 } 29 }
29 30
30 } // namespace 31 } // namespace
31 32
32 namespace extensions { 33 namespace extensions {
33 34
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 281 }
281 282
282 bool operator<(const UserScript& script1, const UserScript& script2) { 283 bool operator<(const UserScript& script1, const UserScript& script2) {
283 // The only kind of script that should be compared is the kind that has its 284 // The only kind of script that should be compared is the kind that has its
284 // IDs initialized to a meaningful value. 285 // IDs initialized to a meaningful value.
285 DCHECK(script1.id() != -1 && script2.id() != -1); 286 DCHECK(script1.id() != -1 && script2.id() != -1);
286 return script1.id() < script2.id(); 287 return script1.id() < script2.id();
287 } 288 }
288 289
289 } // namespace extensions 290 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/url_pattern.cc ('k') | extensions/shell/browser/shell_nacl_browser_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698