OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PresentationAvailability_h | 5 #ifndef PresentationAvailability_h |
6 #define PresentationAvailability_h | 6 #define PresentationAvailability_h |
7 | 7 |
8 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
10 #include "core/page/PageLifecycleObserver.h" | 10 #include "core/page/PageLifecycleObserver.h" |
| 11 #include "modules/ModulesExport.h" |
11 #include "platform/weborigin/KURL.h" | 12 #include "platform/weborigin/KURL.h" |
12 #include "public/platform/WebURL.h" | 13 #include "public/platform/WebURL.h" |
13 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv
er.h" | 14 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv
er.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class ExecutionContext; | 18 class ExecutionContext; |
18 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
19 | 20 |
20 // Expose whether there is a presentation display available for |url|. The | 21 // Expose whether there is a presentation display available for |url|. The |
21 // object will be initialized with a default value passed via ::take() and will | 22 // object will be initialized with a default value passed via ::take() and will |
22 // then subscribe to receive callbacks if the status for |url| were to | 23 // then subscribe to receive callbacks if the status for |url| were to |
23 // change. The object will only listen to changes when required. | 24 // change. The object will only listen to changes when required. |
24 class PresentationAvailability final | 25 class MODULES_EXPORT PresentationAvailability final |
25 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAva
ilability> | 26 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAva
ilability> |
26 , public ActiveDOMObject | 27 , public ActiveDOMObject |
27 , public PageLifecycleObserver | 28 , public PageLifecycleObserver |
28 , public WebPresentationAvailabilityObserver { | 29 , public WebPresentationAvailabilityObserver { |
29 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationAvailability); | 30 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationAvailability); |
30 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationAvailability); | 31 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationAvailability); |
31 DEFINE_WRAPPERTYPEINFO(); | 32 DEFINE_WRAPPERTYPEINFO(); |
32 public: | 33 public: |
33 // For CallbackPromiseAdapter. | |
34 using WebType = bool; | |
35 | |
36 static PresentationAvailability* take(ScriptPromiseResolver*, const KURL&, b
ool); | 34 static PresentationAvailability* take(ScriptPromiseResolver*, const KURL&, b
ool); |
37 ~PresentationAvailability() override; | 35 ~PresentationAvailability() override; |
38 | 36 |
39 // EventTarget implementation. | 37 // EventTarget implementation. |
40 const AtomicString& interfaceName() const override; | 38 const AtomicString& interfaceName() const override; |
41 ExecutionContext* executionContext() const override; | 39 ExecutionContext* executionContext() const override; |
42 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool capture) override; | 40 bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<
EventListener>, bool capture) override; |
43 | 41 |
44 // WebPresentationAvailabilityObserver implementation. | 42 // WebPresentationAvailabilityObserver implementation. |
45 void availabilityChanged(bool) override; | 43 void availabilityChanged(bool) override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void updateListening(); | 75 void updateListening(); |
78 | 76 |
79 const KURL m_url; | 77 const KURL m_url; |
80 bool m_value; | 78 bool m_value; |
81 State m_state; | 79 State m_state; |
82 }; | 80 }; |
83 | 81 |
84 } // namespace blink | 82 } // namespace blink |
85 | 83 |
86 #endif // PresentationAvailability_h | 84 #endif // PresentationAvailability_h |
OLD | NEW |