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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.h

Issue 2471263003: [Presentation API] (4th)(1-UA blink side) Add WebPresentationConnection and WebPresentationConnecti… (Closed)
Patch Set: resolve code review comments from mlamouri Created 3 years, 10 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 PresentationConnection_h 5 #ifndef PresentationConnection_h
6 #define PresentationConnection_h 6 #define PresentationConnection_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/events/EventTarget.h" 9 #include "core/events/EventTarget.h"
10 #include "core/fileapi/Blob.h" 10 #include "core/fileapi/Blob.h"
11 #include "core/fileapi/FileError.h" 11 #include "core/fileapi/FileError.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "platform/weborigin/KURL.h" 13 #include "platform/weborigin/KURL.h"
14 #include "public/platform/modules/presentation/WebPresentationConnection.h"
15 #include "public/platform/modules/presentation/WebPresentationConnectionProxy.h"
14 #include "public/platform/modules/presentation/WebPresentationController.h" 16 #include "public/platform/modules/presentation/WebPresentationController.h"
15 #include "public/platform/modules/presentation/WebPresentationSessionInfo.h" 17 #include "public/platform/modules/presentation/WebPresentationSessionInfo.h"
16 #include "wtf/text/WTFString.h" 18 #include "wtf/text/WTFString.h"
17 #include <memory> 19 #include <memory>
18 20
19 namespace WTF { 21 namespace WTF {
20 class AtomicString; 22 class AtomicString;
21 } // namespace WTF 23 } // namespace WTF
22 24
23 namespace blink { 25 namespace blink {
24 26
25 class DOMArrayBuffer; 27 class DOMArrayBuffer;
26 class DOMArrayBufferView; 28 class DOMArrayBufferView;
27 class PresentationController; 29 class PresentationController;
28 class PresentationReceiver; 30 class PresentationReceiver;
29 class PresentationRequest; 31 class PresentationRequest;
30 32
31 class PresentationConnection final : public EventTargetWithInlineData, 33 class PresentationConnection final : public EventTargetWithInlineData,
32 public ContextClient { 34 public ContextClient,
35 public WebPresentationConnection {
33 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnection); 36 USING_GARBAGE_COLLECTED_MIXIN(PresentationConnection);
34 DEFINE_WRAPPERTYPEINFO(); 37 DEFINE_WRAPPERTYPEINFO();
35 38
36 public: 39 public:
37 // For CallbackPromiseAdapter. 40 // For CallbackPromiseAdapter.
38 static PresentationConnection* take(ScriptPromiseResolver*, 41 static PresentationConnection* take(ScriptPromiseResolver*,
39 const WebPresentationSessionInfo&, 42 const WebPresentationSessionInfo&,
40 PresentationRequest*); 43 PresentationRequest*);
41 static PresentationConnection* take(PresentationController*, 44 static PresentationConnection* take(PresentationController*,
42 const WebPresentationSessionInfo&, 45 const WebPresentationSessionInfo&,
(...skipping 28 matching lines...) Expand all
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate); 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(terminate);
72 75
73 // Returns true if and only if the the session info represents this 76 // Returns true if and only if the the session info represents this
74 // connection. 77 // connection.
75 bool matches(const WebPresentationSessionInfo&) const; 78 bool matches(const WebPresentationSessionInfo&) const;
76 79
77 // Returns true if this connection's id equals to |id| and its url equals to 80 // Returns true if this connection's id equals to |id| and its url equals to
78 // |url|. 81 // |url|.
79 bool matches(const String& id, const KURL&) const; 82 bool matches(const String& id, const KURL&) const;
80 83
81 // Notifies the connection about its state change.
82 void didChangeState(WebPresentationConnectionState);
83
84 // Notifies the connection about its state change to 'closed'. 84 // Notifies the connection about its state change to 'closed'.
85 void didClose(WebPresentationConnectionCloseReason, const String& message); 85 void didClose(WebPresentationConnectionCloseReason, const String& message);
86 86
87 // Notifies the presentation about new message. 87 // WebPresentationConnection implementation.
88 void didReceiveTextMessage(const String& message); 88 void bindProxy(std::unique_ptr<WebPresentationConnectionProxy>) override;
89 void didReceiveBinaryMessage(const uint8_t* data, size_t length); 89 void didReceiveTextMessage(const WebString& message) override;
90 void didReceiveBinaryMessage(const uint8_t* data, size_t length) override;
91 void didChangeState(WebPresentationConnectionState) override;
90 92
91 WebPresentationConnectionState getState(); 93 WebPresentationConnectionState getState();
92 94
93 protected: 95 protected:
94 // EventTarget implementation. 96 // EventTarget implementation.
95 void addedEventListener(const AtomicString& eventType, 97 void addedEventListener(const AtomicString& eventType,
96 RegisteredEventListener&) override; 98 RegisteredEventListener&) override;
97 99
98 private: 100 private:
99 class BlobLoader; 101 class BlobLoader;
(...skipping 26 matching lines...) Expand all
126 128
127 String m_id; 129 String m_id;
128 KURL m_url; 130 KURL m_url;
129 WebPresentationConnectionState m_state; 131 WebPresentationConnectionState m_state;
130 132
131 // For Blob data handling. 133 // For Blob data handling.
132 Member<BlobLoader> m_blobLoader; 134 Member<BlobLoader> m_blobLoader;
133 HeapDeque<Member<Message>> m_messages; 135 HeapDeque<Member<Message>> m_messages;
134 136
135 BinaryType m_binaryType; 137 BinaryType m_binaryType;
138
139 std::unique_ptr<WebPresentationConnectionProxy> m_proxy;
136 }; 140 };
137 141
138 } // namespace blink 142 } // namespace blink
139 143
140 #endif // PresentationConnection_h 144 #endif // PresentationConnection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698