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

Side by Side Diff: remoting/protocol/jingle_session.cc

Issue 8662001: Remove AccessVerifier interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years 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/connection_to_host.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('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 #include "remoting/protocol/jingle_session.h" 5 #include "remoting/protocol/jingle_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "crypto/hmac.h" 12 #include "crypto/hmac.h"
13 #include "crypto/rsa_private_key.h" 13 #include "crypto/rsa_private_key.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/socket/stream_socket.h" 15 #include "net/socket/stream_socket.h"
16 #include "remoting/base/constants.h" 16 #include "remoting/base/constants.h"
17 #include "remoting/protocol/auth_util.h"
17 #include "remoting/protocol/jingle_datagram_connector.h" 18 #include "remoting/protocol/jingle_datagram_connector.h"
18 #include "remoting/protocol/jingle_session_manager.h" 19 #include "remoting/protocol/jingle_session_manager.h"
19 #include "remoting/protocol/jingle_stream_connector.h" 20 #include "remoting/protocol/jingle_stream_connector.h"
20 #include "remoting/protocol/v1_client_channel_authenticator.h" 21 #include "remoting/protocol/v1_client_channel_authenticator.h"
21 #include "remoting/protocol/v1_host_channel_authenticator.h" 22 #include "remoting/protocol/v1_host_channel_authenticator.h"
22 #include "third_party/libjingle/source/talk/base/thread.h" 23 #include "third_party/libjingle/source/talk/base/thread.h"
23 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h" 24 #include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h"
24 #include "third_party/libjingle/source/talk/p2p/base/session.h" 25 #include "third_party/libjingle/source/talk/p2p/base/session.h"
25 #include "third_party/libjingle/source/talk/p2p/base/transport.h" 26 #include "third_party/libjingle/source/talk/p2p/base/transport.h"
26 27
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 channel_connectors_.end()); 95 channel_connectors_.end());
95 96
96 // Tear down the cricket session, including the cricket transport channels. 97 // Tear down the cricket session, including the cricket transport channels.
97 if (cricket_session_) { 98 if (cricket_session_) {
98 std::string reason; 99 std::string reason;
99 switch (error) { 100 switch (error) {
100 case OK: 101 case OK:
101 reason = cricket::STR_TERMINATE_SUCCESS; 102 reason = cricket::STR_TERMINATE_SUCCESS;
102 break; 103 break;
103 case SESSION_REJECTED: 104 case SESSION_REJECTED:
105 case AUTHENTICATION_FAILED:
104 reason = cricket::STR_TERMINATE_DECLINE; 106 reason = cricket::STR_TERMINATE_DECLINE;
105 break; 107 break;
106 case INCOMPATIBLE_PROTOCOL: 108 case INCOMPATIBLE_PROTOCOL:
107 reason = cricket::STR_TERMINATE_INCOMPATIBLE_PARAMETERS; 109 reason = cricket::STR_TERMINATE_INCOMPATIBLE_PARAMETERS;
108 break; 110 break;
109 default: 111 default:
110 reason = cricket::STR_TERMINATE_ERROR; 112 reason = cricket::STR_TERMINATE_ERROR;
111 } 113 }
112 cricket_session_->TerminateWithReason(reason); 114 cricket_session_->TerminateWithReason(reason);
113 cricket_session_->SignalState.disconnect(this); 115 cricket_session_->SignalState.disconnect(this);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 SetState(CONNECTING); 392 SetState(CONNECTING);
391 393
392 if (!jingle_session_manager_->AcceptConnection(this, cricket_session_)) { 394 if (!jingle_session_manager_->AcceptConnection(this, cricket_session_)) {
393 Close(); 395 Close();
394 // Release session so that JingleSessionManager::SessionDestroyed() 396 // Release session so that JingleSessionManager::SessionDestroyed()
395 // doesn't try to call cricket::SessionManager::DestroySession() for it. 397 // doesn't try to call cricket::SessionManager::DestroySession() for it.
396 ReleaseSession(); 398 ReleaseSession();
397 delete this; 399 delete this;
398 return; 400 return;
399 } 401 }
402
403 if (!VerifySupportAuthToken(jid_, shared_secret_, initiator_token()))
404 CloseInternal(net::ERR_CONNECTION_FAILED, AUTHENTICATION_FAILED);
400 } 405 }
401 406
402 void JingleSession::AddChannelConnector( 407 void JingleSession::AddChannelConnector(
403 const std::string& name, JingleChannelConnector* connector) { 408 const std::string& name, JingleChannelConnector* connector) {
404 DCHECK(channel_connectors_.find(name) == channel_connectors_.end()); 409 DCHECK(channel_connectors_.find(name) == channel_connectors_.end());
405 410
406 const std::string& content_name = GetContentInfo()->name; 411 const std::string& content_name = GetContentInfo()->name;
407 cricket::TransportChannel* raw_channel = 412 cricket::TransportChannel* raw_channel =
408 cricket_session_->CreateChannel(content_name, name); 413 cricket_session_->CreateChannel(content_name, name);
409 414
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 DCHECK_NE(state_, FAILED); 466 DCHECK_NE(state_, FAILED);
462 467
463 state_ = new_state; 468 state_ = new_state;
464 if (!state_change_callback_.is_null()) 469 if (!state_change_callback_.is_null())
465 state_change_callback_.Run(new_state); 470 state_change_callback_.Run(new_state);
466 } 471 }
467 } 472 }
468 473
469 } // namespace protocol 474 } // namespace protocol
470 } // namespace remoting 475 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698