OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/engine_authentication_handler.h" | 5 #include "blimp/net/engine_authentication_handler.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 OnConnectionAuthenticated(false); | 99 OnConnectionAuthenticated(false); |
100 } | 100 } |
101 | 101 |
102 void Authenticator::ProcessMessage(scoped_ptr<BlimpMessage> message, | 102 void Authenticator::ProcessMessage(scoped_ptr<BlimpMessage> message, |
103 const net::CompletionCallback& callback) { | 103 const net::CompletionCallback& callback) { |
104 if (message->type() == BlimpMessage::PROTOCOL_CONTROL) { | 104 if (message->type() == BlimpMessage::PROTOCOL_CONTROL) { |
105 DVLOG(1) << "Authentication challenge received: " | 105 DVLOG(1) << "Authentication challenge received: " |
106 << message->protocol_control().start_connection().client_token(); | 106 << message->protocol_control().start_connection().client_token(); |
107 OnConnectionAuthenticated(true); | 107 OnConnectionAuthenticated(true); |
108 } else { | 108 } else { |
109 DVLOG(1) << "Expected START_CONNECTION message, got " << message | 109 DVLOG(1) << "Expected START_CONNECTION message, got " << message.get() |
110 << " instead."; | 110 << " instead."; |
111 OnConnectionAuthenticated(false); | 111 OnConnectionAuthenticated(false); |
112 } | 112 } |
113 | 113 |
114 callback.Run(net::OK); | 114 callback.Run(net::OK); |
115 } | 115 } |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 | 118 |
119 EngineAuthenticationHandler::EngineAuthenticationHandler( | 119 EngineAuthenticationHandler::EngineAuthenticationHandler( |
120 ConnectionHandler* connection_handler) | 120 ConnectionHandler* connection_handler) |
121 : connection_handler_weak_factory_(connection_handler) {} | 121 : connection_handler_weak_factory_(connection_handler) {} |
122 | 122 |
123 EngineAuthenticationHandler::~EngineAuthenticationHandler() {} | 123 EngineAuthenticationHandler::~EngineAuthenticationHandler() {} |
124 | 124 |
125 void EngineAuthenticationHandler::HandleConnection( | 125 void EngineAuthenticationHandler::HandleConnection( |
126 scoped_ptr<BlimpConnection> connection) { | 126 scoped_ptr<BlimpConnection> connection) { |
127 // Authenticator manages its own lifetime. | 127 // Authenticator manages its own lifetime. |
128 new Authenticator(std::move(connection), | 128 new Authenticator(std::move(connection), |
129 connection_handler_weak_factory_.GetWeakPtr()); | 129 connection_handler_weak_factory_.GetWeakPtr()); |
130 } | 130 } |
131 | 131 |
132 } // namespace blimp | 132 } // namespace blimp |
OLD | NEW |