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
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_
6 #define CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h"
14 class WebServiceWorkerProviderClient
;
19 class ServiceWorkerDispatcher
;
20 class ServiceWorkerProviderContext
;
21 class ThreadSafeSender
;
23 // This class corresponds to one ServiceWorkerContainer interface in
24 // JS context (i.e. navigator.serviceWorker).
25 class WebServiceWorkerProviderImpl
26 : NON_EXPORTED_BASE(public blink::WebServiceWorkerProvider
) {
28 WebServiceWorkerProviderImpl(ThreadSafeSender
* thread_safe_sender
,
29 ServiceWorkerProviderContext
* context
);
30 virtual ~WebServiceWorkerProviderImpl();
32 virtual void setClient(blink::WebServiceWorkerProviderClient
* client
);
34 virtual void registerServiceWorker(const blink::WebURL
& pattern
,
35 const blink::WebURL
& script_url
,
36 WebServiceWorkerRegistrationCallbacks
*);
38 virtual void unregisterServiceWorker(
39 const blink::WebURL
& pattern
,
40 WebServiceWorkerUnregistrationCallbacks
*);
42 virtual void getRegistration(const blink::WebURL
& document_url
,
43 WebServiceWorkerGetRegistrationCallbacks
*);
44 virtual void getRegistrationForReady(
45 WebServiceWorkerGetRegistrationForReadyCallbacks
*);
48 void RemoveProviderClient();
49 ServiceWorkerDispatcher
* GetDispatcher();
51 scoped_refptr
<ThreadSafeSender
> thread_safe_sender_
;
52 scoped_refptr
<ServiceWorkerProviderContext
> context_
;
54 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerProviderImpl
);
57 } // namespace content
59 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_