| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_SYNC_INVALIDATION_LISTENER_H_ | 8 #ifndef SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_ |
| 9 #define SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_ | 9 #define SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "google/cacheinvalidation/include/invalidation-listener.h" | 19 #include "google/cacheinvalidation/include/invalidation-listener.h" |
| 20 #include "jingle/notifier/listener/push_client_observer.h" | 20 #include "jingle/notifier/listener/push_client_observer.h" |
| 21 #include "sync/base/sync_export.h" |
| 21 #include "sync/internal_api/public/util/weak_handle.h" | 22 #include "sync/internal_api/public/util/weak_handle.h" |
| 22 #include "sync/notifier/invalidation_state_tracker.h" | 23 #include "sync/notifier/invalidation_state_tracker.h" |
| 23 #include "sync/notifier/invalidator_state.h" | 24 #include "sync/notifier/invalidator_state.h" |
| 24 #include "sync/notifier/object_id_invalidation_map.h" | 25 #include "sync/notifier/object_id_invalidation_map.h" |
| 25 #include "sync/notifier/state_writer.h" | 26 #include "sync/notifier/state_writer.h" |
| 26 #include "sync/notifier/sync_system_resources.h" | 27 #include "sync/notifier/sync_system_resources.h" |
| 27 | 28 |
| 28 namespace buzz { | 29 namespace buzz { |
| 29 class XmppTaskParentInterface; | 30 class XmppTaskParentInterface; |
| 30 } // namespace buzz | 31 } // namespace buzz |
| 31 | 32 |
| 32 namespace notifier { | 33 namespace notifier { |
| 33 class PushClient; | 34 class PushClient; |
| 34 } // namespace notifier | 35 } // namespace notifier |
| 35 | 36 |
| 36 namespace syncer { | 37 namespace syncer { |
| 37 | 38 |
| 38 class RegistrationManager; | 39 class RegistrationManager; |
| 39 | 40 |
| 40 // SyncInvalidationListener is not thread-safe and lives on the sync | 41 // SyncInvalidationListener is not thread-safe and lives on the sync |
| 41 // thread. | 42 // thread. |
| 42 class SyncInvalidationListener | 43 class SYNC_EXPORT_PRIVATE SyncInvalidationListener |
| 43 : public invalidation::InvalidationListener, | 44 : public NON_EXPORTED_BASE(invalidation::InvalidationListener), |
| 44 public StateWriter, | 45 public StateWriter, |
| 45 public notifier::PushClientObserver, | 46 public NON_EXPORTED_BASE(notifier::PushClientObserver), |
| 46 public base::NonThreadSafe { | 47 public base::NonThreadSafe { |
| 47 public: | 48 public: |
| 48 typedef base::Callback<invalidation::InvalidationClient*( | 49 typedef base::Callback<invalidation::InvalidationClient*( |
| 49 invalidation::SystemResources*, | 50 invalidation::SystemResources*, |
| 50 int, | 51 int, |
| 51 const invalidation::string&, | 52 const invalidation::string&, |
| 52 const invalidation::string&, | 53 const invalidation::string&, |
| 53 invalidation::InvalidationListener*)> CreateInvalidationClientCallback; | 54 invalidation::InvalidationListener*)> CreateInvalidationClientCallback; |
| 54 | 55 |
| 55 class Delegate { | 56 class SYNC_EXPORT_PRIVATE Delegate { |
| 56 public: | 57 public: |
| 57 virtual ~Delegate(); | 58 virtual ~Delegate(); |
| 58 | 59 |
| 59 virtual void OnInvalidate( | 60 virtual void OnInvalidate( |
| 60 const ObjectIdInvalidationMap& invalidation_map) = 0; | 61 const ObjectIdInvalidationMap& invalidation_map) = 0; |
| 61 | 62 |
| 62 virtual void OnInvalidatorStateChange(InvalidatorState state) = 0; | 63 virtual void OnInvalidatorStateChange(InvalidatorState state) = 0; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 explicit SyncInvalidationListener( | 66 explicit SyncInvalidationListener( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // The states of the ticl and the push client. | 155 // The states of the ticl and the push client. |
| 155 InvalidatorState ticl_state_; | 156 InvalidatorState ticl_state_; |
| 156 InvalidatorState push_client_state_; | 157 InvalidatorState push_client_state_; |
| 157 | 158 |
| 158 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener); | 159 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener); |
| 159 }; | 160 }; |
| 160 | 161 |
| 161 } // namespace syncer | 162 } // namespace syncer |
| 162 | 163 |
| 163 #endif // SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_ | 164 #endif // SYNC_NOTIFIER_SYNC_INVALIDATION_LISTENER_H_ |
| OLD | NEW |