| 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 "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // * Fetching |script_url| fails. | 32 // * Fetching |script_url| fails. |
| 33 // * |script_url| fails to parse or its top-level execution fails. | 33 // * |script_url| fails to parse or its top-level execution fails. |
| 34 // TODO: The error message for this needs to be available to developers. | 34 // TODO: The error message for this needs to be available to developers. |
| 35 // * Something unexpected goes wrong, like a renderer crash or a full disk. | 35 // * Something unexpected goes wrong, like a renderer crash or a full disk. |
| 36 virtual void RegisterServiceWorker(const Scope& pattern, | 36 virtual void RegisterServiceWorker(const Scope& pattern, |
| 37 const GURL& script_url, | 37 const GURL& script_url, |
| 38 int source_process_id, | 38 int source_process_id, |
| 39 const ResultCallback& callback) = 0; | 39 const ResultCallback& callback) = 0; |
| 40 | 40 |
| 41 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a | 41 // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a |
| 42 // renderer in |source_process_id|, except that |pattern| is an absolute URL | 42 // renderer, except that |pattern| is an absolute URL instead of relative to |
| 43 // instead of relative to some current origin. |callback| is passed true | 43 // some current origin. |callback| is passed true when the JS promise is |
| 44 // when the JS promise is fulfilled or false when the JS promise is rejected. | 44 // fulfilled or false when the JS promise is rejected. |
| 45 // | 45 // |
| 46 // Unregistration can fail if: | 46 // Unregistration can fail if: |
| 47 // * No Service Worker was registered for |pattern|. | 47 // * No Service Worker was registered for |pattern|. |
| 48 // * Something unexpected goes wrong, like a renderer crash. | 48 // * Something unexpected goes wrong, like a renderer crash. |
| 49 virtual void UnregisterServiceWorker(const Scope& pattern, | 49 virtual void UnregisterServiceWorker(const Scope& pattern, |
| 50 int source_process_id, | |
| 51 const ResultCallback& callback) = 0; | 50 const ResultCallback& callback) = 0; |
| 52 | 51 |
| 53 // TODO(jyasskin): Provide a way to SendMessage to a Scope. | 52 // TODO(jyasskin): Provide a way to SendMessage to a Scope. |
| 54 | 53 |
| 55 protected: | 54 protected: |
| 56 ServiceWorkerContext() {} | 55 ServiceWorkerContext() {} |
| 57 virtual ~ServiceWorkerContext() {} | 56 virtual ~ServiceWorkerContext() {} |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 } // namespace content | 59 } // namespace content |
| 61 | 60 |
| 62 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 61 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |