| 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 16 matching lines...) Expand all Loading... |
| 27 #include "sync/notifier/state_writer.h" | 27 #include "sync/notifier/state_writer.h" |
| 28 | 28 |
| 29 namespace buzz { | 29 namespace buzz { |
| 30 class XmppTaskParentInterface; | 30 class XmppTaskParentInterface; |
| 31 } // namespace buzz | 31 } // namespace buzz |
| 32 | 32 |
| 33 namespace notifier { | 33 namespace notifier { |
| 34 class PushClient; | 34 class PushClient; |
| 35 } // namespace notifier | 35 } // namespace notifier |
| 36 | 36 |
| 37 namespace csync { | 37 namespace syncer { |
| 38 | 38 |
| 39 using invalidation::InvalidationListener; | 39 using invalidation::InvalidationListener; |
| 40 | 40 |
| 41 class RegistrationManager; | 41 class RegistrationManager; |
| 42 | 42 |
| 43 // ChromeInvalidationClient is not thread-safe and lives on the sync | 43 // ChromeInvalidationClient is not thread-safe and lives on the sync |
| 44 // thread. | 44 // thread. |
| 45 class ChromeInvalidationClient | 45 class ChromeInvalidationClient |
| 46 : public InvalidationListener, | 46 : public InvalidationListener, |
| 47 public StateWriter, | 47 public StateWriter, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 | 66 |
| 67 // Calls Stop(). | 67 // Calls Stop(). |
| 68 virtual ~ChromeInvalidationClient(); | 68 virtual ~ChromeInvalidationClient(); |
| 69 | 69 |
| 70 // Does not take ownership of |listener| or |state_writer|. | 70 // Does not take ownership of |listener| or |state_writer|. |
| 71 // |invalidation_state_tracker| must be initialized. | 71 // |invalidation_state_tracker| must be initialized. |
| 72 void Start( | 72 void Start( |
| 73 const std::string& client_id, const std::string& client_info, | 73 const std::string& client_id, const std::string& client_info, |
| 74 const std::string& state, | 74 const std::string& state, |
| 75 const InvalidationVersionMap& initial_max_invalidation_versions, | 75 const InvalidationVersionMap& initial_max_invalidation_versions, |
| 76 const csync::WeakHandle<InvalidationStateTracker>& | 76 const syncer::WeakHandle<InvalidationStateTracker>& |
| 77 invalidation_state_tracker, | 77 invalidation_state_tracker, |
| 78 Listener* listener); | 78 Listener* listener); |
| 79 | 79 |
| 80 void UpdateCredentials(const std::string& email, const std::string& token); | 80 void UpdateCredentials(const std::string& email, const std::string& token); |
| 81 | 81 |
| 82 // Register the sync types that we're interested in getting | 82 // Register the sync types that we're interested in getting |
| 83 // notifications for. May be called at any time. | 83 // notifications for. May be called at any time. |
| 84 void RegisterTypes(syncable::ModelTypeSet types); | 84 void RegisterTypes(syncable::ModelTypeSet types); |
| 85 | 85 |
| 86 // invalidation::InvalidationListener implementation. | 86 // invalidation::InvalidationListener implementation. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 void EmitStateChange(); | 134 void EmitStateChange(); |
| 135 | 135 |
| 136 void EmitInvalidation( | 136 void EmitInvalidation( |
| 137 syncable::ModelTypeSet types, const std::string& payload); | 137 syncable::ModelTypeSet types, const std::string& payload); |
| 138 | 138 |
| 139 // Owned by |chrome_system_resources_|. | 139 // Owned by |chrome_system_resources_|. |
| 140 notifier::PushClient* const push_client_; | 140 notifier::PushClient* const push_client_; |
| 141 ChromeSystemResources chrome_system_resources_; | 141 ChromeSystemResources chrome_system_resources_; |
| 142 InvalidationVersionMap max_invalidation_versions_; | 142 InvalidationVersionMap max_invalidation_versions_; |
| 143 csync::WeakHandle<InvalidationStateTracker> | 143 syncer::WeakHandle<InvalidationStateTracker> |
| 144 invalidation_state_tracker_; | 144 invalidation_state_tracker_; |
| 145 Listener* listener_; | 145 Listener* listener_; |
| 146 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; | 146 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; |
| 147 scoped_ptr<RegistrationManager> registration_manager_; | 147 scoped_ptr<RegistrationManager> registration_manager_; |
| 148 // Stored to pass to |registration_manager_| on start. | 148 // Stored to pass to |registration_manager_| on start. |
| 149 syncable::ModelTypeSet registered_types_; | 149 syncable::ModelTypeSet registered_types_; |
| 150 | 150 |
| 151 // The states of the ticl and the push client (with | 151 // The states of the ticl and the push client (with |
| 152 // NO_NOTIFICATION_ERROR meaning notifications are enabled). | 152 // NO_NOTIFICATION_ERROR meaning notifications are enabled). |
| 153 NotificationsDisabledReason ticl_state_; | 153 NotificationsDisabledReason ticl_state_; |
| 154 NotificationsDisabledReason push_client_state_; | 154 NotificationsDisabledReason push_client_state_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); | 156 DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace csync | 159 } // namespace syncer |
| 160 | 160 |
| 161 #endif // SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ | 161 #endif // SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_ |
| OLD | NEW |