Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PresentationAvailability_h | |
| 6 #define PresentationAvailability_h | |
| 7 | |
| 8 #include "core/dom/ActiveDOMObject.h" | |
| 9 #include "core/events/EventTarget.h" | |
| 10 #include "public/platform/modules/presentation/WebPresentationAvailabilityObserv er.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class ExecutionContext; | |
| 15 class ScriptPromiseResolver; | |
| 16 | |
| 17 // Expose whether a device is available. | |
|
whywhat
2015/07/02 22:32:37
nit: Expand the comment? Also, we call devices/dis
mlamouri (slow - plz ping)
2015/07/03 13:58:26
Done.
| |
| 18 class PresentationAvailability final | |
| 19 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationAva ilability> | |
| 20 , public ActiveDOMObject | |
|
whywhat
2015/07/02 22:32:37
Does it have to be ActiveDOMObject? It's not part
mlamouri (slow - plz ping)
2015/07/03 13:58:26
ActiveDOMObject are actually objects associated to
| |
| 21 , public WebPresentationAvailabilityObserver { | |
| 22 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationAvailability); | |
| 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationAvailability); | |
| 24 DEFINE_WRAPPERTYPEINFO(); | |
| 25 public: | |
| 26 static PresentationAvailability* take(ScriptPromiseResolver*, bool); | |
| 27 | |
| 28 static PresentationAvailability* create(ExecutionContext*, bool); | |
| 29 ~PresentationAvailability() override; | |
| 30 | |
| 31 // EventTarget implementation. | |
| 32 const AtomicString& interfaceName() const override; | |
| 33 ExecutionContext* executionContext() const override; | |
| 34 | |
| 35 // WebPresentationAvailabilityObserver implementation. | |
| 36 void availabilityChanged(bool) override; | |
| 37 | |
| 38 // ActiveDOMObject implementation. | |
| 39 bool hasPendingActivity() const override; | |
| 40 void suspend() override; | |
| 41 void resume() override; | |
| 42 void stop() override; | |
| 43 | |
| 44 bool value() const; | |
| 45 | |
| 46 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | |
| 47 | |
| 48 DECLARE_VIRTUAL_TRACE(); | |
| 49 | |
| 50 private: | |
| 51 PresentationAvailability(ExecutionContext*, bool); | |
| 52 | |
| 53 void startListening(); | |
| 54 void stopListening(); | |
| 55 | |
| 56 bool m_value; | |
| 57 bool m_listening; | |
| 58 }; | |
| 59 | |
| 60 } // namespace blink | |
| 61 | |
| 62 #endif // PresentationAvailability_h | |
| OLD | NEW |