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

Unified Diff: sync/notifier/chrome_invalidation_client.h

Issue 10545170: [Sync] Propagate XMPP auth errors to SyncNotifierObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps, win compile error Created 8 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
« no previous file with comments | « sync/internal_api/syncapi_unittest.cc ('k') | sync/notifier/chrome_invalidation_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/chrome_invalidation_client.h
diff --git a/sync/notifier/chrome_invalidation_client.h b/sync/notifier/chrome_invalidation_client.h
index fe25dc354090c0f79e58aa4b2620f9793ffcb393..c423c8d379037e0a9c55a4e863c9fd599bfc01b7 100644
--- a/sync/notifier/chrome_invalidation_client.h
+++ b/sync/notifier/chrome_invalidation_client.h
@@ -17,11 +17,13 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "google/cacheinvalidation/include/invalidation-listener.h"
+#include "jingle/notifier/listener/push_client_observer.h"
#include "sync/internal_api/public/syncable/model_type.h"
#include "sync/internal_api/public/syncable/model_type_payload_map.h"
#include "sync/internal_api/public/util/weak_handle.h"
#include "sync/notifier/chrome_system_resources.h"
#include "sync/notifier/invalidation_state_tracker.h"
+#include "sync/notifier/notifications_disabled_reason.h"
#include "sync/notifier/state_writer.h"
namespace buzz {
@@ -43,6 +45,7 @@ class RegistrationManager;
class ChromeInvalidationClient
: public InvalidationListener,
public StateWriter,
+ public notifier::PushClientObserver,
public base::NonThreadSafe {
public:
class Listener {
@@ -52,7 +55,10 @@ class ChromeInvalidationClient
virtual void OnInvalidate(
const syncable::ModelTypePayloadMap& type_payloads) = 0;
- virtual void OnSessionStatusChanged(bool has_session) = 0;
+ virtual void OnNotificationsEnabled() = 0;
+
+ virtual void OnNotificationsDisabled(
+ NotificationsDisabledReason reason) = 0;
};
explicit ChromeInvalidationClient(
@@ -77,8 +83,6 @@ class ChromeInvalidationClient
// notifications for. May be called at any time.
void RegisterTypes(syncable::ModelTypeSet types);
- virtual void WriteState(const std::string& state) OVERRIDE;
-
// invalidation::InvalidationListener implementation.
virtual void Ready(
invalidation::InvalidationClient* client) OVERRIDE;
@@ -110,14 +114,30 @@ class ChromeInvalidationClient
invalidation::InvalidationClient* client,
const invalidation::ErrorInfo& error_info) OVERRIDE;
+ // StateWriter implementation.
+ virtual void WriteState(const std::string& state) OVERRIDE;
+
+ // notifier::PushClientObserver implementation.
+ virtual void OnNotificationsEnabled() OVERRIDE;
+ virtual void OnNotificationsDisabled(
+ notifier::NotificationsDisabledReason reason) OVERRIDE;
+ virtual void OnIncomingNotification(
+ const notifier::Notification& notification) OVERRIDE;
+
private:
friend class ChromeInvalidationClientTest;
void Stop();
+ NotificationsDisabledReason GetState() const;
+
+ void EmitStateChange();
+
void EmitInvalidation(
syncable::ModelTypeSet types, const std::string& payload);
+ // Owned by |chrome_system_resources_|.
+ notifier::PushClient* const push_client_;
ChromeSystemResources chrome_system_resources_;
InvalidationVersionMap max_invalidation_versions_;
browser_sync::WeakHandle<InvalidationStateTracker>
@@ -127,7 +147,11 @@ class ChromeInvalidationClient
scoped_ptr<RegistrationManager> registration_manager_;
// Stored to pass to |registration_manager_| on start.
syncable::ModelTypeSet registered_types_;
- bool ticl_ready_;
+
+ // The states of the ticl and the push client (with
+ // NO_NOTIFICATION_ERROR meaning notifications are enabled).
+ NotificationsDisabledReason ticl_state_;
rlarocque 2012/06/18 18:14:14 optional: Could you remove these? A common patter
+ NotificationsDisabledReason push_client_state_;
DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient);
};
« no previous file with comments | « sync/internal_api/syncapi_unittest.cc ('k') | sync/notifier/chrome_invalidation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698