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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // * No Service Worker was registered for |pattern|. | 63 // * No Service Worker was registered for |pattern|. |
64 // * Something unexpected goes wrong, like a renderer crash. | 64 // * Something unexpected goes wrong, like a renderer crash. |
65 virtual void UnregisterServiceWorker(const Scope& pattern, | 65 virtual void UnregisterServiceWorker(const Scope& pattern, |
66 const ResultCallback& callback) = 0; | 66 const ResultCallback& callback) = 0; |
67 | 67 |
68 // Methods used in response to browsing data and quota manager requests. | 68 // Methods used in response to browsing data and quota manager requests. |
69 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0; | 69 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0; |
70 virtual void DeleteForOrigin(const GURL& origin_url, | 70 virtual void DeleteForOrigin(const GURL& origin_url, |
71 const ResultCallback& callback) = 0; | 71 const ResultCallback& callback) = 0; |
72 | 72 |
| 73 // Forces updating of ServiceWorker before next page load. |
| 74 // Used to clear stale ServiceWorker when an extension is updated. |
| 75 virtual void SetForceUpdateOnPageLoadForOrigin(const GURL& origin) = 0; |
| 76 |
73 // Returns true if a Service Worker registration exists that matches |url|, | 77 // Returns true if a Service Worker registration exists that matches |url|, |
74 // and if |other_url| falls inside the scope of the same registration. Note | 78 // and if |other_url| falls inside the scope of the same registration. Note |
75 // this still returns true even if there is a Service Worker registration | 79 // this still returns true even if there is a Service Worker registration |
76 // which has a longer match for |other_url|. | 80 // which has a longer match for |other_url|. |
77 // This function can be called from any thread, but the callback will always | 81 // This function can be called from any thread, but the callback will always |
78 // be called on the UI thread. | 82 // be called on the UI thread. |
79 virtual void CheckHasServiceWorker( | 83 virtual void CheckHasServiceWorker( |
80 const GURL& url, | 84 const GURL& url, |
81 const GURL& other_url, | 85 const GURL& other_url, |
82 const CheckHasServiceWorkerCallback& callback) = 0; | 86 const CheckHasServiceWorkerCallback& callback) = 0; |
83 | 87 |
84 // Stops all running workers on the given |origin|. | 88 // Stops all running workers on the given |origin|. |
85 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; | 89 virtual void StopAllServiceWorkersForOrigin(const GURL& origin) = 0; |
86 | 90 |
87 // Stops all running service workers and unregisters all service worker | 91 // Stops all running service workers and unregisters all service worker |
88 // registrations. This method is used in LayoutTests to make sure that the | 92 // registrations. This method is used in LayoutTests to make sure that the |
89 // existing service worker will not affect the succeeding tests. | 93 // existing service worker will not affect the succeeding tests. |
90 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; | 94 virtual void ClearAllServiceWorkersForTest(const base::Closure& callback) = 0; |
91 | 95 |
92 protected: | 96 protected: |
93 ServiceWorkerContext() {} | 97 ServiceWorkerContext() {} |
94 virtual ~ServiceWorkerContext() {} | 98 virtual ~ServiceWorkerContext() {} |
95 }; | 99 }; |
96 | 100 |
97 } // namespace content | 101 } // namespace content |
98 | 102 |
99 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ | 103 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ |
OLD | NEW |