Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: Source/modules/presentation/Presentation.h

Issue 832263007: Added plumbing for the availablechange event from Blink to WebPresentationClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added onClientDestroyed Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/presentation/NavigatorPresentation.idl ('k') | Source/modules/presentation/Presentation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/presentation/Presentation.h
diff --git a/Source/modules/presentation/Presentation.h b/Source/modules/presentation/Presentation.h
index f075f735defa029934d85005b0dfbde8dcd4e0ec..b061d3b33cbaded3a69028a1511fec64d17dd683 100644
--- a/Source/modules/presentation/Presentation.h
+++ b/Source/modules/presentation/Presentation.h
@@ -6,22 +6,31 @@
#define Presentation_h
#include "bindings/core/v8/ScriptPromise.h"
-#include "core/dom/ContextLifecycleObserver.h"
#include "core/events/EventTarget.h"
+#include "core/frame/DOMWindowProperty.h"
#include "modules/presentation/PresentationSession.h"
+#include "platform/heap/Handle.h"
+
+namespace WTF {
+class String;
+} // namespace WTF
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 DOMWindowProperty {
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.
@@ -32,13 +41,27 @@ public:
PresentationSession* session() const;
- ScriptPromise startSession(ScriptState*, const String& senderId, const String& presentationId);
- ScriptPromise joinSession(ScriptState*, const String& senderId, const String& presentationId);
+ ScriptPromise startSession(ScriptState*, const String& presentationUrl, const String& presentationId);
+ ScriptPromise joinSession(ScriptState*, const String& presentationUrl, const String& presentationId);
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;
};
« no previous file with comments | « Source/modules/presentation/NavigatorPresentation.idl ('k') | Source/modules/presentation/Presentation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698