Index: chrome/common/extensions/user_script.cc |
diff --git a/chrome/common/extensions/user_script.cc b/chrome/common/extensions/user_script.cc |
index a73b65b0641c04b510894be3a0b5877f53fd5c54..846d1c0465c8d5a6d7963815d9b33628072c02ee 100644 |
--- a/chrome/common/extensions/user_script.cc |
+++ b/chrome/common/extensions/user_script.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// 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. |
@@ -38,8 +38,7 @@ const char UserScript::kFileExtension[] = ".user.js"; |
// static |
const int UserScript::kValidUserScriptSchemes = |
- URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | |
- URLPattern::SCHEME_FILE | URLPattern::SCHEME_FTP; |
+ URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | URLPattern::SCHEME_FTP; |
bool UserScript::IsURLUserScript(const GURL& url, |
const std::string& mime_type) { |
@@ -61,8 +60,7 @@ UserScript::File::~File() {} |
UserScript::UserScript() |
: run_location_(DOCUMENT_IDLE), emulate_greasemonkey_(false), |
- match_all_frames_(false), incognito_enabled_(false), |
- allow_file_access_(false) { |
+ match_all_frames_(false), incognito_enabled_(false) { |
} |
UserScript::~UserScript() { |
@@ -72,25 +70,17 @@ 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_.empty()) { |
- if (!UrlMatchesPatterns(&url_patterns_, url)) |
- return false; |
- } |
+ if (UrlMatchesPatterns(&url_patterns_, url)) |
+ return true; |
- if (!globs_.empty()) { |
- if (!UrlMatchesGlobs(&globs_, url)) |
- return false; |
- } |
+ if (UrlMatchesGlobs(&exclude_globs_, url)) |
+ return false; |
- if (!exclude_globs_.empty()) { |
- if (UrlMatchesGlobs(&exclude_globs_, url)) |
- return false; |
- } |
+ if (UrlMatchesGlobs(&globs_, url)) |
+ return true; |
- return true; |
+ return false; |
} |
void UserScript::File::Pickle(::Pickle* pickle) const { |
@@ -113,7 +103,6 @@ void UserScript::Pickle(::Pickle* pickle) const { |
pickle->WriteBool(emulate_greasemonkey()); |
pickle->WriteBool(match_all_frames()); |
pickle->WriteBool(is_incognito_enabled()); |
- pickle->WriteBool(allow_file_access()); |
// Write globs. |
std::vector<std::string>::const_iterator glob; |
@@ -160,7 +149,6 @@ void UserScript::Unpickle(const ::Pickle& pickle, void** iter) { |
CHECK(pickle.ReadBool(iter, &emulate_greasemonkey_)); |
CHECK(pickle.ReadBool(iter, &match_all_frames_)); |
CHECK(pickle.ReadBool(iter, &incognito_enabled_)); |
- CHECK(pickle.ReadBool(iter, &allow_file_access_)); |
// Read globs. |
size_t num_globs = 0; |