OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ |
6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerProvider.h" | 13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerProvider.h" |
12 | 14 |
13 namespace blink { | 15 namespace blink { |
14 class WebURL; | 16 class WebURL; |
15 class WebServiceWorkerProviderClient; | 17 class WebServiceWorkerProviderClient; |
16 } | 18 } |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 | 21 |
20 class ServiceWorkerDispatcher; | 22 class ServiceWorkerDispatcher; |
21 class ServiceWorkerProviderContext; | 23 class ServiceWorkerProviderContext; |
22 class ThreadSafeSender; | 24 class ThreadSafeSender; |
23 | 25 |
24 // This class corresponds to one ServiceWorkerContainer interface in | 26 // This class corresponds to one ServiceWorkerContainer interface in |
25 // JS context (i.e. navigator.serviceWorker). | 27 // JS context (i.e. navigator.serviceWorker). |
26 class WebServiceWorkerProviderImpl | 28 class WebServiceWorkerProviderImpl |
27 : NON_EXPORTED_BASE(public blink::WebServiceWorkerProvider) { | 29 : NON_EXPORTED_BASE(public blink::WebServiceWorkerProvider) { |
28 public: | 30 public: |
29 WebServiceWorkerProviderImpl(ThreadSafeSender* thread_safe_sender, | 31 WebServiceWorkerProviderImpl(ThreadSafeSender* thread_safe_sender, |
30 ServiceWorkerProviderContext* context); | 32 ServiceWorkerProviderContext* context); |
31 ~WebServiceWorkerProviderImpl() override; | 33 ~WebServiceWorkerProviderImpl() override; |
32 | 34 |
33 void setClient(blink::WebServiceWorkerProviderClient* client) override; | 35 void setClient(blink::WebServiceWorkerProviderClient* client) override; |
34 | 36 |
35 void registerServiceWorker(const blink::WebURL& pattern, | 37 void registerServiceWorker( |
36 const blink::WebURL& script_url, | 38 const blink::WebURL& pattern, |
37 WebServiceWorkerRegistrationCallbacks*) override; | 39 const blink::WebURL& script_url, |
38 void getRegistration(const blink::WebURL& document_url, | 40 std::unique_ptr<WebServiceWorkerRegistrationCallbacks>) override; |
39 WebServiceWorkerGetRegistrationCallbacks*) override; | 41 void getRegistration( |
40 void getRegistrations(WebServiceWorkerGetRegistrationsCallbacks*) override; | 42 const blink::WebURL& document_url, |
| 43 std::unique_ptr<WebServiceWorkerGetRegistrationCallbacks>) override; |
| 44 void getRegistrations( |
| 45 std::unique_ptr<WebServiceWorkerGetRegistrationsCallbacks>) override; |
41 void getRegistrationForReady( | 46 void getRegistrationForReady( |
42 WebServiceWorkerGetRegistrationForReadyCallbacks*) override; | 47 std::unique_ptr<WebServiceWorkerGetRegistrationForReadyCallbacks>) |
| 48 override; |
43 bool validateScopeAndScriptURL(const blink::WebURL& pattern, | 49 bool validateScopeAndScriptURL(const blink::WebURL& pattern, |
44 const blink::WebURL& script_url, | 50 const blink::WebURL& script_url, |
45 blink::WebString* error_message) override; | 51 blink::WebString* error_message) override; |
46 | 52 |
47 int provider_id() const; | 53 int provider_id() const; |
48 | 54 |
49 private: | 55 private: |
50 void RemoveProviderClient(); | 56 void RemoveProviderClient(); |
51 ServiceWorkerDispatcher* GetDispatcher(); | 57 ServiceWorkerDispatcher* GetDispatcher(); |
52 | 58 |
53 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 59 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
54 scoped_refptr<ServiceWorkerProviderContext> context_; | 60 scoped_refptr<ServiceWorkerProviderContext> context_; |
55 | 61 |
56 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerProviderImpl); | 62 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerProviderImpl); |
57 }; | 63 }; |
58 | 64 |
59 } // namespace content | 65 } // namespace content |
60 | 66 |
61 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ | 67 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_ |
OLD | NEW |