| Index: google_apis/gcm/engine/connection_factory.h
|
| diff --git a/google_apis/gcm/engine/connection_factory.h b/google_apis/gcm/engine/connection_factory.h
|
| index 393d6a9ca247d32030abd1baa9170f3913f9c8b4..1888c19f8b59e18f22dfbd4ece906920db916995 100644
|
| --- a/google_apis/gcm/engine/connection_factory.h
|
| +++ b/google_apis/gcm/engine/connection_factory.h
|
| @@ -9,6 +9,12 @@
|
| #include "google_apis/gcm/base/gcm_export.h"
|
| #include "google_apis/gcm/engine/connection_handler.h"
|
|
|
| +class GURL;
|
| +
|
| +namespace net {
|
| +class IPEndPoint;
|
| +}
|
| +
|
| namespace mcs_proto {
|
| class LoginRequest;
|
| }
|
| @@ -36,6 +42,22 @@ class GCM_EXPORT ConnectionFactory {
|
| CONNECTION_RESET_COUNT,
|
| };
|
|
|
| + // Listener interface to be notified of endpoint connection events.
|
| + class ConnectionListener {
|
| + public:
|
| + ConnectionListener();
|
| + virtual ~ConnectionListener();
|
| +
|
| + // Notifies the listener that GCM has performed a handshake with and is now
|
| + // actively connected to |current_endpoint|. |socket_ip| is the resolved
|
| + // ip address/port through which the connection is being made.
|
| + virtual void OnConnected(const GURL& current_endpoint,
|
| + const net::IPEndPoint& socket_ip) = 0;
|
| +
|
| + // Notifies the listener that the connection has been interrupted.
|
| + virtual void OnDisconnected() = 0;
|
| + };
|
| +
|
| ConnectionFactory();
|
| virtual ~ConnectionFactory();
|
|
|
| @@ -66,6 +88,9 @@ class GCM_EXPORT ConnectionFactory {
|
| // connection.
|
| virtual bool IsEndpointReachable() const = 0;
|
|
|
| + // Returns a debug string describing the connection state.
|
| + virtual std::string GetConnectionStateString() const = 0;
|
| +
|
| // If in backoff, the time at which the next retry will be made. Otherwise,
|
| // a null time, indicating either no attempt to connect has been made or no
|
| // backoff is in progress.
|
| @@ -76,6 +101,11 @@ class GCM_EXPORT ConnectionFactory {
|
| // If the last connection was made within kConnectionResetWindowSecs, the old
|
| // backoff is restored, else a new backoff kicks off.
|
| virtual void SignalConnectionReset(ConnectionResetReason reason) = 0;
|
| +
|
| + // Sets the current connection listener. Only one listener is supported at a
|
| + // time, and the listener must either outlive the connection factory or
|
| + // call SetConnectionListener(NULL) upon destruction.
|
| + virtual void SetConnectionListener(ConnectionListener* listener) = 0;
|
| };
|
|
|
| } // namespace gcm
|
|
|