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

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

Issue 1492643003: [Blimp Net] Add EngineAuthHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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_connection_manager.h" 5 #include "blimp/net/engine_connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "blimp/net/blimp_connection.h" 8 #include "blimp/net/blimp_connection.h"
9 #include "blimp/net/blimp_transport.h" 9 #include "blimp/net/blimp_transport.h"
10 #include "blimp/net/engine_auth_handler.h"
10 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
11 12
12 namespace blimp { 13 namespace blimp {
13 14
14 EngineConnectionManager::EngineConnectionManager( 15 EngineConnectionManager::EngineConnectionManager(
15 ConnectionHandler* connection_handler) 16 ConnectionHandler* connection_handler)
16 : connection_handler_(connection_handler) {} 17 : connection_handler_(connection_handler) {}
17 18
18 EngineConnectionManager::~EngineConnectionManager() {} 19 EngineConnectionManager::~EngineConnectionManager() {}
19 20
20 void EngineConnectionManager::AddTransport( 21 void EngineConnectionManager::AddTransport(
21 scoped_ptr<BlimpTransport> transport) { 22 scoped_ptr<BlimpTransport> transport) {
22 BlimpTransport* transport_ptr = transport.get(); 23 BlimpTransport* transport_ptr = transport.get();
23 transports_.push_back(std::move(transport)); 24 transports_.push_back(std::move(transport));
24 Connect(transport_ptr); 25 Connect(transport_ptr);
25 } 26 }
26 27
27 void EngineConnectionManager::Connect(BlimpTransport* transport) { 28 void EngineConnectionManager::Connect(BlimpTransport* transport) {
28 transport->Connect(base::Bind(&EngineConnectionManager::OnConnectResult, 29 transport->Connect(base::Bind(&EngineConnectionManager::OnConnectResult,
29 base::Unretained(this), 30 base::Unretained(this),
30 base::Unretained(transport))); 31 base::Unretained(transport)));
31 } 32 }
32 33
33 void EngineConnectionManager::OnConnectResult(BlimpTransport* transport, 34 void EngineConnectionManager::OnConnectResult(BlimpTransport* transport,
34 int result) { 35 int result) {
35 // Expects engine transport to be reliably, thus |result| is always net::OK. 36 // Expects engine transport to be reliably, thus |result| is always net::OK.
36 CHECK(result == net::OK) << "Transport failure:" << transport->GetName(); 37 CHECK(result == net::OK) << "Transport failure:" << transport->GetName();
37 connection_handler_->HandleConnection(transport->TakeConnection()); 38 // EngineAuthHandler manages its own lifetime.
39 EngineAuthHandler* auth_handler = new EngineAuthHandler(connection_handler_);
40 auth_handler->HandleConnection(transport->TakeConnection());
38 Connect(transport); 41 Connect(transport);
39 } 42 }
40 43
41 } // namespace blimp 44 } // namespace blimp
OLDNEW
« blimp/net/engine_auth_handler.h ('K') | « blimp/net/engine_auth_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698