diff options
Diffstat (limited to 'chrome/browser/extensions/user_script_master.cc')
-rw-r--r-- | chrome/browser/extensions/user_script_master.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 7164dc1..23ef66f 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -45,6 +45,9 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader( static const StringPiece kUserScriptEng("// ==/UserScript=="); static const StringPiece kIncludeDeclaration("// @include "); static const StringPiece kMatchDeclaration("// @match "); + static const StringPiece kRunAtDeclaration("// @run-at "); + static const StringPiece kRunAtDocumentStartValue("document-start"); + static const StringPiece kRunAtDocumentEndValue("document-end"); while (line_start < script_text.length()) { line_end = script_text.find('\n', line_start); @@ -76,6 +79,11 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader( if (!pattern.Parse(value)) return false; script->add_url_pattern(pattern); + } else if (GetDeclarationValue(line, kRunAtDeclaration, &value)) { + if (value == kRunAtDocumentStartValue) + script->set_run_location(UserScript::DOCUMENT_START); + else if (value != kRunAtDocumentEndValue) + return false; } // TODO(aa): Handle more types of metadata. |