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

Unified Diff: content/public/browser/service_worker_context.h

Issue 2934163003: Add a ServiceWorkerContextObserver to content's public API. (Closed)
Patch Set: Clarifying comment Created 3 years, 6 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 | « content/public/browser/BUILD.gn ('k') | content/public/browser/service_worker_context_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/service_worker_context.h
diff --git a/content/public/browser/service_worker_context.h b/content/public/browser/service_worker_context.h
index 22d13f9bd57ac84e19382a9430fc1a88f20b0199..35bbf822498bdb8bc1bf49fff3642553c2d7c60e 100644
--- a/content/public/browser/service_worker_context.h
+++ b/content/public/browser/service_worker_context.h
@@ -14,6 +14,8 @@
namespace content {
+class ServiceWorkerContextObserver;
+
enum class ServiceWorkerCapability {
NO_SERVICE_WORKER,
SERVICE_WORKER_NO_FETCH_HANDLER,
@@ -47,6 +49,13 @@ class ServiceWorkerContext {
// Must be called from the IO thread.
static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name);
+ // Returns true if |url| is within the service worker |scope|.
+ CONTENT_EXPORT static bool ScopeMatches(const GURL& scope, const GURL& url);
+
+ // Observer methods are always dispatched on the UI thread.
+ virtual void AddObserver(ServiceWorkerContextObserver* observer) = 0;
+ virtual void RemoveObserver(ServiceWorkerContextObserver* observer) = 0;
+
// Equivalent to calling navigator.serviceWorker.register(script_url, {scope:
// pattern}) from a renderer, except that |pattern| is an absolute URL instead
// of relative to some current origin. |callback| is passed true when the JS
« no previous file with comments | « content/public/browser/BUILD.gn ('k') | content/public/browser/service_worker_context_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698