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

Side by Side Diff: remoting/client/host_connection.cc

Issue 2749004: Token-based authentication for chromoting. (Closed)
Patch Set: - Created 10 years, 6 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
« no previous file with comments | « remoting/client/host_connection.h ('k') | remoting/client/simple_client.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/client/host_connection.h" 5 #include "remoting/client/host_connection.h"
6 6
7 #include "remoting/base/constants.h"
8
7 namespace remoting { 9 namespace remoting {
8 10
9 HostConnection::HostConnection(ProtocolDecoder* decoder, 11 HostConnection::HostConnection(ProtocolDecoder* decoder,
10 EventHandler* handler) 12 EventHandler* handler)
11 : decoder_(decoder), handler_(handler) { 13 : decoder_(decoder), handler_(handler) {
12 } 14 }
13 15
14 HostConnection::~HostConnection() { 16 HostConnection::~HostConnection() {
15 Disconnect(); 17 Disconnect();
16 } 18 }
17 19
18 void HostConnection::Connect(const std::string& username, 20 void HostConnection::Connect(const std::string& username,
19 const std::string& password, 21 const std::string& auth_token,
20 const std::string& host_jid) { 22 const std::string& host_jid) {
21 jingle_client_ = new JingleClient(); 23 jingle_client_ = new JingleClient();
22 jingle_client_->Init(username, password, this); 24 jingle_client_->Init(username, auth_token, kChromotingTokenServiceName, this);
23 jingle_channel_ = jingle_client_->Connect(host_jid, this); 25 jingle_channel_ = jingle_client_->Connect(host_jid, this);
24 } 26 }
25 27
26 void HostConnection::Disconnect() { 28 void HostConnection::Disconnect() {
27 if (jingle_channel_.get()) 29 if (jingle_channel_.get())
28 jingle_channel_->Close(); 30 jingle_channel_->Close();
29 31
30 if (jingle_client_.get()) 32 if (jingle_client_.get())
31 jingle_client_->Close(); 33 jingle_client_->Close();
32 } 34 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Client rejects all connection. 71 // Client rejects all connection.
70 return false; 72 return false;
71 } 73 }
72 74
73 void HostConnection::OnNewConnection(JingleClient* client, 75 void HostConnection::OnNewConnection(JingleClient* client,
74 scoped_refptr<JingleChannel> channel) { 76 scoped_refptr<JingleChannel> channel) {
75 NOTREACHED() << "SimpleClient can't accept connection."; 77 NOTREACHED() << "SimpleClient can't accept connection.";
76 } 78 }
77 79
78 } // namespace remoting 80 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/host_connection.h ('k') | remoting/client/simple_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698