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 WebServiceWorkerRegistration_h | 5 #ifndef WebServiceWorkerRegistration_h |
6 #define WebServiceWorkerRegistration_h | 6 #define WebServiceWorkerRegistration_h |
7 | 7 |
8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
9 #include "public/platform/WebURL.h" | 9 #include "public/platform/WebURL.h" |
10 #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" | 10 #include "public/platform/modules/serviceworker/WebServiceWorkerError.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class WebServiceWorkerProvider; | 14 class WebServiceWorkerProvider; |
15 class WebServiceWorkerRegistrationProxy; | 15 class WebServiceWorkerRegistrationProxy; |
| 16 struct WebNavigationPreloadState; |
16 | 17 |
17 // The interface of the registration representation in the embedder. The | 18 // The interface of the registration representation in the embedder. The |
18 // embedder implements this interface and passes its handle | 19 // embedder implements this interface and passes its handle |
19 // (WebServiceWorkerRegistration::Handle) to Blink. Blink accesses the | 20 // (WebServiceWorkerRegistration::Handle) to Blink. Blink accesses the |
20 // implementation via the handle to update or unregister the registration. | 21 // implementation via the handle to update or unregister the registration. |
21 class WebServiceWorkerRegistration { | 22 class WebServiceWorkerRegistration { |
22 public: | 23 public: |
23 virtual ~WebServiceWorkerRegistration() {} | 24 virtual ~WebServiceWorkerRegistration() {} |
24 | 25 |
25 using WebServiceWorkerUpdateCallbacks = | 26 using WebServiceWorkerUpdateCallbacks = |
26 WebCallbacks<void, const WebServiceWorkerError&>; | 27 WebCallbacks<void, const WebServiceWorkerError&>; |
27 using WebServiceWorkerUnregistrationCallbacks = | 28 using WebServiceWorkerUnregistrationCallbacks = |
28 WebCallbacks<bool, const WebServiceWorkerError&>; | 29 WebCallbacks<bool, const WebServiceWorkerError&>; |
29 using WebEnableNavigationPreloadCallbacks = | 30 using WebEnableNavigationPreloadCallbacks = |
30 WebCallbacks<void, const WebServiceWorkerError&>; | 31 WebCallbacks<void, const WebServiceWorkerError&>; |
| 32 using WebGetNavigationPreloadStateCallbacks = |
| 33 WebCallbacks<const WebNavigationPreloadState&, |
| 34 const WebServiceWorkerError&>; |
31 | 35 |
32 // The handle interface that retains a reference to the implementation of | 36 // The handle interface that retains a reference to the implementation of |
33 // WebServiceWorkerRegistration in the embedder and is owned by | 37 // WebServiceWorkerRegistration in the embedder and is owned by |
34 // ServiceWorkerRegistration object in Blink. The embedder must keep the | 38 // ServiceWorkerRegistration object in Blink. The embedder must keep the |
35 // registration representation while Blink is owning this handle. | 39 // registration representation while Blink is owning this handle. |
36 class Handle { | 40 class Handle { |
37 public: | 41 public: |
38 virtual ~Handle() {} | 42 virtual ~Handle() {} |
39 virtual WebServiceWorkerRegistration* registration() { return nullptr; } | 43 virtual WebServiceWorkerRegistration* registration() { return nullptr; } |
40 }; | 44 }; |
41 | 45 |
42 virtual void setProxy(WebServiceWorkerRegistrationProxy*) {} | 46 virtual void setProxy(WebServiceWorkerRegistrationProxy*) {} |
43 virtual WebServiceWorkerRegistrationProxy* proxy() { return nullptr; } | 47 virtual WebServiceWorkerRegistrationProxy* proxy() { return nullptr; } |
44 virtual void proxyStopped() {} | 48 virtual void proxyStopped() {} |
45 | 49 |
46 virtual WebURL scope() const { return WebURL(); } | 50 virtual WebURL scope() const { return WebURL(); } |
47 virtual void update(WebServiceWorkerProvider*, | 51 virtual void update(WebServiceWorkerProvider*, |
48 WebServiceWorkerUpdateCallbacks*) {} | 52 WebServiceWorkerUpdateCallbacks*) {} |
49 virtual void unregister(WebServiceWorkerProvider*, | 53 virtual void unregister(WebServiceWorkerProvider*, |
50 WebServiceWorkerUnregistrationCallbacks*) {} | 54 WebServiceWorkerUnregistrationCallbacks*) {} |
51 | 55 |
52 virtual void enableNavigationPreload( | 56 virtual void enableNavigationPreload( |
53 bool enable, | 57 bool enable, |
54 WebServiceWorkerProvider*, | 58 WebServiceWorkerProvider*, |
55 std::unique_ptr<WebEnableNavigationPreloadCallbacks>) {} | 59 std::unique_ptr<WebEnableNavigationPreloadCallbacks>) {} |
| 60 virtual void getNavigationPreloadState( |
| 61 WebServiceWorkerProvider*, |
| 62 std::unique_ptr<WebGetNavigationPreloadStateCallbacks>) {} |
56 }; | 63 }; |
57 | 64 |
58 } // namespace blink | 65 } // namespace blink |
59 | 66 |
60 #endif // WebServiceWorkerRegistration_h | 67 #endif // WebServiceWorkerRegistration_h |
OLD | NEW |