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

Unified Diff: blimp/net/client_connection_manager.h

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address wez's feedback. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: blimp/net/client_connection_manager.h
diff --git a/blimp/net/client_connection_manager.h b/blimp/net/client_connection_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..5f9dfd5df6a2babb8104c4b3a93ab0939dc25e3e
--- /dev/null
+++ b/blimp/net/client_connection_manager.h
@@ -0,0 +1,43 @@
+// Copyright 2015 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_NET_CLIENT_CONNECTION_MANAGER_H_
+#define BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
+
+#include "base/macros.h"
+#include "blimp/net/blimp_connection.h"
+#include "blimp/net/connection_handler.h"
+
+namespace blimp {
+
+// Coordinates the channel creation and authentication workflows for
+// outgoing (Client) network connections.
+// Attempts to reconnect if an authenticated connection is
+// disconnected.
+class ClientConnectionManager : public ConnectionHandler,
+ BlimpConnection::DisconnectObserver {
+ // Caller is responsible for ensuring that |client_browser_session|
+ // outlives |this|.
+ explicit ClientConnectionManager(ConnectionHandler* connection_handler);
+
+ ~ClientConnectionManager() override;
+
+ void Connect();
+
+ // ConnectionHandler implementation.
+ // Handles a new connection and authenticates it before passing it on to
+ // the underlying ConnectionHandler.
+ void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+
+ // BlimpConnection::DisconnectObserver implementation.
+ // Used to implement reconnection logic on unexpected disconnections.
+ void OnDisconnected() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698