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

Side by Side Diff: chrome/common/extensions/url_pattern_set.cc

Issue 10443105: Take 2 at implementing activeTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: many more tests Created 8 years, 6 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 (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 <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 bool URLPatternSet::operator==(const URLPatternSet& other) const { 71 bool URLPatternSet::operator==(const URLPatternSet& other) const {
72 return patterns_ == other.patterns_; 72 return patterns_ == other.patterns_;
73 } 73 }
74 74
75 bool URLPatternSet::is_empty() const { 75 bool URLPatternSet::is_empty() const {
76 return patterns_.empty(); 76 return patterns_.empty();
77 } 77 }
78 78
79 size_t URLPatternSet::size() const {
80 return patterns_.size();
81 }
82
79 void URLPatternSet::AddPattern(const URLPattern& pattern) { 83 void URLPatternSet::AddPattern(const URLPattern& pattern) {
80 patterns_.insert(pattern); 84 patterns_.insert(pattern);
81 } 85 }
82 86
83 void URLPatternSet::ClearPatterns() { 87 void URLPatternSet::ClearPatterns() {
84 patterns_.clear(); 88 patterns_.clear();
85 } 89 }
86 90
87 bool URLPatternSet::Contains(const URLPatternSet& set) const { 91 bool URLPatternSet::Contains(const URLPatternSet& set) const {
88 return std::includes(patterns_.begin(), patterns_.end(), 92 return std::includes(patterns_.begin(), patterns_.end(),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return false; 156 return false;
153 } 157 }
154 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) { 158 if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) {
155 pattern.SetValidSchemes( 159 pattern.SetValidSchemes(
156 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); 160 pattern.valid_schemes() & ~URLPattern::SCHEME_FILE);
157 } 161 }
158 AddPattern(pattern); 162 AddPattern(pattern);
159 } 163 }
160 return true; 164 return true;
161 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698