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

Unified Diff: blimp/net/client_connection_manager.h

Issue 1551583003: Implementation and fixes for Blimp client/engine E2E communication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dtrainor-linux-cl1528243002
Patch Set: Fixed misplaced EXPORT directive Created 4 years, 12 months 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
« no previous file with comments | « blimp/net/browser_connection_handler_unittest.cc ('k') | blimp/net/client_connection_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/client_connection_manager.h
diff --git a/blimp/net/client_connection_manager.h b/blimp/net/client_connection_manager.h
index 8c523139fa2a3f5cf9fa1987164a55ea48826b0d..10644d066e6338bf9e5293d8f1b9f5d355b0737f 100644
--- a/blimp/net/client_connection_manager.h
+++ b/blimp/net/client_connection_manager.h
@@ -5,11 +5,14 @@
#ifndef BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
#define BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
+#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "blimp/net/blimp_net_export.h"
+#include "blimp/net/connection_error_observer.h"
namespace blimp {
@@ -22,13 +25,14 @@ class ConnectionHandler;
//
// TODO(haibinlu): cope with network changes that may potentially affect the
// endpoint that we're trying to connect to.
-class BLIMP_NET_EXPORT ClientConnectionManager {
+class BLIMP_NET_EXPORT ClientConnectionManager
+ : public ConnectionErrorObserver {
public:
// Caller is responsible for ensuring that |connection_handler|
// outlives |this|.
explicit ClientConnectionManager(ConnectionHandler* connection_handler);
- ~ClientConnectionManager();
+ ~ClientConnectionManager() override;
// Adds a transport. All transports are expected to be added before invoking
// |Connect|.
@@ -42,6 +46,11 @@ class BLIMP_NET_EXPORT ClientConnectionManager {
// cases such as network switches, online/offline changes.
void Connect();
+ // Sets the client token to use in the authentication message.
+ void set_client_token(const std::string& client_token) {
+ client_token_ = client_token;
+ }
+
private:
// Tries to connect using the BlimpTransport specified at |transport_index|.
void Connect(int transport_index);
@@ -51,10 +60,20 @@ class BLIMP_NET_EXPORT ClientConnectionManager {
void OnConnectResult(int transport_index, int result);
// Sends authentication message to the engine via |connection|.
- void SendAuthenticationMessage(BlimpConnection* connection);
+ void SendAuthenticationMessage(scoped_ptr<BlimpConnection> connection);
+
+ // Invoked after the authentication message is sent to |connection|.
+ // The result of the write operation is passed via |result|.
+ void OnAuthenticationMessageSent(scoped_ptr<BlimpConnection> connection,
+ int result);
+
+ // ConnectionErrorObserver implementation.
+ void OnConnectionError(int error) override;
+ std::string client_token_;
ConnectionHandler* connection_handler_;
std::vector<scoped_ptr<BlimpTransport>> transports_;
+ base::WeakPtrFactory<ClientConnectionManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager);
};
« no previous file with comments | « blimp/net/browser_connection_handler_unittest.cc ('k') | blimp/net/client_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698