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