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

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

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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/common/extensions/url_pattern.h" 11 #include "chrome/common/extensions/url_pattern.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 13
14 // Represents the set of URLs an extension uses for web content. 14 // Represents the set of URLs an extension uses for web content.
15 class ExtensionExtent { 15 class ExtensionExtent {
16 public: 16 public:
17 typedef std::vector<URLPattern> PatternList; 17 typedef std::vector<URLPattern> PatternList;
18 18
19 bool is_empty() const { return patterns_.empty(); } 19 bool is_empty() const { return patterns_.empty(); }
20 20
21 const PatternList& patterns() const { return patterns_; } 21 const PatternList& patterns() const { return patterns_; }
22 void AddPattern(const URLPattern& pattern) { patterns_.push_back(pattern); } 22 void AddPattern(const URLPattern& pattern) { patterns_.push_back(pattern); }
23 void ClearPaths() { patterns_.clear(); } 23 void ClearPaths() { patterns_.clear(); }
24 24
25 // Test if the extent contains a URL.
25 bool ContainsURL(const GURL& url) const; 26 bool ContainsURL(const GURL& url) const;
26 27
28 // Returns true if there is a single URL that would be in two extents.
29 bool OverlapsWith(const ExtensionExtent& other) const;
30
27 private: 31 private:
28 // The list of URL patterns that comprise the extent. 32 // The list of URL patterns that comprise the extent.
29 PatternList patterns_; 33 PatternList patterns_;
30 }; 34 };
31 35
32 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ 36 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/common/extensions/extension_extent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698