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

Unified Diff: components/gcm_driver/gcm_driver_desktop.h

Issue 515763002: [GCM] Extracting GCMConnectionObserver from GCMAppHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finishing the CL on a box that compiles much faster... Created 6 years, 4 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 8eba9683961033c3b9c58f1d553ed9cbc1b9be52..04bc22d15a9832934e833f50b3e1ac3d12cfa6c1 100644
--- a/components/gcm_driver/gcm_driver_desktop.h
+++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -14,7 +14,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "components/gcm_driver/gcm_client.h"
+#include "components/gcm_driver/gcm_connection_observer.h"
#include "components/gcm_driver/gcm_driver.h"
namespace base {
@@ -55,6 +57,9 @@ class GCMDriverDesktop : public GCMDriver {
virtual void AddAppHandler(const std::string& app_id,
GCMAppHandler* handler) OVERRIDE;
virtual void RemoveAppHandler(const std::string& app_id) OVERRIDE;
+ virtual void AddConnectionObserver(GCMConnectionObserver* observer) OVERRIDE;
+ virtual void RemoveConnectionObserver(
+ GCMConnectionObserver* observer) OVERRIDE;
virtual void Enable() OVERRIDE;
virtual void Disable() OVERRIDE;
virtual GCMClient* GetGCMClientForTesting() const OVERRIDE;
@@ -134,6 +139,10 @@ class GCMDriverDesktop : public GCMDriver {
// it may be out of date while connection changes are happening.
bool connected_;
+ // List of observers to notify when connection state changes.
+ // Makes sure list is empty on destruction.
+ ObserverList<GCMConnectionObserver, true> connection_observer_list_;
+
scoped_refptr<base::SequencedTaskRunner> ui_thread_;
scoped_refptr<base::SequencedTaskRunner> io_thread_;

Powered by Google App Engine
This is Rietveld 408576698