blob: ed9c9a9fc9ffd1fdafed5eb0b690c3e3d0cdc642 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// 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_error_observer.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,
ConnectionErrorObserver {
// 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;
// ConnectionErrorObserver implementation.
// Used to implement reconnection logic on unexpected disconnections.
void OnConnectionError(int error) override;
private:
DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager);
};
} // namespace blimp
#endif // BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
|