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

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: Changed the event listeners logic a bit. Addressed the comments. 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
Index: Source/modules/presentation/Presentation.h
diff --git a/Source/modules/presentation/Presentation.h b/Source/modules/presentation/Presentation.h
index f075f735defa029934d85005b0dfbde8dcd4e0ec..bc978f820db32ae3d9598e5f832b271c4164b428 100644
--- a/Source/modules/presentation/Presentation.h
+++ b/Source/modules/presentation/Presentation.h
@@ -12,8 +12,11 @@
namespace blink {
+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 {
@@ -37,9 +40,21 @@ 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);
private:
explicit Presentation(ExecutionContext*);
+ // Returns the |PresentationController| object associated with the frame |Presentation| corresponds to.
+ // Must never return null.
+ PresentationController* presentationController();
mlamouri (slow - plz ping) 2015/01/22 23:18:04 Are you sure that this must _never_ return nullptr
whywhat 2015/01/23 19:20:19 Done.
+
Member<PresentationSession> m_session;
};

Powered by Google App Engine
This is Rietveld 408576698