diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 08:28:43 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 08:28:43 +0000 |
commit | fc6078a7557c50af68a2b241624fb0c445fbbadb (patch) | |
tree | 932eedc858d364ce6b389a8b301d4e8b0ab93a90 /components/gcm_driver/gcm_app_handler.h | |
parent | c6eac1cc5434b3ba6d98af6c735d92179b28addf (diff) | |
download | chromium_src-fc6078a7557c50af68a2b241624fb0c445fbbadb.zip chromium_src-fc6078a7557c50af68a2b241624fb0c445fbbadb.tar.gz chromium_src-fc6078a7557c50af68a2b241624fb0c445fbbadb.tar.bz2 |
[GCM] Add app handler support for connection events
The OnConnected/OnDisconnected events are now plumbed through to app handlers
(and the default app handler). The App Handler has a default empty
implementation for those apps that don't care about exposing it. Additionally,
because an app might miss the first OnConnected event, an IsConnected method
is exposed by the GCMDriver that returns the last known connected status as
seen by the UI thread.
BUG=378536
Review URL: https://codereview.chromium.org/320993003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/gcm_driver/gcm_app_handler.h')
-rw-r--r-- | components/gcm_driver/gcm_app_handler.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/gcm_driver/gcm_app_handler.h b/components/gcm_driver/gcm_app_handler.h index 31bab34..b4b497e 100644 --- a/components/gcm_driver/gcm_app_handler.h +++ b/components/gcm_driver/gcm_app_handler.h @@ -16,8 +16,8 @@ namespace gcm { // app. class GCMAppHandler { public: - GCMAppHandler() {} - virtual ~GCMAppHandler() {} + GCMAppHandler(); + virtual ~GCMAppHandler(); // Called to do all the cleanup when GCM is shutting down. // In the case that multiple apps share the same app handler, it should be @@ -35,6 +35,16 @@ class GCMAppHandler { virtual void OnSendError( const std::string& app_id, const GCMClient::SendErrorDetails& send_error_details) = 0; + + // Called when a new connection is established and a successful handshake + // has been performed. Note that |ip_endpoint| is only set if available for + // the current platform. + // Default implementation does nothing. + virtual void OnConnected(const net::IPEndPoint& ip_endpoint); + + // Called when the connection is interrupted. + // Default implementation does nothing. + virtual void OnDisconnected(); }; } // namespace gcm |