Index: blimp/client/core/session/client_network_components.h |
diff --git a/blimp/client/core/session/client_network_components.h b/blimp/client/core/session/client_network_components.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9d278942c69cfebce56423e803e8eb9a66d4e81e |
--- /dev/null |
+++ b/blimp/client/core/session/client_network_components.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ |
+#define BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ |
+ |
+#include <memory> |
+ |
+#include "blimp/client/core/session/assignment_source.h" |
+#include "blimp/client/core/session/network_event_observer.h" |
+#include "blimp/net/blimp_connection.h" |
+#include "blimp/net/blimp_connection_statistics.h" |
+#include "blimp/net/browser_connection_handler.h" |
+#include "blimp/net/client_connection_manager.h" |
+ |
+namespace blimp { |
+namespace client { |
+ |
+// This class's functions and destruction must all be invoked on the IO thread |
Kevin M
2016/07/29 18:56:03
Perhaps we should add some ThreadChecker checks, j
nyquist
2016/07/29 21:07:52
Done. I didn't pass it in though, so it's just wha
|
+// by the owner. |
+class ClientNetworkComponents : public ConnectionHandler, |
+ public ConnectionErrorObserver { |
+ public: |
+ // Can be created on any thread. |
+ ClientNetworkComponents( |
+ std::unique_ptr<NetworkEventObserver> observer, |
+ std::unique_ptr<BlimpConnectionStatistics> blimp_connection_statistics); |
+ ~ClientNetworkComponents() override; |
+ |
+ // Sets up network components. |
+ void Initialize(); |
+ |
+ // Starts the connection to the engine using the given |assignment|. |
+ // It is required to first call Initialize. |
+ void ConnectWithAssignment(const Assignment& assignment); |
+ |
+ BrowserConnectionHandler* GetBrowserConnectionHandler(); |
+ |
+ void DropCurrentConnection(); |
Kevin M
2016/07/29 18:56:03
Remove this method and replace references to it wi
nyquist
2016/07/29 21:07:52
Done.
|
+ |
+ private: |
+ // ConnectionHandler implementation. |
+ void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; |
+ |
+ // ConnectionErrorObserver implementation. |
+ void OnConnectionError(int error) override; |
+ |
+ std::unique_ptr<BrowserConnectionHandler> connection_handler_; |
Kevin M
2016/07/29 18:56:03
No need to make this a unique_ptr.
nyquist
2016/07/29 21:07:52
Done.
|
+ std::unique_ptr<ClientConnectionManager> connection_manager_; |
+ std::unique_ptr<NetworkEventObserver> network_observer_; |
+ std::unique_ptr<BlimpConnectionStatistics> connection_statistics_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents); |
+}; |
+ |
+} // namespace client |
+} // namespace blimp |
+ |
+#endif // BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ |