57f114def8015809f4b2641bd9af728c367d9b7b
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / serviceworkers / NavigatorServiceWorker.h
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
3 // found in the LICENSE file.
4
5 #ifndef NavigatorServiceWorker_h
6 #define NavigatorServiceWorker_h
7
8 #include "bindings/v8/ScriptPromise.h"
9 #include "core/frame/Navigator.h"
10 #include "heap/Handle.h"
11 #include "platform/Supplementable.h"
12
13 namespace WebCore {
14
15 class Navigator;
16 class ServiceWorkerContainer;
17
18 class NavigatorServiceWorker FINAL : public NoBaseWillBeGarbageCollectedFinalized<NavigatorServiceWorker>, public WillBeHeapSupplement<Navigator>, DOMWindowProperty {
19     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorServiceWorker);
20 public:
21     virtual ~NavigatorServiceWorker();
22     static NavigatorServiceWorker& from(Navigator&);
23     static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator&);
24     static const char* supplementName();
25
26     static ServiceWorkerContainer* serviceWorker(ExecutionContext*, Navigator&);
27
28     void trace(Visitor*) { }
29
30 private:
31     explicit NavigatorServiceWorker(Navigator&);
32     ServiceWorkerContainer* serviceWorker(ExecutionContext*);
33
34     // DOMWindowProperty override.
35     virtual void willDetachGlobalObjectFromFrame() OVERRIDE;
36
37     RefPtr<ServiceWorkerContainer> m_serviceWorker;
38 };
39
40 } // namespace WebCore
41
42 #endif // NavigatorServiceWorker_h