OLD | NEW |
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_PEPPER_SESSION_H_ | 5 #ifndef REMOTING_PROTOCOL_PEPPER_SESSION_H_ |
6 #define REMOTING_PROTOCOL_PEPPER_SESSION_H_ | 6 #define REMOTING_PROTOCOL_PEPPER_SESSION_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 virtual void SetStateChangeCallback( | 42 virtual void SetStateChangeCallback( |
43 const StateChangeCallback& callback) OVERRIDE; | 43 const StateChangeCallback& callback) OVERRIDE; |
44 virtual Error error() OVERRIDE; | 44 virtual Error error() OVERRIDE; |
45 virtual void CreateStreamChannel( | 45 virtual void CreateStreamChannel( |
46 const std::string& name, | 46 const std::string& name, |
47 const StreamChannelCallback& callback) OVERRIDE; | 47 const StreamChannelCallback& callback) OVERRIDE; |
48 virtual void CreateDatagramChannel( | 48 virtual void CreateDatagramChannel( |
49 const std::string& name, | 49 const std::string& name, |
50 const DatagramChannelCallback& callback) OVERRIDE; | 50 const DatagramChannelCallback& callback) OVERRIDE; |
51 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | 51 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; |
52 virtual net::Socket* control_channel() OVERRIDE; | |
53 virtual net::Socket* event_channel() OVERRIDE; | |
54 virtual const std::string& jid() OVERRIDE; | 52 virtual const std::string& jid() OVERRIDE; |
55 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; | 53 virtual const CandidateSessionConfig* candidate_config() OVERRIDE; |
56 virtual const SessionConfig& config() OVERRIDE; | 54 virtual const SessionConfig& config() OVERRIDE; |
57 virtual void set_config(const SessionConfig& config) OVERRIDE; | 55 virtual void set_config(const SessionConfig& config) OVERRIDE; |
58 virtual const std::string& initiator_token() OVERRIDE; | 56 virtual const std::string& initiator_token() OVERRIDE; |
59 virtual void set_initiator_token(const std::string& initiator_token) OVERRIDE; | 57 virtual void set_initiator_token(const std::string& initiator_token) OVERRIDE; |
60 virtual const std::string& receiver_token() OVERRIDE; | 58 virtual const std::string& receiver_token() OVERRIDE; |
61 virtual void set_receiver_token(const std::string& receiver_token) OVERRIDE; | 59 virtual void set_receiver_token(const std::string& receiver_token) OVERRIDE; |
62 virtual void set_shared_secret(const std::string& secret) OVERRIDE; | 60 virtual void set_shared_secret(const std::string& secret) OVERRIDE; |
63 virtual const std::string& shared_secret() OVERRIDE; | 61 virtual const std::string& shared_secret() OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Called from OnAccept() to initialize session config. | 95 // Called from OnAccept() to initialize session config. |
98 bool InitializeConfigFromDescription(const ContentDescription* description); | 96 bool InitializeConfigFromDescription(const ContentDescription* description); |
99 | 97 |
100 // Called by PepperChannel. | 98 // Called by PepperChannel. |
101 void AddLocalCandidate(const cricket::Candidate& candidate); | 99 void AddLocalCandidate(const cricket::Candidate& candidate); |
102 void OnDeleteChannel(PepperChannel* channel); | 100 void OnDeleteChannel(PepperChannel* channel); |
103 | 101 |
104 void SendTransportInfo(); | 102 void SendTransportInfo(); |
105 void OnTransportInfoResponse(const buzz::XmlElement* response); | 103 void OnTransportInfoResponse(const buzz::XmlElement* response); |
106 | 104 |
107 // Helper methods to create event and control channels. | |
108 // TODO(sergeyu): Remove these methods. | |
109 void CreateChannels(); | |
110 void OnChannelConnected(scoped_ptr<net::Socket>* socket_container, | |
111 net::StreamSocket* socket); | |
112 | |
113 // Close all the channels and terminate the session. | 105 // Close all the channels and terminate the session. |
114 void CloseInternal(bool failed); | 106 void CloseInternal(bool failed); |
115 | 107 |
116 // Sets |state_| to |new_state| and calls state change callback. | 108 // Sets |state_| to |new_state| and calls state change callback. |
117 void SetState(State new_state); | 109 void SetState(State new_state); |
118 | 110 |
119 PepperSessionManager* session_manager_; | 111 PepperSessionManager* session_manager_; |
120 std::string peer_jid_; | 112 std::string peer_jid_; |
121 std::string peer_public_key_; | 113 std::string peer_public_key_; |
122 scoped_ptr<CandidateSessionConfig> candidate_config_; | 114 scoped_ptr<CandidateSessionConfig> candidate_config_; |
123 StateChangeCallback state_change_callback_; | 115 StateChangeCallback state_change_callback_; |
124 | 116 |
125 std::string session_id_; | 117 std::string session_id_; |
126 State state_; | 118 State state_; |
127 Error error_; | 119 Error error_; |
128 | 120 |
129 std::string remote_cert_; | 121 std::string remote_cert_; |
130 SessionConfig config_; | 122 SessionConfig config_; |
131 | 123 |
132 std::string shared_secret_; | 124 std::string shared_secret_; |
133 std::string initiator_token_; | 125 std::string initiator_token_; |
134 std::string receiver_token_; | 126 std::string receiver_token_; |
135 | 127 |
136 scoped_ptr<IqRequest> initiate_request_; | 128 scoped_ptr<IqRequest> initiate_request_; |
137 scoped_ptr<IqRequest> transport_info_request_; | 129 scoped_ptr<IqRequest> transport_info_request_; |
138 | 130 |
139 ChannelsMap channels_; | 131 ChannelsMap channels_; |
140 | 132 |
141 scoped_ptr<net::Socket> control_channel_socket_; | |
142 scoped_ptr<net::Socket> event_channel_socket_; | |
143 | |
144 base::OneShotTimer<PepperSession> transport_infos_timer_; | 133 base::OneShotTimer<PepperSession> transport_infos_timer_; |
145 std::list<cricket::Candidate> pending_candidates_; | 134 std::list<cricket::Candidate> pending_candidates_; |
146 | 135 |
147 DISALLOW_COPY_AND_ASSIGN(PepperSession); | 136 DISALLOW_COPY_AND_ASSIGN(PepperSession); |
148 }; | 137 }; |
149 | 138 |
150 } // namespace protocol | 139 } // namespace protocol |
151 } // namespace remoting | 140 } // namespace remoting |
152 | 141 |
153 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_H_ | 142 #endif // REMOTING_PROTOCOL_PEPPER_SESSION_H_ |
OLD | NEW |