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

Side by Side Diff: remoting/host/client_session.cc

Issue 6780014: Clean up remoting project (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got rid of ref counting on user authenticator 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 | « remoting/host/client_session.h ('k') | remoting/host/client_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/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/task.h" 7 #include "base/task.h"
9 #include "media/base/callback.h" 8 #include "media/base/callback.h"
10 #include "remoting/host/user_authenticator.h" 9 #include "remoting/host/user_authenticator.h"
11 #include "remoting/proto/auth.pb.h" 10 #include "remoting/proto/auth.pb.h"
12 11
13 namespace remoting { 12 namespace remoting {
14 13
15 ClientSession::ClientSession( 14 ClientSession::ClientSession(
16 EventHandler* event_handler, 15 EventHandler* event_handler,
17 const base::Callback<UserAuthenticatorFactory>& auth_factory, 16 UserAuthenticator* user_authenticator,
18 scoped_refptr<protocol::ConnectionToClient> connection, 17 scoped_refptr<protocol::ConnectionToClient> connection,
19 protocol::InputStub* input_stub) 18 protocol::InputStub* input_stub)
20 : event_handler_(event_handler), 19 : event_handler_(event_handler),
21 auth_factory_(auth_factory), 20 user_authenticator_(user_authenticator),
22 connection_(connection), 21 connection_(connection),
23 input_stub_(input_stub), 22 input_stub_(input_stub),
24 authenticated_(false) { 23 authenticated_(false) {
25 } 24 }
26 25
27 ClientSession::~ClientSession() { 26 ClientSession::~ClientSession() {
28 } 27 }
29 28
30 void ClientSession::SuggestResolution( 29 void ClientSession::SuggestResolution(
31 const protocol::SuggestResolutionRequest* msg, Task* done) { 30 const protocol::SuggestResolutionRequest* msg, Task* done) {
32 media::AutoTaskRunner done_runner(done); 31 media::AutoTaskRunner done_runner(done);
33 32
34 if (!authenticated_) { 33 if (!authenticated_) {
35 LOG(WARNING) << "Invalid control message received " 34 LOG(WARNING) << "Invalid control message received "
36 << "(client not authenticated)."; 35 << "(client not authenticated).";
37 return; 36 return;
38 } 37 }
39 } 38 }
40 39
41 void ClientSession::BeginSessionRequest( 40 void ClientSession::BeginSessionRequest(
42 const protocol::LocalLoginCredentials* credentials, Task* done) { 41 const protocol::LocalLoginCredentials* credentials, Task* done) {
43 DCHECK(event_handler_); 42 DCHECK(event_handler_);
44 43
45 media::AutoTaskRunner done_runner(done); 44 media::AutoTaskRunner done_runner(done);
46 45
47 bool success = false; 46 bool success = false;
48 scoped_ptr<UserAuthenticator> authenticator(auth_factory_.Run());
49 switch (credentials->type()) { 47 switch (credentials->type()) {
50 case protocol::PASSWORD: 48 case protocol::PASSWORD:
51 success = authenticator->Authenticate(credentials->username(), 49 success = user_authenticator_->Authenticate(credentials->username(),
52 credentials->credential()); 50 credentials->credential());
53 break; 51 break;
54 52
55 default: 53 default:
56 LOG(ERROR) << "Invalid credentials type " << credentials->type(); 54 LOG(ERROR) << "Invalid credentials type " << credentials->type();
57 break; 55 break;
58 } 56 }
59 57
60 if (success) { 58 if (success) {
61 authenticated_ = true; 59 authenticated_ = true;
62 event_handler_->LocalLoginSucceeded(connection_.get()); 60 event_handler_->LocalLoginSucceeded(connection_.get());
(...skipping 20 matching lines...) Expand all
83 input_stub_->InjectMouseEvent(event, done); 81 input_stub_->InjectMouseEvent(event, done);
84 } 82 }
85 } 83 }
86 84
87 void ClientSession::Disconnect() { 85 void ClientSession::Disconnect() {
88 connection_->Disconnect(); 86 connection_->Disconnect();
89 authenticated_ = false; 87 authenticated_ = false;
90 } 88 }
91 89
92 } // namespace remoting 90 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698