| OLD | NEW |
| 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 <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| 8 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 9 #include "base/pickle.h" | 12 #include "base/pickle.h" |
| 10 #include "base/strings/pattern.h" | 13 #include "base/strings/pattern.h" |
| 11 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 12 #include "extensions/common/switches.h" | 15 #include "extensions/common/switches.h" |
| 13 | 16 |
| 14 namespace { | 17 namespace { |
| 15 | 18 |
| 16 // This cannot be a plain int or int64 because we need to generate unique IDs | 19 // This cannot be a plain int or int64_t because we need to generate unique IDs |
| 17 // from multiple threads. | 20 // from multiple threads. |
| 18 base::StaticAtomicSequenceNumber g_user_script_id_generator; | 21 base::StaticAtomicSequenceNumber g_user_script_id_generator; |
| 19 | 22 |
| 20 bool UrlMatchesGlobs(const std::vector<std::string>* globs, | 23 bool UrlMatchesGlobs(const std::vector<std::string>* globs, |
| 21 const GURL& url) { | 24 const GURL& url) { |
| 22 for (std::vector<std::string>::const_iterator glob = globs->begin(); | 25 for (std::vector<std::string>::const_iterator glob = globs->begin(); |
| 23 glob != globs->end(); ++glob) { | 26 glob != globs->end(); ++glob) { |
| 24 if (base::MatchPattern(url.spec(), *glob)) | 27 if (base::MatchPattern(url.spec(), *glob)) |
| 25 return true; | 28 return true; |
| 26 } | 29 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 285 } |
| 283 | 286 |
| 284 bool operator<(const UserScript& script1, const UserScript& script2) { | 287 bool operator<(const UserScript& script1, const UserScript& script2) { |
| 285 // The only kind of script that should be compared is the kind that has its | 288 // The only kind of script that should be compared is the kind that has its |
| 286 // IDs initialized to a meaningful value. | 289 // IDs initialized to a meaningful value. |
| 287 DCHECK(script1.id() != -1 && script2.id() != -1); | 290 DCHECK(script1.id() != -1 && script2.id() != -1); |
| 288 return script1.id() < script2.id(); | 291 return script1.id() < script2.id(); |
| 289 } | 292 } |
| 290 | 293 |
| 291 } // namespace extensions | 294 } // namespace extensions |
| OLD | NEW |