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

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

Issue 1002293005: [PresentationAPI] Plumbing send() from PresentationSession IDL to platform/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added ASSERTs. Created 5 years, 8 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/fileapi/Blob.h"
mark a. foltz 2015/04/10 18:31:09 You can forward declare this instead of including
USE s.singapati at gmail.com 2015/04/13 09:38:23 Done.
9 #include "core/frame/DOMWindowProperty.h" 10 #include "core/frame/DOMWindowProperty.h"
10 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" 11 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
11 #include "wtf/text/WTFString.h" 12 #include "wtf/text/WTFString.h"
12 13
13 namespace WTF { 14 namespace WTF {
14 class AtomicString; 15 class AtomicString;
15 } // namespace WTF 16 } // namespace WTF
16 17
17 namespace blink { 18 namespace blink {
18 19
20 class DOMArrayBuffer;
21 class DOMArrayBufferView;
19 class Presentation; 22 class Presentation;
20 class PresentationController; 23 class PresentationController;
21 24
22 class PresentationSession final 25 class PresentationSession final
23 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion> 26 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion>
24 , public DOMWindowProperty { 27 , public DOMWindowProperty {
25 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>); 28 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>);
26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession); 29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession);
27 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
28 public: 31 public:
29 static PresentationSession* take(WebPresentationSessionClient*, Presentation *); 32 static PresentationSession* take(WebPresentationSessionClient*, Presentation *);
30 static void dispose(WebPresentationSessionClient*); 33 static void dispose(WebPresentationSessionClient*);
31 virtual ~PresentationSession(); 34 virtual ~PresentationSession();
32 35
33 // EventTarget implementation. 36 // EventTarget implementation.
34 virtual const AtomicString& interfaceName() const override; 37 virtual const AtomicString& interfaceName() const override;
35 virtual ExecutionContext* executionContext() const override; 38 virtual ExecutionContext* executionContext() const override;
36 39
37 DECLARE_VIRTUAL_TRACE(); 40 DECLARE_VIRTUAL_TRACE();
38 41
39 const String id() const { return m_id; } 42 const String id() const { return m_id; }
40 const WTF::AtomicString& state() const; 43 const WTF::AtomicString& state() const;
41 44
42 void postMessage(const String& message); 45 void send(const String& message, ExceptionState&);
46 void send(Blob* data, ExceptionState&);
47 void send(PassRefPtr<DOMArrayBuffer> data, ExceptionState&);
48 void send(PassRefPtr<DOMArrayBufferView> data, ExceptionState&);
43 void close(); 49 void close();
44 50
45 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 51 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 52 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
47 53
48 // Returns true if and only if the WebPresentationSessionClient represents t his session. 54 // Returns true if and only if the WebPresentationSessionClient represents t his session.
49 bool matches(WebPresentationSessionClient*) const; 55 bool matches(WebPresentationSessionClient*) const;
50 56
51 // Notifies the session about its state change. 57 // Notifies the session about its state change.
52 void didChangeState(WebPresentationSessionState); 58 void didChangeState(WebPresentationSessionState);
53 59
54 private: 60 private:
55 PresentationSession(LocalFrame*, const String& id, const String& url); 61 PresentationSession(LocalFrame*, const String& id, const String& url);
56 62
57 // Returns the |PresentationController| object associated with the frame 63 // Returns the |PresentationController| object associated with the frame
58 // |Presentation| corresponds to. Can return |nullptr| if the frame is 64 // |Presentation| corresponds to. Can return |nullptr| if the frame is
59 // detached from the document. 65 // detached from the document.
60 PresentationController* presentationController(); 66 PresentationController* presentationController();
61 67
62 String m_id; 68 String m_id;
63 String m_url; 69 String m_url;
64 WebPresentationSessionState m_state; 70 WebPresentationSessionState m_state;
65 }; 71 };
66 72
67 } // namespace blink 73 } // namespace blink
68 74
69 #endif // PresentationSession_h 75 #endif // PresentationSession_h
OLDNEW
« no previous file with comments | « Source/modules/presentation/PresentationController.cpp ('k') | Source/modules/presentation/PresentationSession.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698