| Index: Source/modules/presentation/Presentation.h
|
| diff --git a/Source/modules/presentation/Presentation.h b/Source/modules/presentation/Presentation.h
|
| index f075f735defa029934d85005b0dfbde8dcd4e0ec..ab390a9678623cc0b12ff8b7bd0b9fbfdbf924a1 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 https://w3c.github.io/presentation-api/#navigatorpresentation for details.
|
| class Presentation final
|
| : public RefCountedGarbageCollectedEventTargetWithInlineData<Presentation>
|
| - , public ContextLifecycleObserver {
|
| + , public FrameDestructionObserver {
|
| 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;
|
| };
|
|
|