Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_NET_ENGINE_AUTH_HANDLER_H_ | |
| 6 #define BLIMP_NET_ENGINE_AUTH_HANDLER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "blimp/net/blimp_message_processor.h" | |
| 13 #include "blimp/net/blimp_net_export.h" | |
| 14 #include "blimp/net/connection_error_observer.h" | |
| 15 #include "blimp/net/connection_handler.h" | |
| 16 | |
| 17 namespace blimp { | |
| 18 | |
| 19 class BlimpConnection; | |
| 20 class BlimpMessage; | |
| 21 | |
| 22 // 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.
| |
| 23 // if it is authenticated. | |
| 24 // | |
| 25 // This object deletes itself under one of the conditions below: | |
| 26 // * the connection is authenticated. | |
| 27 // * the connection gets into error state. | |
| 28 // * timeout on waiting for START_CONNECTION message. | |
| 29 class BLIMP_NET_EXPORT EngineAuthHandler : public ConnectionHandler, | |
| 30 public ConnectionErrorObserver, | |
| 31 public BlimpMessageProcessor { | |
| 32 public: | |
| 33 // Caller is responsible for ensuring that |connection_handler| outlives | |
| 34 // |this|. | |
| 35 explicit EngineAuthHandler(ConnectionHandler* connection_handler); | |
| 36 | |
| 37 ~EngineAuthHandler(); | |
| 38 | |
| 39 // ConnectionHandler implementation. | |
| 40 void HandleConnection(scoped_ptr<BlimpConnection> connection) override; | |
| 41 | |
| 42 // ConnectionErrorObserver implementation. | |
| 43 // Used to implement reconnection logic on unexpected disconnections. | |
| 44 void OnConnectionError(int error) override; | |
| 45 | |
| 46 // BlimpMessageProcessor implementation. | |
| 47 void ProcessMessage(scoped_ptr<BlimpMessage> message, | |
| 48 const net::CompletionCallback& callback) override; | |
| 49 | |
| 50 private: | |
| 51 ConnectionHandler* connection_handler_; | |
| 52 | |
| 53 scoped_ptr<BlimpConnection> connection_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(EngineAuthHandler); | |
| 56 }; | |
| 57 | |
| 58 } // namespace blimp | |
| 59 | |
| 60 #endif // BLIMP_NET_ENGINE_AUTH_HANDLER_H_ | |
| OLD | NEW |