Index: chrome/common/extensions/file_browser_action.cc |
=================================================================== |
--- chrome/common/extensions/file_browser_action.cc (revision 0) |
+++ chrome/common/extensions/file_browser_action.cc (revision 0) |
@@ -0,0 +1,47 @@ |
+// 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_action.h" |
+ |
+#include "chrome/common/extensions/url_pattern.h" |
+#include "googleurl/src/gurl.h" |
+ |
+FileBrowserAction::FileBrowserAction() { |
+} |
+ |
+ |
+FileBrowserAction::~FileBrowserAction() { |
+} |
+ |
+void FileBrowserAction::AddPattern(const URLPattern& pattern) { |
+ patterns_.push_back(pattern); |
+} |
+ |
+void FileBrowserAction::ClearPatterns() { |
+ patterns_.clear(); |
+} |
+ |
+bool FileBrowserAction::ContainsURL(const GURL& url) const { |
+ for (PatternList::const_iterator pattern = patterns_.begin(); |
+ pattern != patterns_.end(); ++pattern) { |
+ if (pattern->MatchesUrl(url)) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+bool FileBrowserAction::OverlapsWith(const FileBrowserAction& other) const { |
+ // Two extension extents overlap if there is any one URL that would match at |
+ // least one pattern in each of the extents. |
+ for (PatternList::const_iterator i = patterns_.begin(); |
+ i != patterns_.end(); ++i) { |
+ for (PatternList::const_iterator j = other.patterns().begin(); |
+ j != other.patterns().end(); ++j) { |
+ if (i->OverlapsWith(*j)) |
+ return true; |
+ } |
+ } |
+ |
+ return false; |
+} |
Property changes on: chrome/common/extensions/file_browser_action.cc |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |