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

Side by Side Diff: Source/modules/presentation/PresentationSession.h

Issue 1020303004: [PresentationAPI] Plumbing |onstatechange| event for the PresentationSession from Blink to platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PresentationSession_h 5 #ifndef PresentationSession_h
6 #define PresentationSession_h 6 #define PresentationSession_h
7 7
8 #include "core/events/EventTarget.h" 8 #include "core/events/EventTarget.h"
9 #include "core/frame/DOMWindowProperty.h" 9 #include "core/frame/DOMWindowProperty.h"
10 #include "public/platform/WebString.h"
11 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
mlamouri (slow - plz ping) 2015/03/23 17:54:16 With enum class for the enum, you can forward decl
whywhat 2015/03/23 21:12:16 I'll try that but if I have to pass the enum by re
10 #include "wtf/text/AtomicString.h" 12 #include "wtf/text/AtomicString.h"
11 #include "wtf/text/WTFString.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class Presentation; 16 class Presentation;
16 class PresentationController; 17 class PresentationController;
17 class WebPresentationSessionClient;
18 class WebString;
19 18
20 class PresentationSession final 19 class PresentationSession final
21 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion> 20 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion>
22 , public DOMWindowProperty { 21 , public DOMWindowProperty {
23 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>); 22 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>);
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession); 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession);
25 DEFINE_WRAPPERTYPEINFO(); 24 DEFINE_WRAPPERTYPEINFO();
26 public: 25 public:
27 static PresentationSession* take(WebPresentationSessionClient*, Presentation *); 26 static PresentationSession* take(WebPresentationSessionClient*, Presentation *);
28 static void dispose(WebPresentationSessionClient*); 27 static void dispose(WebPresentationSessionClient*);
29 virtual ~PresentationSession(); 28 virtual ~PresentationSession();
30 29
31 // EventTarget implementation. 30 // EventTarget implementation.
32 virtual const AtomicString& interfaceName() const override; 31 virtual const AtomicString& interfaceName() const override;
33 virtual ExecutionContext* executionContext() const override; 32 virtual ExecutionContext* executionContext() const override;
34 33
35 DECLARE_VIRTUAL_TRACE(); 34 DECLARE_VIRTUAL_TRACE();
36 35
37 const String& id() const { return m_id; } 36 const String id() const { return m_id; }
38 const AtomicString& state() const { return m_state; } 37 const AtomicString state() const;
39 38
40 void postMessage(const String& message); 39 void postMessage(const String& message);
41 void close(); 40 void close();
42 41
43 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 42 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
44 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 43 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
45 44
45 // Returns true if and only if the WebPresentationSessionClient represents t his session.
Peter Beverloo 2015/03/20 19:07:40 "matches" sounds like something that could be a pa
mlamouri (slow - plz ping) 2015/03/23 17:54:16 A PresentationSession being equal to a Presentatio
46 bool matches(WebPresentationSessionClient*) const;
47
48 // Notifies the session about its state change.
49 void didChangeState(WebPresentationSessionClient::SessionState);
50
46 private: 51 private:
47 PresentationSession(LocalFrame*, const WebString& id, const WebString& url); 52 PresentationSession(LocalFrame*, const WebString& id, const WebString& url);
48 53
49 // Returns the |PresentationController| object associated with the frame 54 // Returns the |PresentationController| object associated with the frame
50 // |Presentation| corresponds to. Can return |nullptr| if the frame is 55 // |Presentation| corresponds to. Can return |nullptr| if the frame is
51 // detached from the document. 56 // detached from the document.
52 PresentationController* presentationController(); 57 PresentationController* presentationController();
53 58
54 String m_id; 59 WebString m_id;
55 String m_url; 60 WebString m_url;
56 AtomicString m_state; 61 WebPresentationSessionClient::SessionState m_state;
57 }; 62 };
58 63
59 } // namespace blink 64 } // namespace blink
60 65
61 #endif // PresentationSession_h 66 #endif // PresentationSession_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698