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

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

Issue 12792005: Allow extensions on chrome:// URLs, when flag is set and permission is explicitly requested (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 7 years, 9 months 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
« no previous file with comments | « chrome/common/extensions/user_script.h ('k') | extensions/common/url_pattern.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/user_script.cc
diff --git a/chrome/common/extensions/user_script.cc b/chrome/common/extensions/user_script.cc
index dc62066c679348861e39773e63f3f14490108cbf..998374a1af1a84f1e16431ed22f9d8abc6417645 100644
--- a/chrome/common/extensions/user_script.cc
+++ b/chrome/common/extensions/user_script.cc
@@ -130,6 +130,7 @@ void UserScript::PickleURLPatternSet(::Pickle* pickle,
pattern != pattern_list.end(); ++pattern) {
pickle->WriteInt(pattern->valid_schemes());
pickle->WriteString(pattern->GetAsString());
+ pickle->WriteInt(pattern->allowed_schemes());
}
}
@@ -188,16 +189,13 @@ void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle,
URLPattern pattern(valid_schemes);
CHECK(pickle.ReadString(iter, &pattern_str));
- // We remove the file scheme if it's not actually allowed (see Extension::
- // LoadUserScriptHelper), but we need it temporarily while loading the
- // pattern so that it's valid.
- bool had_file_scheme = (valid_schemes & URLPattern::SCHEME_FILE) != 0;
- if (!had_file_scheme)
- pattern.SetValidSchemes(valid_schemes | URLPattern::SCHEME_FILE);
- CHECK(URLPattern::PARSE_SUCCESS == pattern.Parse(pattern_str));
- if (!had_file_scheme)
- pattern.SetValidSchemes(valid_schemes);
+ URLPattern::ParseResult result = pattern.Parse(pattern_str);
+ CHECK(URLPattern::PARSE_SUCCESS == result) <<
+ URLPattern::GetParseResultString(result) << " " << pattern_str.c_str();
+ int allowed_schemes;
+ if (pickle.ReadInt(iter, &allowed_schemes))
+ pattern.SetAllowedSchemes(allowed_schemes);
pattern_list->AddPattern(pattern);
}
}
« no previous file with comments | « chrome/common/extensions/user_script.h ('k') | extensions/common/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698