OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/client/core/session/client_network_components.h" | 5 #include "blimp/client/core/session/client_network_components.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "blimp/net/grpc_client_transport.h" |
11 #include "blimp/net/ssl_client_transport.h" | 12 #include "blimp/net/ssl_client_transport.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 | 14 |
14 namespace blimp { | 15 namespace blimp { |
15 namespace client { | 16 namespace client { |
16 | 17 |
17 ClientNetworkComponents::ClientNetworkComponents( | 18 ClientNetworkComponents::ClientNetworkComponents( |
18 std::unique_ptr<NetworkEventObserver> network_observer) | 19 std::unique_ptr<NetworkEventObserver> network_observer) |
19 : connection_handler_(), network_observer_(std::move(network_observer)) {} | 20 : connection_handler_(), network_observer_(std::move(network_observer)) {} |
20 | 21 |
(...skipping 20 matching lines...) Expand all Loading... |
41 connection_manager_->AddTransport(base::MakeUnique<SSLClientTransport>( | 42 connection_manager_->AddTransport(base::MakeUnique<SSLClientTransport>( |
42 assignment.engine_endpoint, std::move(assignment.cert), nullptr)); | 43 assignment.engine_endpoint, std::move(assignment.cert), nullptr)); |
43 transport_type = "SSL"; | 44 transport_type = "SSL"; |
44 break; | 45 break; |
45 case Assignment::TCP: | 46 case Assignment::TCP: |
46 connection_manager_->AddTransport(base::MakeUnique<TCPClientTransport>( | 47 connection_manager_->AddTransport(base::MakeUnique<TCPClientTransport>( |
47 assignment.engine_endpoint, nullptr)); | 48 assignment.engine_endpoint, nullptr)); |
48 transport_type = "TCP"; | 49 transport_type = "TCP"; |
49 break; | 50 break; |
50 case Assignment::GRPC: | 51 case Assignment::GRPC: |
51 // TODO(perumaal): Unimplemented as yet. | 52 connection_manager_->AddTransport(base::MakeUnique<GrpcClientTransport>( |
52 // connection_manager_->AddTransport( | 53 assignment.engine_endpoint.ToString())); |
53 // base::MakeUnique<GrpcClientTransport>(endpoint)); | |
54 transport_type = "GRPC"; | 54 transport_type = "GRPC"; |
55 NOTIMPLEMENTED(); | |
56 break; | 55 break; |
57 case Assignment::UNKNOWN: | 56 case Assignment::UNKNOWN: |
58 LOG(FATAL) << "Unknown transport type."; | 57 LOG(FATAL) << "Unknown transport type."; |
59 break; | 58 break; |
60 } | 59 } |
61 | 60 |
62 VLOG(1) << "Connecting to " << assignment.engine_endpoint.ToString() << " (" | 61 VLOG(1) << "Connecting to " << assignment.engine_endpoint.ToString() << " (" |
63 << transport_type << ")"; | 62 << transport_type << ")"; |
64 | 63 |
65 connection_manager_->Connect(); | 64 connection_manager_->Connect(); |
(...skipping 19 matching lines...) Expand all Loading... |
85 if (result >= 0) { | 84 if (result >= 0) { |
86 VLOG(1) << "Disconnected with reason: " << result; | 85 VLOG(1) << "Disconnected with reason: " << result; |
87 } else { | 86 } else { |
88 VLOG(1) << "Connection error: " << net::ErrorToString(result); | 87 VLOG(1) << "Connection error: " << net::ErrorToString(result); |
89 } | 88 } |
90 network_observer_->OnDisconnected(result); | 89 network_observer_->OnDisconnected(result); |
91 } | 90 } |
92 | 91 |
93 } // namespace client | 92 } // namespace client |
94 } // namespace blimp | 93 } // namespace blimp |
OLD | NEW |