summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_extent.h
blob: df8d02d020b668085fcd36f233d34d5f71981d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
#define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_

#include <string>
#include <vector>

#include "chrome/common/extensions/url_pattern.h"
#include "googleurl/src/gurl.h"

// Represents the set of URLs an extension uses for web content.
class ExtensionExtent {
 public:
  typedef std::vector<URLPattern> PatternList;

  bool is_empty() const { return patterns_.empty(); }

  const PatternList& patterns() const { return patterns_; }
  void AddPattern(const URLPattern& pattern) { patterns_.push_back(pattern); }
  void ClearPaths() { patterns_.clear(); }

  bool ContainsURL(const GURL& url) const;

 private:
  // The list of URL patterns that comprise the extent.
  PatternList patterns_;
};

#endif  // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_