OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | |
10 #include "content/public/common/service_worker_status_code.h" | |
11 #include "url/gurl.h" | |
9 | 12 |
10 namespace content { | 13 namespace content { |
11 | 14 |
12 // Represents the per-BrowserContext ServiceWorker data. | 15 // Represents the per-StoragePartition ServiceWorker data. Must be used from |
16 // the UI thread. | |
13 class ServiceWorkerContext { | 17 class ServiceWorkerContext { |
14 public: | 18 public: |
15 // TODO(michaeln): This class is a place holder for content/public api | 19 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: |
16 // which will come later. Promote this class when we get there. | 20 // roughly, must be of the form "<origin>/<path>/*". |
21 typedef GURL Scope; | |
22 | |
23 typedef base::Callback<void(ServiceWorkerStatusCode status)> | |
24 RegistrationCallback; | |
25 virtual void RegisterServiceWorker(const Scope& pattern, | |
26 const GURL& script_url, | |
27 int source_process_id, | |
28 const RegistrationCallback& callback) = 0; | |
29 | |
30 typedef base::Callback<void(ServiceWorkerStatusCode status)> | |
31 UnregistrationCallback; | |
kinuko
2014/03/26 05:01:34
nit: feels slightly verbose to typedef two callbac
Jeffrey Yasskin
2014/03/26 19:58:52
I'm suspicious that we'll want the RegistrationCal
| |
32 virtual void UnregisterServiceWorker( | |
33 const GURL& pattern, | |
34 int source_process_id, | |
35 const UnregistrationCallback& callback) = 0; | |
36 | |
37 // TODO(jyasskin): Provide a way to SendMessage to a Scope. | |
17 | 38 |
18 protected: | 39 protected: |
19 ServiceWorkerContext() {} | 40 ServiceWorkerContext() {} |
20 virtual ~ServiceWorkerContext() {} | 41 virtual ~ServiceWorkerContext() {} |
21 | 42 |
22 private: | 43 private: |
23 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext); | 44 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext); |
24 }; | 45 }; |
25 | 46 |
26 } // namespace content | 47 } // namespace content |
27 | 48 |
28 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ | 49 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
OLD | NEW |