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

Side by Side Diff: blimp/net/engine_authentication_handler.cc

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 7 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 | « blimp/net/browser_connection_handler_unittest.cc ('k') | blimp/net/input_message_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 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 <string> 7 #include <string>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 105
106 void Authenticator::OnConnectionError(int error) { 106 void Authenticator::OnConnectionError(int error) {
107 DVLOG(1) << "Connection error before authenticated " 107 DVLOG(1) << "Connection error before authenticated "
108 << net::ErrorToString(error); 108 << net::ErrorToString(error);
109 OnConnectionAuthenticated(false); 109 OnConnectionAuthenticated(false);
110 } 110 }
111 111
112 void Authenticator::ProcessMessage(std::unique_ptr<BlimpMessage> message, 112 void Authenticator::ProcessMessage(std::unique_ptr<BlimpMessage> message,
113 const net::CompletionCallback& callback) { 113 const net::CompletionCallback& callback) {
114 if (message->type() == BlimpMessage::PROTOCOL_CONTROL && 114 if (message->has_protocol_control() &&
115 message->protocol_control().type() == 115 message->protocol_control().has_start_connection()) {
116 ProtocolControlMessage::START_CONNECTION) {
117 bool token_match = 116 bool token_match =
118 client_token_ == 117 client_token_ ==
119 message->protocol_control().start_connection().client_token(); 118 message->protocol_control().start_connection().client_token();
120 DVLOG(1) << "Authentication challenge received: " 119 DVLOG(1) << "Authentication challenge received: "
121 << message->protocol_control().start_connection().client_token() 120 << message->protocol_control().start_connection().client_token()
122 << ", and token " 121 << ", and token "
123 << (token_match ? " matches" : " does not match"); 122 << (token_match ? " matches" : " does not match");
124 OnConnectionAuthenticated(token_match); 123 OnConnectionAuthenticated(token_match);
125 } else { 124 } else {
126 DVLOG(1) << "Expected START_CONNECTION message, got " << *message 125 DVLOG(1) << "Expected START_CONNECTION message, got " << *message
(...skipping 18 matching lines...) Expand all
145 144
146 void EngineAuthenticationHandler::HandleConnection( 145 void EngineAuthenticationHandler::HandleConnection(
147 std::unique_ptr<BlimpConnection> connection) { 146 std::unique_ptr<BlimpConnection> connection) {
148 // Authenticator manages its own lifetime. 147 // Authenticator manages its own lifetime.
149 new Authenticator(std::move(connection), 148 new Authenticator(std::move(connection),
150 connection_handler_weak_factory_.GetWeakPtr(), 149 connection_handler_weak_factory_.GetWeakPtr(),
151 client_token_); 150 client_token_);
152 } 151 }
153 152
154 } // namespace blimp 153 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/browser_connection_handler_unittest.cc ('k') | blimp/net/input_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698