Index: content/public/browser/service_worker_context.h |
diff --git a/content/browser/service_worker/service_worker_context.h b/content/public/browser/service_worker_context.h |
similarity index 25% |
rename from content/browser/service_worker/service_worker_context.h |
rename to content/public/browser/service_worker_context.h |
index d9f51f3165c14c89f134d2d74807bceb7a8a2b69..36f4a25c5cc2bc01b2e32cb439dc8248f8c429ef 100644 |
--- a/content/browser/service_worker/service_worker_context.h |
+++ b/content/public/browser/service_worker_context.h |
@@ -2,18 +2,39 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
-#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
+#ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
+#define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "content/public/common/service_worker_status_code.h" |
+#include "url/gurl.h" |
namespace content { |
-// Represents the per-BrowserContext ServiceWorker data. |
+// Represents the per-StoragePartition ServiceWorker data. Must be used from |
+// the UI thread. |
class ServiceWorkerContext { |
public: |
- // TODO(michaeln): This class is a place holder for content/public api |
- // which will come later. Promote this class when we get there. |
+ // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/index.html#url-scope: |
+ // roughly, must be of the form "<origin>/<path>/*". |
+ typedef GURL Scope; |
+ |
+ typedef base::Callback<void(ServiceWorkerStatusCode status)> |
+ RegistrationCallback; |
+ virtual void RegisterServiceWorker(const Scope& pattern, |
+ const GURL& script_url, |
+ int source_process_id, |
+ const RegistrationCallback& callback) = 0; |
+ |
+ typedef base::Callback<void(ServiceWorkerStatusCode status)> |
+ UnregistrationCallback; |
+ virtual void UnregisterServiceWorker( |
+ const GURL& pattern, |
+ int source_process_id, |
+ const UnregistrationCallback& callback) = 0; |
+ |
+ // TODO(jyasskin): Provide a way to SendMessage to a Scope. |
protected: |
ServiceWorkerContext() {} |
@@ -25,4 +46,4 @@ class ServiceWorkerContext { |
} // namespace content |
-#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
+#endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |