diff options
Diffstat (limited to 'chrome/common/extensions/chrome_extensions_client.cc')
-rw-r--r-- | chrome/common/extensions/chrome_extensions_client.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 3fa2135..fbebb8c 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -6,6 +6,13 @@ #include "chrome/common/extensions/chrome_manifest_handlers.h" #include "chrome/common/extensions/features/base_feature_provider.h" +#include "chrome/common/url_constants.h" +#include "content/public/common/url_constants.h" +#include "extensions/common/permissions/permission_message.h" +#include "extensions/common/url_pattern_set.h" +#include "grit/generated_resources.h" +#include "ui/base/l10n/l10n_util.h" +#include "url/gurl.h" namespace extensions { @@ -33,6 +40,28 @@ void ChromeExtensionsClient::RegisterManifestHandlers() const { RegisterChromeManifestHandlers(); } +void ChromeExtensionsClient::FilterHostPermissions( + const URLPatternSet& hosts, + URLPatternSet* new_hosts, + std::set<PermissionMessage>* messages) const { + for (URLPatternSet::const_iterator i = hosts.begin(); + i != hosts.end(); ++i) { + // Filters out every URL pattern that matches chrome:// scheme. + if (i->scheme() == chrome::kChromeUIScheme) { + // chrome://favicon is the only URL for chrome:// scheme that we + // want to support. We want to deprecate the "chrome" scheme. + // We should not add any additional "host" here. + if (GURL(chrome::kChromeUIFaviconURL).host() != i->host()) + continue; + messages->insert(PermissionMessage( + PermissionMessage::kFavicon, + l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FAVICON))); + } else { + new_hosts->AddPattern(*i); + } + } +} + // static ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { return g_client.Pointer(); |