| 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 #ifndef BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ | 5 #ifndef BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ |
| 6 #define BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ | 6 #define BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "blimp/net/blimp_net_export.h" | 12 #include "blimp/net/blimp_net_export.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 | 15 |
| 16 class BlimpConnection; |
| 16 class BlimpTransport; | 17 class BlimpTransport; |
| 17 class ConnectionHandler; | 18 class ConnectionHandler; |
| 18 | 19 |
| 19 // Coordinates the channel creation and authentication workflows for | 20 // Coordinates the channel creation and authentication workflows for |
| 20 // outgoing (Client) network connections. | 21 // outgoing (Client) network connections. |
| 21 // | 22 // |
| 22 // TODO(haibinlu): cope with network changes that may potentially affect the | 23 // TODO(haibinlu): cope with network changes that may potentially affect the |
| 23 // endpoint that we're trying to connect to. | 24 // endpoint that we're trying to connect to. |
| 24 class BLIMP_NET_EXPORT ClientConnectionManager { | 25 class BLIMP_NET_EXPORT ClientConnectionManager { |
| 25 public: | 26 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 void Connect(); | 43 void Connect(); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 // Tries to connect using the BlimpTransport specified at |transport_index|. | 46 // Tries to connect using the BlimpTransport specified at |transport_index|. |
| 46 void Connect(int transport_index); | 47 void Connect(int transport_index); |
| 47 | 48 |
| 48 // Callback invoked by transports_[transport_index] to indicate that it has a | 49 // Callback invoked by transports_[transport_index] to indicate that it has a |
| 49 // connection ready to be authenticated or there is an error. | 50 // connection ready to be authenticated or there is an error. |
| 50 void OnConnectResult(int transport_index, int result); | 51 void OnConnectResult(int transport_index, int result); |
| 51 | 52 |
| 53 // Sends authentication message to the engine via |connection|. |
| 54 void SendAuthenticationMessage(BlimpConnection* connection); |
| 55 |
| 52 ConnectionHandler* connection_handler_; | 56 ConnectionHandler* connection_handler_; |
| 53 std::vector<scoped_ptr<BlimpTransport>> transports_; | 57 std::vector<scoped_ptr<BlimpTransport>> transports_; |
| 54 | 58 |
| 55 DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager); | 59 DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 } // namespace blimp | 62 } // namespace blimp |
| 59 | 63 |
| 60 #endif // BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ | 64 #endif // BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_ |
| OLD | NEW |