diff options
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_interfaces.cc | 20 | ||||
-rw-r--r-- | webkit/appcache/appcache_interfaces.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/webkit/appcache/appcache_interfaces.cc b/webkit/appcache/appcache_interfaces.cc index a3b6f31..d7941be 100644 --- a/webkit/appcache/appcache_interfaces.cc +++ b/webkit/appcache/appcache_interfaces.cc @@ -4,6 +4,9 @@ #include "webkit/appcache/appcache_interfaces.h" +#include <set> + +#include "base/lazy_instance.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request.h" @@ -13,6 +16,13 @@ using WebKit::WebApplicationCacheHost; using WebKit::WebConsoleMessage; +namespace { + +base::LazyInstance<std::set<std::string> >::Leaky g_supported_schemes = + LAZY_INSTANCE_INITIALIZER; + +} // namespace + namespace appcache { const char kHttpScheme[] = "http"; @@ -77,8 +87,16 @@ bool Namespace::IsMatch(const GURL& url) const { return StartsWithASCII(url.spec(), namespace_url.spec(), true); } +void AddSupportedScheme(const char* scheme) { + g_supported_schemes.Get().insert(scheme); +} + bool IsSchemeSupported(const GURL& url) { - bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme); + bool supported = url.SchemeIs(kHttpScheme) || url.SchemeIs(kHttpsScheme) || + (!(g_supported_schemes == NULL) && + g_supported_schemes.Get().find(url.scheme()) != + g_supported_schemes.Get().end()); + #ifndef NDEBUG // TODO(michaeln): It would be really nice if this could optionally work for // file and filesystem urls too to help web developers experiment and test diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h index b45ee8f..0dfa4c4 100644 --- a/webkit/appcache/appcache_interfaces.h +++ b/webkit/appcache/appcache_interfaces.h @@ -171,6 +171,8 @@ extern const char kHttpsScheme[]; extern const char kHttpGETMethod[]; extern const char kHttpHEADMethod[]; +WEBKIT_STORAGE_EXPORT void AddSupportedScheme(const char* scheme); + bool IsSchemeSupported(const GURL& url); bool IsMethodSupported(const std::string& method); bool IsSchemeAndMethodSupported(const net::URLRequest* request); |