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 WebServiceWorkerProxy_h | 5 #ifndef WebServiceWorkerProxy_h |
6 #define WebServiceWorkerProxy_h | 6 #define WebServiceWorkerProxy_h |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 // A proxy interface, passed via WebServiceWorker.setProxy() from blink to | 10 // A proxy interface, passed via WebServiceWorker.setProxy() from blink to |
11 // the embedder, to talk to the ServiceWorker object from embedder. | 11 // the embedder, to talk to the ServiceWorker object from embedder. |
12 class WebServiceWorkerProxy { | 12 class WebServiceWorkerProxy { |
13 public: | 13 public: |
14 // Informs the proxy that the service worker's state changed. The state | 14 // Returns true if the proxy is ready to be notified of service worker state |
15 // should be accessible via WebServiceWorker.state() but may not necessarily | 15 // changes. It may not be if it's waiting for the registration promise to |
16 // be immediately reflected. For example, this happens if the proxy is | 16 // resolve, while the browser side has registered and is proceeding to |
17 // waiting for the registration promise to resolve, while the browser has | 17 // install and activate the worker. |
18 // already registered and activated the worker. | 18 virtual bool isReady() = 0; |
19 virtual void onStateChanged(WebServiceWorkerState) = 0; | |
20 | 19 |
21 // FIXME: To be removed, this is just here as part of a three-sided patch. | 20 // Notifies the proxy that the service worker state changed. The new state |
| 21 // should be accessible via WebServiceWorker.state(). |
22 virtual void dispatchStateChangeEvent() = 0; | 22 virtual void dispatchStateChangeEvent() = 0; |
23 }; | 23 }; |
24 | 24 |
25 } // namespace blink | 25 } // namespace blink |
26 | 26 |
27 #endif // WebServiceWorkerProxy_h | 27 #endif // WebServiceWorkerProxy_h |
OLD | NEW |