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

Side by Side Diff: remoting/protocol/session.h

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 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 | « remoting/protocol/rtp_writer.cc ('k') | remoting/protocol/session_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 REMOTING_PROTOCOL_SESSION_H_ 5 #ifndef REMOTING_PROTOCOL_SESSION_H_
6 #define REMOTING_PROTOCOL_SESSION_H_ 6 #define REMOTING_PROTOCOL_SESSION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // TODO(sergeyu): Move error codes to a separate file. 52 // TODO(sergeyu): Move error codes to a separate file.
53 enum Error { 53 enum Error {
54 OK = 0, 54 OK = 0,
55 PEER_IS_OFFLINE, 55 PEER_IS_OFFLINE,
56 SESSION_REJECTED, 56 SESSION_REJECTED,
57 INCOMPATIBLE_PROTOCOL, 57 INCOMPATIBLE_PROTOCOL,
58 CHANNEL_CONNECTION_ERROR, 58 CHANNEL_CONNECTION_ERROR,
59 }; 59 };
60 60
61 typedef Callback1<State>::Type StateChangeCallback; 61 typedef base::Callback<void(State)> StateChangeCallback;
62 62
63 // TODO(sergeyu): Specify connection error code when channel 63 // TODO(sergeyu): Specify connection error code when channel
64 // connection fails. 64 // connection fails.
65 typedef base::Callback<void(net::StreamSocket*)> StreamChannelCallback; 65 typedef base::Callback<void(net::StreamSocket*)> StreamChannelCallback;
66 typedef base::Callback<void(net::Socket*)> DatagramChannelCallback; 66 typedef base::Callback<void(net::Socket*)> DatagramChannelCallback;
67 67
68 Session() { } 68 Session() { }
69 virtual ~Session() { } 69 virtual ~Session() { }
70 70
71 // Set callback that is called when state of the connection is changed. 71 // Set callback that is called when state of the connection is changed.
72 // Must be called on the jingle thread only. 72 // Must be called on the jingle thread only.
73 virtual void SetStateChangeCallback(StateChangeCallback* callback) = 0; 73 virtual void SetStateChangeCallback(const StateChangeCallback& callback) = 0;
74 74
75 // Returns error code for a failed session. 75 // Returns error code for a failed session.
76 virtual Error error() = 0; 76 virtual Error error() = 0;
77 77
78 // Creates new channels for this connection. The specified callback 78 // Creates new channels for this connection. The specified callback
79 // is called when then new channel is created and connected. The 79 // is called when then new channel is created and connected. The
80 // callback is called with NULL if connection failed for any reason. 80 // callback is called with NULL if connection failed for any reason.
81 // Ownership of the channel socket is given to the caller when the 81 // Ownership of the channel socket is given to the caller when the
82 // callback is called. All channels must be destroyed before the 82 // callback is called. All channels must be destroyed before the
83 // session is destroyed. Can be called only when in CONNECTING or 83 // session is destroyed. Can be called only when in CONNECTING or
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 virtual void Close() = 0; 125 virtual void Close() = 0;
126 126
127 private: 127 private:
128 DISALLOW_COPY_AND_ASSIGN(Session); 128 DISALLOW_COPY_AND_ASSIGN(Session);
129 }; 129 };
130 130
131 } // namespace protocol 131 } // namespace protocol
132 } // namespace remoting 132 } // namespace remoting
133 133
134 #endif // REMOTING_PROTOCOL_SESSION_H_ 134 #endif // REMOTING_PROTOCOL_SESSION_H_
OLDNEW
« no previous file with comments | « remoting/protocol/rtp_writer.cc ('k') | remoting/protocol/session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698