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

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

Issue 2876009: Re-implement app overlap detection with new extent syntax. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: donk Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extension_extent.h" 5 #include "chrome/common/extensions/extension_extent.h"
6 6
7 bool ExtensionExtent::ContainsURL(const GURL& url) const { 7 bool ExtensionExtent::ContainsURL(const GURL& url) const {
8 for (PatternList::const_iterator pattern = patterns_.begin(); 8 for (PatternList::const_iterator pattern = patterns_.begin();
9 pattern != patterns_.end(); ++pattern) { 9 pattern != patterns_.end(); ++pattern) {
10 if (pattern->MatchesUrl(url)) 10 if (pattern->MatchesUrl(url))
11 return true; 11 return true;
12 } 12 }
13 13
14 return false; 14 return false;
15 } 15 }
16
17 bool ExtensionExtent::OverlapsWith(const ExtensionExtent& other) const {
18 // Two extension extents overlap if there is any one URL that would match at
19 // least one pattern in each of the extents.
20 for (PatternList::const_iterator i = patterns_.begin();
21 i != patterns_.end(); ++i) {
22 for (PatternList::const_iterator j = other.patterns().begin();
23 j != other.patterns().end(); ++j) {
24 if (i->OverlapsWith(*j))
25 return true;
26 }
27 }
28
29 return false;
30 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_extent.h ('k') | chrome/common/extensions/extension_extent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698