Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4593)

Unified Diff: chrome/common/extensions/extension.cc

Issue 412008: Introduce a new 'all_frames' property to content scripts and (Closed)
Patch Set: responses to comments Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 7b39253bd637079e2dbd624c349cfba2188aeece..8c6ce645681876cb98c57d09b415b5491be53262 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -220,6 +220,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)) {
@@ -1003,8 +1014,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);
}
}
« no previous file with comments | « chrome/common/extensions/docs/static/content_scripts.html ('k') | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698