| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // A simple wrapper around invalidation::InvalidationClient that | 5 // A simple wrapper around invalidation::InvalidationClient that |
| 6 // handles all the startup/shutdown details and hookups. | 6 // handles all the startup/shutdown details and hookups. |
| 7 | 7 |
| 8 #ifndef SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ | 8 #ifndef SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| 9 #define SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ | 9 #define SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "sync/notifier/state_writer.h" | 28 #include "sync/notifier/state_writer.h" |
| 29 | 29 |
| 30 namespace buzz { | 30 namespace buzz { |
| 31 class XmppTaskParentInterface; | 31 class XmppTaskParentInterface; |
| 32 } // namespace buzz | 32 } // namespace buzz |
| 33 | 33 |
| 34 namespace notifier { | 34 namespace notifier { |
| 35 class PushClient; | 35 class PushClient; |
| 36 } // namespace notifier | 36 } // namespace notifier |
| 37 | 37 |
| 38 namespace csync { | 38 namespace syncer { |
| 39 | 39 |
| 40 using invalidation::InvalidationListener; | 40 using invalidation::InvalidationListener; |
| 41 | 41 |
| 42 class RegistrationManager; | 42 class RegistrationManager; |
| 43 | 43 |
| 44 // ChromeInvalidationClient is not thread-safe and lives on the sync | 44 // ChromeInvalidationClient is not thread-safe and lives on the sync |
| 45 // thread. | 45 // thread. |
| 46 class ChromeInvalidationClient | 46 class ChromeInvalidationClient |
| 47 : public InvalidationListener, | 47 : public InvalidationListener, |
| 48 public StateWriter, | 48 public StateWriter, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 | 67 |
| 68 // Calls Stop(). | 68 // Calls Stop(). |
| 69 virtual ~ChromeInvalidationClient(); | 69 virtual ~ChromeInvalidationClient(); |
| 70 | 70 |
| 71 // Does not take ownership of |listener| or |state_writer|. | 71 // Does not take ownership of |listener| or |state_writer|. |
| 72 // |invalidation_state_tracker| must be initialized. | 72 // |invalidation_state_tracker| must be initialized. |
| 73 void Start( | 73 void Start( |
| 74 const std::string& client_id, const std::string& client_info, | 74 const std::string& client_id, const std::string& client_info, |
| 75 const std::string& state, | 75 const std::string& state, |
| 76 const InvalidationVersionMap& initial_max_invalidation_versions, | 76 const InvalidationVersionMap& initial_max_invalidation_versions, |
| 77 const csync::WeakHandle<InvalidationStateTracker>& | 77 const syncer::WeakHandle<InvalidationStateTracker>& |
| 78 invalidation_state_tracker, | 78 invalidation_state_tracker, |
| 79 Listener* listener); | 79 Listener* listener); |
| 80 | 80 |
| 81 void UpdateCredentials(const std::string& email, const std::string& token); | 81 void UpdateCredentials(const std::string& email, const std::string& token); |
| 82 | 82 |
| 83 // Register the sync types that we're interested in getting | 83 // Register the sync types that we're interested in getting |
| 84 // notifications for. May be called at any time. | 84 // notifications for. May be called at any time. |
| 85 void RegisterTypes(syncable::ModelTypeSet types); | 85 void RegisterTypes(syncable::ModelTypeSet types); |
| 86 | 86 |
| 87 // invalidation::InvalidationListener implementation. | 87 // invalidation::InvalidationListener implementation. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 void EmitStateChange(); | 135 void EmitStateChange(); |
| 136 | 136 |
| 137 void EmitInvalidation( | 137 void EmitInvalidation( |
| 138 syncable::ModelTypeSet types, const std::string& payload); | 138 syncable::ModelTypeSet types, const std::string& payload); |
| 139 | 139 |
| 140 // Owned by |chrome_system_resources_|. | 140 // Owned by |chrome_system_resources_|. |
| 141 notifier::PushClient* const push_client_; | 141 notifier::PushClient* const push_client_; |
| 142 ChromeSystemResources chrome_system_resources_; | 142 ChromeSystemResources chrome_system_resources_; |
| 143 InvalidationVersionMap max_invalidation_versions_; | 143 InvalidationVersionMap max_invalidation_versions_; |
| 144 csync::WeakHandle<InvalidationStateTracker> | 144 syncer::WeakHandle<InvalidationStateTracker> |
| 145 invalidation_state_tracker_; | 145 invalidation_state_tracker_; |
| 146 Listener* listener_; | 146 Listener* listener_; |
| 147 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; | 147 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; |
| 148 scoped_ptr<RegistrationManager> registration_manager_; | 148 scoped_ptr<RegistrationManager> registration_manager_; |
| 149 // Stored to pass to |registration_manager_| on start. | 149 // Stored to pass to |registration_manager_| on start. |
| 150 ObjectIdSet registered_ids_; | 150 ObjectIdSet registered_ids_; |
| 151 // TODO(dcheng): This is a mirror of the data in registered_ids_. It | 151 // TODO(dcheng): This is a mirror of the data in registered_ids_. It |
| 152 // temporarily remains for convenience. | 152 // temporarily remains for convenience. |
| 153 syncable::ModelTypeSet registered_types_; | 153 syncable::ModelTypeSet registered_types_; |
| 154 | 154 |
| 155 // The states of the ticl and the push client (with | 155 // The states of the ticl and the push client (with |
| 156 // NO_NOTIFICATION_ERROR meaning notifications are enabled). | 156 // NO_NOTIFICATION_ERROR meaning notifications are enabled). |
| 157 NotificationsDisabledReason ticl_state_; | 157 NotificationsDisabledReason ticl_state_; |
| 158 NotificationsDisabledReason push_client_state_; | 158 NotificationsDisabledReason push_client_state_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); | 160 DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 } // namespace csync | 163 } // namespace syncer |
| 164 | 164 |
| 165 #endif // SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ | 165 #endif // SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| OLD | NEW |