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

Side by Side Diff: webkit/glue/p2p_transport.h

Issue 6676101: Add P2PTransport interface in webkit_glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_P2P_TRANSPORT_H_
6 #define WEBKIT_GLUE_P2P_TRANSPORT_H_
7
8 #include <string>
9
10 namespace webkit_glue {
11
12 // Interface for P2P transport.
13 class P2PTransport {
14 public:
15 enum State {
16 STATE_NONE = 0,
17 STATE_WRITABLE = 1,
18 STATE_READABLE = 2,
19 };
20
21 class EventHandler {
22 public:
23 virtual ~EventHandler() {}
24
25 // Called for each local candidate.
26 virtual void OnCandidateReady(const std::string& address) = 0;
mallinath 2011/03/29 22:41:44 We might need some additional parameter to this fu
27
28 // Called when readable of writable state of the stream changes.
29 virtual void OnStateChange(State state) = 0;
30
31 // Called when a message received from the peer. P2PTransport keeps
32 // owneship of |data|.
33 virtual void OnMessageReceived(const char* data, size_t data_size) = 0;
34 };
35
36 virtual ~P2PTransport() {}
37
38 // Initialize transport using specified configuration.
39 virtual void Init(const std::string& config,
40 EventHandler* event_handler) = 0;
41
42 // Add candidate received from the remote peer.
43 virtual void AddRemoteCandidate(const std::string& address) = 0;
44
45 // Send data to the other end. Caller keeps ownership of |data|.
46 virtual void Send(const char* data, int data_size) = 0;
47 };
48
49 } // namespace webkit_glue
50
51 #endif // WEBKIT_GLUE_P2P_TRANSPORT_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698