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

Unified Diff: components/gcm_driver/gcm_driver_desktop.h

Issue 320993003: [GCM] Add app handler support for connection events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add basic tests Created 6 years, 6 months 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: components/gcm_driver/gcm_driver_desktop.h
diff --git a/components/gcm_driver/gcm_driver_desktop.h b/components/gcm_driver/gcm_driver_desktop.h
index 3c84d134e59c983430d978e030f24bea69431398..8987a29c71119cae90bad6ac49a3efd1871c400a 100644
--- a/components/gcm_driver/gcm_driver_desktop.h
+++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -66,6 +66,7 @@ class GCMDriverDesktop : public GCMDriver, public IdentityProvider::Observer {
virtual GCMClient* GetGCMClientForTesting() const OVERRIDE;
virtual bool IsStarted() const OVERRIDE;
virtual bool IsGCMClientReady() const OVERRIDE;
+ virtual bool IsConnected() const OVERRIDE;
virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
bool clear_logs) OVERRIDE;
virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback,
@@ -110,6 +111,8 @@ class GCMDriverDesktop : public GCMDriver, public IdentityProvider::Observer {
void MessageSendError(const std::string& app_id,
const GCMClient::SendErrorDetails& send_error_details);
void GCMClientReady();
+ void OnConnected(const net::IPEndPoint& ip_endpoint);
+ void OnDisconnected();
void GetGCMStatisticsFinished(const GCMClient::GCMStatistics& stats);
@@ -119,6 +122,11 @@ class GCMDriverDesktop : public GCMDriver, public IdentityProvider::Observer {
// Flag to indicate if GCMClient is ready.
bool gcm_client_ready_;
+ // Flag to indicate the last known state of the GCM client. Because this
+ // flag lives on the UI thread, while the GCM client lives on the IO thread,
+ // it may be out of date while connection changes are happening.
+ bool connected_;
+
// The account ID that this service is responsible for. Empty when the service
// is not running.
std::string account_id_;

Powered by Google App Engine
This is Rietveld 408576698