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

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: Fix layout test: change postMessage to send. 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/frame/DOMWindowProperty.h" 9 #include "core/frame/DOMWindowProperty.h"
10 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" 10 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
11 #include "wtf/text/WTFString.h" 11 #include "wtf/text/WTFString.h"
12 12
13 namespace WTF { 13 namespace WTF {
14 class AtomicString; 14 class AtomicString;
15 } // namespace WTF 15 } // namespace WTF
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class DOMArrayBuffer;
20 class DOMArrayBufferView;
19 class Presentation; 21 class Presentation;
20 class PresentationController; 22 class PresentationController;
21 23
22 class PresentationSession final 24 class PresentationSession final
23 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion> 25 : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSes sion>
24 , public DOMWindowProperty { 26 , public DOMWindowProperty {
25 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>); 27 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<P resentationSession>);
26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession); 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession);
27 DEFINE_WRAPPERTYPEINFO(); 29 DEFINE_WRAPPERTYPEINFO();
28 public: 30 public:
29 static PresentationSession* take(WebPresentationSessionClient*, Presentation *); 31 static PresentationSession* take(WebPresentationSessionClient*, Presentation *);
30 static void dispose(WebPresentationSessionClient*); 32 static void dispose(WebPresentationSessionClient*);
31 virtual ~PresentationSession(); 33 virtual ~PresentationSession();
32 34
33 // EventTarget implementation. 35 // EventTarget implementation.
34 virtual const AtomicString& interfaceName() const override; 36 virtual const AtomicString& interfaceName() const override;
35 virtual ExecutionContext* executionContext() const override; 37 virtual ExecutionContext* executionContext() const override;
36 38
37 DECLARE_VIRTUAL_TRACE(); 39 DECLARE_VIRTUAL_TRACE();
38 40
39 const String id() const { return m_id; } 41 const String id() const { return m_id; }
40 const WTF::AtomicString& state() const; 42 const WTF::AtomicString& state() const;
41 43
42 void postMessage(const String& message); 44 void send(const String& message, ExceptionState&);
45 void send(PassRefPtr<DOMArrayBuffer> data, ExceptionState&);
46 void send(PassRefPtr<DOMArrayBufferView> data, ExceptionState&);
43 void close(); 47 void close();
44 48
45 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 49 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 50 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
47 51
48 // Returns true if and only if the WebPresentationSessionClient represents t his session. 52 // Returns true if and only if the WebPresentationSessionClient represents t his session.
49 bool matches(WebPresentationSessionClient*) const; 53 bool matches(WebPresentationSessionClient*) const;
50 54
51 // Notifies the session about its state change. 55 // Notifies the session about its state change.
52 void didChangeState(WebPresentationSessionState); 56 void didChangeState(WebPresentationSessionState);
53 57
54 private: 58 private:
55 PresentationSession(LocalFrame*, const String& id, const String& url); 59 PresentationSession(LocalFrame*, const String& id, const String& url);
56 60
57 // Returns the |PresentationController| object associated with the frame 61 // Returns the |PresentationController| object associated with the frame
58 // |Presentation| corresponds to. Can return |nullptr| if the frame is 62 // |Presentation| corresponds to. Can return |nullptr| if the frame is
59 // detached from the document. 63 // detached from the document.
60 PresentationController* presentationController(); 64 PresentationController* presentationController();
61 65
66 // Common send method for both ArrayBufferView and ArrayBuffer.
67 void sendInternal(const uint8_t* data, size_t, ExceptionState&);
68
62 String m_id; 69 String m_id;
63 String m_url; 70 String m_url;
64 WebPresentationSessionState m_state; 71 WebPresentationSessionState m_state;
65 }; 72 };
66 73
67 } // namespace blink 74 } // namespace blink
68 75
69 #endif // PresentationSession_h 76 #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