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 "base/memory/scoped_ptr.h"
11 #include "third_party/WebKit/public/platform/WebServiceWorkerProvider.h"
15 class WebServiceWorkerProviderClient
;
20 class ServiceWorkerDispatcher
;
21 class ServiceWorkerProviderContext
;
22 class ThreadSafeSender
;
24 // This class corresponds to one ServiceWorkerContainer interface in
25 // JS context (i.e. navigator.serviceWorker).
26 class WebServiceWorkerProviderImpl
27 : NON_EXPORTED_BASE(public blink::WebServiceWorkerProvider
) {
29 WebServiceWorkerProviderImpl(ThreadSafeSender
* thread_safe_sender
,
30 ServiceWorkerProviderContext
* context
);
31 virtual ~WebServiceWorkerProviderImpl();
33 virtual void setClient(blink::WebServiceWorkerProviderClient
* client
);
35 virtual void registerServiceWorker(const blink::WebURL
& pattern
,
36 const blink::WebURL
& script_url
,
37 WebServiceWorkerRegistrationCallbacks
*);
39 virtual void unregisterServiceWorker(
40 const blink::WebURL
& pattern
,
41 WebServiceWorkerUnregistrationCallbacks
*);
43 virtual void getRegistration(const blink::WebURL
& document_url
,
44 WebServiceWorkerGetRegistrationCallbacks
*);
46 ServiceWorkerProviderContext
* context() { return context_
.get(); }
48 int provider_id() const { return provider_id_
; }
51 void RemoveScriptClient();
52 ServiceWorkerDispatcher
* GetDispatcher();
54 scoped_refptr
<ThreadSafeSender
> thread_safe_sender_
;
55 scoped_refptr
<ServiceWorkerProviderContext
> context_
;
56 const int provider_id_
;
58 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerProviderImpl
);
61 } // namespace content
63 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_