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/modules/serviceworker/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
*);
37 virtual void getRegistration(const blink::WebURL
& document_url
,
38 WebServiceWorkerGetRegistrationCallbacks
*);
39 virtual void getRegistrations(WebServiceWorkerGetRegistrationsCallbacks
*);
40 virtual void getRegistrationForReady(
41 WebServiceWorkerGetRegistrationForReadyCallbacks
*);
42 virtual bool validateScopeAndScriptURL(const blink::WebURL
& pattern
,
43 const blink::WebURL
& script_url
,
44 blink::WebString
* error_message
);
46 int provider_id() const;
49 void RemoveProviderClient();
50 ServiceWorkerDispatcher
* GetDispatcher();
52 scoped_refptr
<ThreadSafeSender
> thread_safe_sender_
;
53 scoped_refptr
<ServiceWorkerProviderContext
> context_
;
55 DISALLOW_COPY_AND_ASSIGN(WebServiceWorkerProviderImpl
);
58 } // namespace content
60 #endif // CONTENT_CHILD_SERVICE_WORKER_WEB_SERVICE_WORKER_PROVIDER_IMPL_H_