| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "sync/notifier/invalidator.h" |
| 11 |
| 12 namespace browser_sync { |
| 13 |
| 14 class AndroidInvalidatorBridge; |
| 15 |
| 16 // This class implements the Invalidator interface by wrapping (but not taking |
| 17 // ownership of) an AndroidInvalidatorBridge. This is useful because the |
| 18 // SyncManager currently expects to take ownership of its invalidator, but it is |
| 19 // not prepared to take ownership of the UI-thread-owned |
| 20 // AndroidInvalidatorBridge. So we use this class to wrap the |
| 21 // AndroidInvalidator and allow the SyncManager to own it instead. |
| 22 class AndroidInvalidatorBridgeProxy : public syncer::Invalidator { |
| 23 public: |
| 24 // Does not take ownership of |bridge|. |
| 25 explicit AndroidInvalidatorBridgeProxy(AndroidInvalidatorBridge* bridge); |
| 26 virtual ~AndroidInvalidatorBridgeProxy(); |
| 27 |
| 28 // Invalidator implementation. Passes through all calls to the bridge. |
| 29 virtual void RegisterHandler(syncer::InvalidationHandler* handler) OVERRIDE; |
| 30 virtual void UpdateRegisteredIds(syncer::InvalidationHandler * handler, |
| 31 const syncer::ObjectIdSet& ids) OVERRIDE; |
| 32 virtual void UnregisterHandler(syncer::InvalidationHandler* handler) OVERRIDE; |
| 33 virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE; |
| 34 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; |
| 35 virtual void SetStateDeprecated(const std::string& state) OVERRIDE; |
| 36 virtual void UpdateCredentials( |
| 37 const std::string& email, const std::string& token) OVERRIDE; |
| 38 virtual void SendInvalidation( |
| 39 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
| 40 |
| 41 private: |
| 42 // The notification bridge that we forward to but don't own. |
| 43 AndroidInvalidatorBridge* const bridge_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(AndroidInvalidatorBridgeProxy); |
| 46 }; |
| 47 |
| 48 } // namespace browser_sync |
| 49 |
| 50 #endif // CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_ |
| OLD | NEW |