OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_ |
| 6 #define IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/ios/weak_nsobject.h" |
| 11 #include "base/scoped_observer.h" |
| 12 #include "components/sync_driver/sync_service_observer.h" |
| 13 |
| 14 namespace sync_driver { |
| 15 class SyncService; |
| 16 } |
| 17 |
| 18 @protocol SyncObserverModelBridge |
| 19 - (void)onSyncStateChanged; |
| 20 @end |
| 21 |
| 22 // C++ class to monitor profile sync status in Objective-C type. |
| 23 class SyncObserverBridge : public sync_driver::SyncServiceObserver { |
| 24 public: |
| 25 // |service| must outlive the SyncObserverBridge. |
| 26 SyncObserverBridge(id<SyncObserverModelBridge> delegate, |
| 27 sync_driver::SyncService* service); |
| 28 |
| 29 ~SyncObserverBridge() override; |
| 30 |
| 31 private: |
| 32 // sync_driver::SyncServiceObserver implementation: |
| 33 void OnStateChanged() override; |
| 34 |
| 35 base::WeakNSProtocol<id<SyncObserverModelBridge>> delegate_; |
| 36 ScopedObserver<sync_driver::SyncService, sync_driver::SyncServiceObserver> |
| 37 scoped_observer_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(SyncObserverBridge); |
| 40 }; |
| 41 |
| 42 #endif // IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_ |
OLD | NEW |