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

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

Issue 1131463006: [PresentationAPI] Plumbing send(Blob) from PresentationSession IDL to platform/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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"
10 #include "core/fileapi/FileError.h"
9 #include "core/frame/DOMWindowProperty.h" 11 #include "core/frame/DOMWindowProperty.h"
10 #include "public/platform/modules/presentation/WebPresentationSessionClient.h" 12 #include "public/platform/modules/presentation/WebPresentationSessionClient.h"
11 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
12 14
13 namespace WTF { 15 namespace WTF {
14 class AtomicString; 16 class AtomicString;
15 } // namespace WTF 17 } // namespace WTF
16 18
17 namespace blink { 19 namespace blink {
18 20
(...skipping 18 matching lines...) Expand all
37 virtual ExecutionContext* executionContext() const override; 39 virtual ExecutionContext* executionContext() const override;
38 40
39 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
40 42
41 const String id() const { return m_id; } 43 const String id() const { return m_id; }
42 const WTF::AtomicString& state() const; 44 const WTF::AtomicString& state() const;
43 45
44 void send(const String& message, ExceptionState&); 46 void send(const String& message, ExceptionState&);
45 void send(PassRefPtr<DOMArrayBuffer> data, ExceptionState&); 47 void send(PassRefPtr<DOMArrayBuffer> data, ExceptionState&);
46 void send(PassRefPtr<DOMArrayBufferView> data, ExceptionState&); 48 void send(PassRefPtr<DOMArrayBufferView> data, ExceptionState&);
49 void send(Blob* data, ExceptionState&);
47 void close(); 50 void close();
48 51
49 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); 52 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
50 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
51 54
52 // Returns true if and only if the WebPresentationSessionClient represents t his session. 55 // Returns true if and only if the WebPresentationSessionClient represents t his session.
53 bool matches(WebPresentationSessionClient*) const; 56 bool matches(WebPresentationSessionClient*) const;
54 57
55 // Notifies the session about its state change. 58 // Notifies the session about its state change.
56 void didChangeState(WebPresentationSessionState); 59 void didChangeState(WebPresentationSessionState);
57 60
58 // Notifies the session about new text message. 61 // Notifies the session about new text message.
59 void didReceiveTextMessage(const String& message); 62 void didReceiveTextMessage(const String& message);
60 63
61 private: 64 private:
65 // Blob data items are queued and sent after loading asynchronously.
66 struct Message {
67 Message(PassRefPtr<BlobDataHandle> blobDataHandle)
68 : blobDataHandle(blobDataHandle)
69 {
70 }
71
72 RefPtr<BlobDataHandle> blobDataHandle;
73 // TODO(): Check the need for queuing String and ArrayBuffer also.
mlamouri (slow - plz ping) 2015/05/19 13:08:55 TODO(<handle>), plz
mark a. foltz 2015/05/20 15:40:04 What does this mean? String and ArrayBuffer shoul
USE s.singapati at gmail.com 2015/05/21 19:49:55 Updated comments. Currently String and ArrayBuffer
74 };
75
62 PresentationSession(LocalFrame*, const String& id, const String& url); 76 PresentationSession(LocalFrame*, const String& id, const String& url);
63 77
64 // Returns the |PresentationController| object associated with the frame 78 // Returns the |PresentationController| object associated with the frame
65 // |Presentation| corresponds to. Can return |nullptr| if the frame is 79 // |Presentation| corresponds to. Can return |nullptr| if the frame is
66 // detached from the document. 80 // detached from the document.
67 PresentationController* presentationController(); 81 PresentationController* presentationController();
68 82
69 // Common send method for both ArrayBufferView and ArrayBuffer. 83 // Common send method for both ArrayBufferView and ArrayBuffer.
70 void sendInternal(const uint8_t* data, size_t, ExceptionState&); 84 void sendInternal(const uint8_t* data, size_t, ExceptionState&);
71 85
86 void handleMessageQueue();
87
88 class BlobLoader;
mark a. foltz 2015/05/20 15:40:04 Forward declarations should go immediately after p
mark a. foltz 2015/05/20 15:40:04 Should this be class BlobLoader { void didFinish
USE s.singapati at gmail.com 2015/05/21 19:49:54 Done. Updated comment. didFinishLoadingBlob() & di
USE s.singapati at gmail.com 2015/05/21 19:49:55 Done.
89 // Methods for BlobLoader.
mlamouri (slow - plz ping) 2015/05/19 13:08:55 s/Methods/Callbacks/
USE s.singapati at gmail.com 2015/05/21 19:49:55 Done.
90 void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>);
91 void didFailLoadingBlob(FileError::ErrorCode);
92
72 String m_id; 93 String m_id;
73 String m_url; 94 String m_url;
74 WebPresentationSessionState m_state; 95 WebPresentationSessionState m_state;
96
97 // For Blob data handling.
98 Member<BlobLoader> m_blobLoader;
99 Deque<OwnPtr<Message>> m_messages;
75 }; 100 };
76 101
77 } // namespace blink 102 } // namespace blink
78 103
79 #endif // PresentationSession_h 104 #endif // PresentationSession_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698