Chromium Code Reviews| Index: Source/modules/presentation/Presentation.h |
| diff --git a/Source/modules/presentation/Presentation.h b/Source/modules/presentation/Presentation.h |
| index f075f735defa029934d85005b0dfbde8dcd4e0ec..dc30561eddf0864d379260098e51cd7be8bf42c1 100644 |
| --- a/Source/modules/presentation/Presentation.h |
| +++ b/Source/modules/presentation/Presentation.h |
| @@ -6,22 +6,26 @@ |
| #define Presentation_h |
| #include "bindings/core/v8/ScriptPromise.h" |
| -#include "core/dom/ContextLifecycleObserver.h" |
| #include "core/events/EventTarget.h" |
| +#include "core/frame/FrameDestructionObserver.h" |
| #include "modules/presentation/PresentationSession.h" |
| namespace blink { |
| +class LocalFrame; |
| +class PresentationController; |
| class ScriptState; |
| +// Implements the main entry point of the Presentation API corresponding to the Presentation.idl |
| +// See http://w3c.github.io/presentation-api/#navigatorpresentation for details. |
| class Presentation final |
| : public RefCountedGarbageCollectedEventTargetWithInlineData<Presentation> |
| - , public ContextLifecycleObserver { |
| + , public FrameDestructionObserver { |
|
mlamouri (slow - plz ping)
2015/01/26 10:24:44
It seems that most things are using DOMWindowPrope
whywhat
2015/01/26 11:18:05
Acknowledged.
Mike West
2015/01/27 17:46:08
DOMWindowProperty is the right thing to use here;
whywhat
2015/01/27 22:06:07
Done.
|
| DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<Presentation>); |
| WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Presentation); |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static Presentation* create(ExecutionContext*); |
| + static Presentation* create(LocalFrame*); |
| virtual ~Presentation(); |
| // EventTarget implementation. |
| @@ -37,8 +41,22 @@ public: |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(availablechange); |
| + // The embedder needs to keep track if anything is listening to the event so it could stop the |
| + // might be expensive screen discovery process. |
| + virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override; |
| + virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override; |
| + virtual void removeAllEventListeners() override; |
| + |
| + // Called when the |availablechange| event needs to be fired. |
| + void didChangeAvailability(bool available); |
| + // Queried by the controller if |availablechange| event has any listeners. |
| + bool isAvailableChangeWatched() const; |
| private: |
| - explicit Presentation(ExecutionContext*); |
| + explicit Presentation(LocalFrame*); |
| + |
| + // Returns the |PresentationController| object associated with the frame |Presentation| corresponds to. |
| + // Can return |nullptr| if the frame is detached from the document. |
| + PresentationController* presentationController(); |
| Member<PresentationSession> m_session; |
| }; |