| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // An implementation of SyncNotifier that wraps InvalidationNotifier | 5 // An implementation of SyncNotifier that wraps InvalidationNotifier |
| 6 // on its own thread. | 6 // on its own thread. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 9 #define CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 9 #define CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 virtual ~NonBlockingInvalidationNotifier(); | 43 virtual ~NonBlockingInvalidationNotifier(); |
| 44 | 44 |
| 45 // SyncNotifier implementation. | 45 // SyncNotifier implementation. |
| 46 virtual void AddObserver(SyncNotifierObserver* observer) OVERRIDE; | 46 virtual void AddObserver(SyncNotifierObserver* observer) OVERRIDE; |
| 47 virtual void RemoveObserver(SyncNotifierObserver* observer) OVERRIDE; | 47 virtual void RemoveObserver(SyncNotifierObserver* observer) OVERRIDE; |
| 48 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; | 48 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
| 49 virtual void SetState(const std::string& state) OVERRIDE; | 49 virtual void SetState(const std::string& state) OVERRIDE; |
| 50 virtual void UpdateCredentials( | 50 virtual void UpdateCredentials( |
| 51 const std::string& email, const std::string& token) OVERRIDE; | 51 const std::string& email, const std::string& token) OVERRIDE; |
| 52 virtual void UpdateEnabledTypes( | 52 virtual void UpdateEnabledTypes( |
| 53 syncable::ModelEnumSet enabled_types) OVERRIDE; | 53 syncable::ModelTypeSet enabled_types) OVERRIDE; |
| 54 virtual void SendNotification( | 54 virtual void SendNotification( |
| 55 syncable::ModelEnumSet changed_types) OVERRIDE; | 55 syncable::ModelTypeSet changed_types) OVERRIDE; |
| 56 | 56 |
| 57 // SyncNotifierObserver implementation. | 57 // SyncNotifierObserver implementation. |
| 58 virtual void OnIncomingNotification( | 58 virtual void OnIncomingNotification( |
| 59 const syncable::ModelTypePayloadMap& type_payloads) OVERRIDE; | 59 const syncable::ModelTypePayloadMap& type_payloads) OVERRIDE; |
| 60 virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE; | 60 virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE; |
| 61 virtual void StoreState(const std::string& state) OVERRIDE; | 61 virtual void StoreState(const std::string& state) OVERRIDE; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 class Core; | 64 class Core; |
| 65 | 65 |
| 66 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_; | 66 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_; |
| 67 | 67 |
| 68 // Our observers (which must live on the parent thread). | 68 // Our observers (which must live on the parent thread). |
| 69 ObserverList<SyncNotifierObserver> observers_; | 69 ObserverList<SyncNotifierObserver> observers_; |
| 70 | 70 |
| 71 // The real guts of NonBlockingInvalidationNotifier, which allows | 71 // The real guts of NonBlockingInvalidationNotifier, which allows |
| 72 // this class to live completely on the parent thread. | 72 // this class to live completely on the parent thread. |
| 73 scoped_refptr<Core> core_; | 73 scoped_refptr<Core> core_; |
| 74 scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_; | 74 scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_; |
| 75 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 75 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); | 77 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace sync_notifier | 80 } // namespace sync_notifier |
| 81 | 81 |
| 82 #endif // CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 82 #endif // CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| OLD | NEW |