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.
5 #ifndef NavigatorServiceWorker_h
6 #define NavigatorServiceWorker_h
8 #include "core/frame/Navigator.h"
9 #include "platform/Supplementable.h"
10 #include "platform/heap/Handle.h"
16 class ServiceWorkerContainer;
18 class NavigatorServiceWorker FINAL : public NoBaseWillBeGarbageCollectedFinalized<NavigatorServiceWorker>, public WillBeHeapSupplement<Navigator>, DOMWindowProperty {
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(NavigatorServiceWorker);
21 virtual ~NavigatorServiceWorker();
22 static NavigatorServiceWorker* from(Document&);
23 static NavigatorServiceWorker& from(Navigator&);
24 static NavigatorServiceWorker* toNavigatorServiceWorker(Navigator&);
25 static const char* supplementName();
27 static ServiceWorkerContainer* serviceWorker(Navigator&);
29 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Navigator>::trace(visitor); }
32 explicit NavigatorServiceWorker(Navigator&);
33 ServiceWorkerContainer* serviceWorker();
35 // DOMWindowProperty override.
36 virtual void willDetachGlobalObjectFromFrame() OVERRIDE;
38 RefPtr<ServiceWorkerContainer> m_serviceWorker;
41 } // namespace WebCore
43 #endif // NavigatorServiceWorker_h