Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_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" | 9 #include "base/callback_forward.h" |
| 10 #include "content/public/browser/service_worker_usage_info.h" | 10 #include "content/public/browser/service_worker_usage_info.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // Represents the per-StoragePartition ServiceWorker data. Must be used from | 15 // Represents the per-StoragePartition ServiceWorker data. |
| 16 // the IO thread. | |
| 17 class ServiceWorkerContext { | 16 class ServiceWorkerContext { |
| 18 public: | 17 public: |
| 19 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: | 18 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: |
| 20 // roughly, must be of the form "<origin>/<path>/*". | 19 // roughly, must be of the form "<origin>/<path>/*". |
| 21 typedef GURL Scope; | 20 typedef GURL Scope; |
| 22 | 21 |
| 23 typedef base::Callback<void(bool success)> ResultCallback; | 22 typedef base::Callback<void(bool success)> ResultCallback; |
| 24 | 23 |
| 25 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& | 24 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& |
| 26 usage_info)> GetUsageInfoCallback; | 25 usage_info)> GetUsageInfoCallback; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 49 // * No Service Worker was registered for |pattern|. | 48 // * No Service Worker was registered for |pattern|. |
| 50 // * Something unexpected goes wrong, like a renderer crash. | 49 // * Something unexpected goes wrong, like a renderer crash. |
| 51 virtual void UnregisterServiceWorker(const Scope& pattern, | 50 virtual void UnregisterServiceWorker(const Scope& pattern, |
| 52 const ResultCallback& callback) = 0; | 51 const ResultCallback& callback) = 0; |
| 53 | 52 |
| 54 // TODO(jyasskin): Provide a way to SendMessage to a Scope. | 53 // TODO(jyasskin): Provide a way to SendMessage to a Scope. |
| 55 | 54 |
| 56 // Synchronously releases all of the RenderProcessHosts that have Service | 55 // Synchronously releases all of the RenderProcessHosts that have Service |
| 57 // Workers running inside them, and prevents any new Service Worker instances | 56 // Workers running inside them, and prevents any new Service Worker instances |
| 58 // from starting up. | 57 // from starting up. |
| 59 virtual void Terminate() = 0; | 58 virtual void Terminate() = 0; |
|
michaeln
2014/10/22 22:52:46
I think this method is no longer needed.
falken
2014/10/23 02:06:38
Done.
| |
| 60 | 59 |
| 61 // Methods used in response to browsing data and quota manager requests. | 60 // Methods used in response to browsing data and quota manager requests. |
| 62 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0; | 61 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0; |
| 63 virtual void DeleteForOrigin(const GURL& origin_url) = 0; | 62 virtual void DeleteForOrigin(const GURL& origin_url) = 0; |
| 64 | 63 |
| 65 protected: | 64 protected: |
| 66 ServiceWorkerContext() {} | 65 ServiceWorkerContext() {} |
| 67 virtual ~ServiceWorkerContext() {} | 66 virtual ~ServiceWorkerContext() {} |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 } // namespace content | 69 } // namespace content |
| 71 | 70 |
| 72 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 71 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |