Chromium Code Reviews| 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 26% |
| rename from content/browser/service_worker/service_worker_context.h |
| rename to content/public/browser/service_worker_context.h |
| index d9f51f3165c14c89f134d2d74807bceb7a8a2b69..b09e45a7f965afa39564414b9ee9841e94cae906 100644 |
| --- a/content/browser/service_worker/service_worker_context.h |
| +++ b/content/public/browser/service_worker_context.h |
| @@ -2,18 +2,36 @@ |
| // 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; |
|
jam
2014/03/26 22:58:39
nit: why this typdef? i.e. why not just have "cons
Jeffrey Yasskin
2014/03/27 02:51:59
I don't feel terribly strongly about this, since i
jam
2014/03/28 18:08:06
perhaps it should be a string instead of a GURL th
|
| + |
| + typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; |
| + |
| + virtual void RegisterServiceWorker(const Scope& pattern, |
|
jam
2014/03/26 22:58:39
nit: document all the methods
Jeffrey Yasskin
2014/03/27 20:33:06
Done. I'll need the SW folks to double-check my co
|
| + const GURL& script_url, |
| + int source_process_id, |
| + const StatusCallback& callback) = 0; |
| + |
| + virtual void UnregisterServiceWorker(const GURL& pattern, |
| + int source_process_id, |
| + const StatusCallback& callback) = 0; |
| + |
| + // TODO(jyasskin): Provide a way to SendMessage to a Scope. |
| protected: |
| ServiceWorkerContext() {} |
| @@ -25,4 +43,4 @@ class ServiceWorkerContext { |
| } // namespace content |
| -#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
| +#endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |