summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/file_browser_handler.cc
blob: ea270b44012c6dfe067da0b7a575c34f3b02ddf9 (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) 2011 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.

#include "chrome/common/extensions/file_browser_handler.h"

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

FileBrowserHandler::FileBrowserHandler() {
}

FileBrowserHandler::~FileBrowserHandler() {
}

void FileBrowserHandler::AddPattern(const URLPattern& pattern) {
  patterns_.push_back(pattern);
}

void FileBrowserHandler::ClearPatterns() {
  patterns_.clear();
}

bool FileBrowserHandler::MatchesURL(const GURL& url) const {
  for (PatternList::const_iterator pattern = patterns_.begin();
       pattern != patterns_.end(); ++pattern) {
    if (pattern->MatchesUrl(url))
      return true;
  }
  return false;
}