Chromium Code Reviews| Index: chrome/browser/extensions/extension_management.cc |
| diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc |
| index 15caf92fcdc9223be5f44ea06435905af991c7b9..931c7c1443fbc014c75608c537a93b80af1b4883 100644 |
| --- a/chrome/browser/extensions/extension_management.cc |
| +++ b/chrome/browser/extensions/extension_management.cc |
| @@ -94,6 +94,24 @@ bool ExtensionManagement::IsInstallationAllowed(const ExtensionId& id) const { |
| return ReadById(id).installation_mode != INSTALLATION_BLOCKED; |
| } |
| +bool ExtensionManagement::IsOffstoreInstallAllowed(const GURL& url, |
| + const GURL& referrer_url) { |
| + // No allowed install sites specified, disallow by default. |
| + if (!global_settings_.has_restricted_install_sources) { |
| + return false; |
| + } |
| + |
| + const extensions::URLPatternSet& url_patterns = |
| + global_settings_.install_sources; |
| + |
| + if (!url_patterns.MatchesURL(url)) |
| + return false; |
| + |
| + // The referrer URL must also be whitelisted, unless the URL has the file |
| + // scheme (there's no referrer for those URLs). |
| + return url_patterns.MatchesURL(referrer_url) || url.SchemeIsFile(); |
|
Joao da Silva
2014/09/12 13:18:40
invert the order of these 2 tests: if the scheme i
|
| +} |
| + |
| const ExtensionManagement::IndividualSettings& ExtensionManagement::ReadById( |
| const ExtensionId& id) const { |
| DCHECK(crx_file::id_util::IdIsValid(id)) << "Invalid ID: " << id; |