diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 17:23:46 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 17:23:46 +0000 |
commit | 3bb8499b2cd51027ee896ccda306e2c55fc2c5f0 (patch) | |
tree | 9397873271e126f2f4b8eb4d00ae92a5a2fb387e /chrome/common/extensions/user_script.cc | |
parent | f59cdf7bf45ed21cf70c8d2bc43ef4cc70cc94c0 (diff) | |
download | chromium_src-3bb8499b2cd51027ee896ccda306e2c55fc2c5f0.zip chromium_src-3bb8499b2cd51027ee896ccda306e2c55fc2c5f0.tar.gz chromium_src-3bb8499b2cd51027ee896ccda306e2c55fc2c5f0.tar.bz2 |
FBTF: Forward declare and move constructors in chrome/common/extensions/.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3207002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/user_script.cc')
-rw-r--r-- | chrome/common/extensions/user_script.cc | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/chrome/common/extensions/user_script.cc b/chrome/common/extensions/user_script.cc index c568e8e..2a40bec 100644 --- a/chrome/common/extensions/user_script.cc +++ b/chrome/common/extensions/user_script.cc @@ -8,8 +8,9 @@ #include "base/string_util.h" namespace { -static bool UrlMatchesPatterns(const UserScript::PatternList* patterns, - const GURL& url) { + +bool UrlMatchesPatterns(const UserScript::PatternList* patterns, + const GURL& url) { for (UserScript::PatternList::const_iterator pattern = patterns->begin(); pattern != patterns->end(); ++pattern) { if (pattern->MatchesUrl(url)) @@ -19,8 +20,8 @@ static bool UrlMatchesPatterns(const UserScript::PatternList* patterns, return false; } -static bool UrlMatchesGlobs(const std::vector<std::string>* globs, - const GURL& url) { +bool UrlMatchesGlobs(const std::vector<std::string>* globs, + const GURL& url) { for (std::vector<std::string>::const_iterator glob = globs->begin(); glob != globs->end(); ++glob) { if (MatchPatternASCII(url.spec(), *glob)) @@ -29,7 +30,8 @@ static bool UrlMatchesGlobs(const std::vector<std::string>* globs, return false; } -} + +} // namespace // static const char UserScript::kFileExtension[] = ".user.js"; @@ -48,6 +50,34 @@ bool UserScript::HasUserScriptFileExtension(const FilePath& path) { return EndsWith(path.BaseName().value(), extension.value(), false); } + +UserScript::File::File(const FilePath& extension_root, + const FilePath& relative_path, + const GURL& url) + : extension_root_(extension_root), + relative_path_(relative_path), + url_(url) { +} + +UserScript::File::File() {} + +UserScript::File::~File() {} + +UserScript::UserScript() + : run_location_(DOCUMENT_IDLE), emulate_greasemonkey_(false), + match_all_frames_(false), incognito_enabled_(false), + allow_file_access_(false) { +} + +UserScript::~UserScript() { +} + +void UserScript::add_url_pattern(const URLPattern& pattern) { + url_patterns_.push_back(pattern); +} + +void UserScript::clear_url_patterns() { url_patterns_.clear(); } + bool UserScript::MatchesUrl(const GURL& url) const { if (url_patterns_.size() > 0) { if (!UrlMatchesPatterns(&url_patterns_, url)) |