| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/url_pattern_set.h" | 5 #include "chrome/common/extensions/url_pattern_set.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/url_pattern.h" | 7 #include "chrome/common/extensions/url_pattern.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 | 9 |
| 10 // static |
| 11 void URLPatternSet::CreateUnion(const URLPatternSet& set1, |
| 12 const URLPatternSet& set2, |
| 13 URLPatternSet* out) { |
| 14 const URLPatternList list1 = set1.patterns(); |
| 15 const URLPatternList list2 = set2.patterns(); |
| 16 |
| 17 out->ClearPatterns(); |
| 18 |
| 19 for (size_t i = 0; i < list1.size(); ++i) |
| 20 out->AddPattern(list1.at(i)); |
| 21 |
| 22 for (size_t i = 0; i < list2.size(); ++i) |
| 23 out->AddPattern(list2.at(i)); |
| 24 } |
| 25 |
| 10 URLPatternSet::URLPatternSet() { | 26 URLPatternSet::URLPatternSet() { |
| 11 } | 27 } |
| 12 | 28 |
| 13 URLPatternSet::URLPatternSet(const URLPatternSet& rhs) | 29 URLPatternSet::URLPatternSet(const URLPatternSet& rhs) |
| 14 : patterns_(rhs.patterns_) { | 30 : patterns_(rhs.patterns_) { |
| 15 } | 31 } |
| 16 | 32 |
| 17 URLPatternSet::~URLPatternSet() { | 33 URLPatternSet::~URLPatternSet() { |
| 18 } | 34 } |
| 19 | 35 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 i != patterns_.end(); ++i) { | 67 i != patterns_.end(); ++i) { |
| 52 for (URLPatternList::const_iterator j = other.patterns().begin(); | 68 for (URLPatternList::const_iterator j = other.patterns().begin(); |
| 53 j != other.patterns().end(); ++j) { | 69 j != other.patterns().end(); ++j) { |
| 54 if (i->OverlapsWith(*j)) | 70 if (i->OverlapsWith(*j)) |
| 55 return true; | 71 return true; |
| 56 } | 72 } |
| 57 } | 73 } |
| 58 | 74 |
| 59 return false; | 75 return false; |
| 60 } | 76 } |
| OLD | NEW |