| Index: ios/chrome/browser/sync/sync_observer_bridge.h
|
| diff --git a/ios/chrome/browser/sync/sync_observer_bridge.h b/ios/chrome/browser/sync/sync_observer_bridge.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0ea0ca111eab57f1f16cc2d2e08006a884d6bbcf
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/sync/sync_observer_bridge.h
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_
|
| +#define IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/ios/weak_nsobject.h"
|
| +#include "base/scoped_observer.h"
|
| +#include "components/sync_driver/sync_service_observer.h"
|
| +
|
| +namespace sync_driver {
|
| +class SyncService;
|
| +}
|
| +
|
| +@protocol SyncObserverModelBridge
|
| +- (void)onSyncStateChanged;
|
| +@end
|
| +
|
| +// C++ class to monitor profile sync status in Objective-C type.
|
| +class SyncObserverBridge : public sync_driver::SyncServiceObserver {
|
| + public:
|
| + // |service| must outlive the SyncObserverBridge.
|
| + SyncObserverBridge(id<SyncObserverModelBridge> delegate,
|
| + sync_driver::SyncService* service);
|
| +
|
| + ~SyncObserverBridge() override;
|
| +
|
| + private:
|
| + // sync_driver::SyncServiceObserver implementation:
|
| + void OnStateChanged() override;
|
| +
|
| + base::WeakNSProtocol<id<SyncObserverModelBridge>> delegate_;
|
| + ScopedObserver<sync_driver::SyncService, sync_driver::SyncServiceObserver>
|
| + scoped_observer_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SyncObserverBridge);
|
| +};
|
| +
|
| +#endif // IOS_CHROME_BROWSER_SYNC_SYNC_OBSERVER_BRIDGE_H_
|
|
|