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

Unified Diff: blimp/net/engine_auth_handler.h

Issue 1492643003: [Blimp Net] Add EngineAuthHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/engine_auth_handler.h
diff --git a/blimp/net/engine_auth_handler.h b/blimp/net/engine_auth_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..82497d7670a8433f4d3272dae26f5dd1062ed1ee
--- /dev/null
+++ b/blimp/net/engine_auth_handler.h
@@ -0,0 +1,60 @@
+// 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_ENGINE_AUTH_HANDLER_H_
+#define BLIMP_NET_ENGINE_AUTH_HANDLER_H_
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "blimp/net/blimp_message_processor.h"
+#include "blimp/net/blimp_net_export.h"
+#include "blimp/net/connection_error_observer.h"
+#include "blimp/net/connection_handler.h"
+
+namespace blimp {
+
+class BlimpConnection;
+class BlimpMessage;
+
+// Authenticates one connection and hand it over to |connection_handler|
Wez 2015/12/02 01:52:52 Not sure that this makes sense; it's possible for
haibinlu 2015/12/03 01:53:22 Done.
+// if it is authenticated.
+//
+// This object deletes itself under one of the conditions below:
+// * the connection is authenticated.
+// * the connection gets into error state.
+// * timeout on waiting for START_CONNECTION message.
+class BLIMP_NET_EXPORT EngineAuthHandler : public ConnectionHandler,
+ public ConnectionErrorObserver,
+ public BlimpMessageProcessor {
+ public:
+ // Caller is responsible for ensuring that |connection_handler| outlives
+ // |this|.
+ explicit EngineAuthHandler(ConnectionHandler* connection_handler);
+
+ ~EngineAuthHandler();
+
+ // ConnectionHandler implementation.
+ void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+
+ // ConnectionErrorObserver implementation.
+ // Used to implement reconnection logic on unexpected disconnections.
+ void OnConnectionError(int error) override;
+
+ // BlimpMessageProcessor implementation.
+ void ProcessMessage(scoped_ptr<BlimpMessage> message,
+ const net::CompletionCallback& callback) override;
+
+ private:
+ ConnectionHandler* connection_handler_;
+
+ scoped_ptr<BlimpConnection> connection_;
+
+ DISALLOW_COPY_AND_ASSIGN(EngineAuthHandler);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_ENGINE_AUTH_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698