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 PushController_h
6 #define PushController_h
8 #include "core/page/Page.h"
9 #include "platform/Supplementable.h"
10 #include "wtf/Forward.h"
11 #include "wtf/Noncopyable.h"
12 #include "wtf/PassOwnPtr.h"
18 class PushController final : public NoBaseWillBeGarbageCollected<PushController>, public WillBeHeapSupplement<Page> {
19 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PushController);
20 WTF_MAKE_NONCOPYABLE(PushController);
23 static PassOwnPtrWillBeRawPtr<PushController> create(WebPushClient*);
24 static const char* supplementName();
25 static PushController* from(Page* page) { return static_cast<PushController*>(WillBeHeapSupplement<Page>::from(page, supplementName())); }
26 static WebPushClient* clientFrom(Page*);
28 WebPushClient* client() const { return m_client; }
30 virtual void trace(Visitor* visitor) override { WillBeHeapSupplement<Page>::trace(visitor); }
33 explicit PushController(WebPushClient*);
35 WebPushClient* m_client;
38 void providePushControllerTo(Page&, WebPushClient*);
42 #endif // PushController_h