diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 02:05:39 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 02:05:39 +0000 |
commit | 719663e4f49853e2a9ff84bc0ac29cca484105d1 (patch) | |
tree | 175f6f17d37984d9fcea0698f28efece6d2195ef /chrome/common/extensions/extension.cc | |
parent | 6776c72f56c29972bfd47efc1a1cf1629e3c7da2 (diff) | |
download | chromium_src-719663e4f49853e2a9ff84bc0ac29cca484105d1.zip chromium_src-719663e4f49853e2a9ff84bc0ac29cca484105d1.tar.gz chromium_src-719663e4f49853e2a9ff84bc0ac29cca484105d1.tar.bz2 |
Introduce a new 'all_frames' property to content scripts and
default it to false. This should improve performance in
sites that use frames and elimiate confusion, since in most
cases developers *don't* expect content scripts to match
frames.
Review URL: http://codereview.chromium.org/412008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension.cc')
-rw-r--r-- | chrome/common/extensions/extension.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 4038eaa..9b69756 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -219,6 +219,17 @@ bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script, } } + // all frames + if (content_script->HasKey(keys::kAllFrames)) { + bool all_frames = false; + if (!content_script->GetBoolean(keys::kAllFrames, &all_frames)) { + *error = ExtensionErrorUtils::FormatErrorMessage( + errors::kInvalidAllFrames, IntToString(definition_index)); + return false; + } + result->set_match_all_frames(all_frames); + } + // matches ListValue* matches = NULL; if (!content_script->GetList(keys::kMatches, &matches)) { @@ -993,8 +1004,10 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id, if (!LoadUserScriptHelper(content_script, i, error, &script)) return false; // Failed to parse script context definition script.set_extension_id(id()); - if (converted_from_user_script_) + if (converted_from_user_script_) { script.set_emulate_greasemonkey(true); + script.set_match_all_frames(true); // greasemonkey matches all frames + } content_scripts_.push_back(script); } } |