OLD | NEW |
1 // Copyright 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 #include "ios/chrome/browser/sync/sync_observer_bridge.h" | 5 #include "ios/chrome/browser/sync/sync_observer_bridge.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/sync/driver/sync_service.h" | 8 #include "components/sync/driver/sync_service.h" |
9 | 9 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
11 #error "This file requires ARC support." | 11 #error "This file requires ARC support." |
12 #endif | 12 #endif |
13 | 13 |
14 SyncObserverBridge::SyncObserverBridge(id<SyncObserverModelBridge> delegate, | 14 SyncObserverBridge::SyncObserverBridge(id<SyncObserverModelBridge> delegate, |
15 syncer::SyncService* sync_service) | 15 syncer::SyncService* sync_service) |
16 : delegate_(delegate), scoped_observer_(this) { | 16 : delegate_(delegate), scoped_observer_(this) { |
17 DCHECK(delegate); | 17 DCHECK(delegate); |
18 if (sync_service) | 18 if (sync_service) |
19 scoped_observer_.Add(sync_service); | 19 scoped_observer_.Add(sync_service); |
20 } | 20 } |
21 | 21 |
22 SyncObserverBridge::~SyncObserverBridge() { | 22 SyncObserverBridge::~SyncObserverBridge() { |
23 } | 23 } |
24 | 24 |
25 void SyncObserverBridge::OnStateChanged() { | 25 void SyncObserverBridge::OnStateChanged() { |
26 [delegate_ onSyncStateChanged]; | 26 [delegate_ onSyncStateChanged]; |
27 } | 27 } |
28 | 28 |
29 void SyncObserverBridge::OnSyncConfigurationCompleted() { | 29 void SyncObserverBridge::OnSyncConfigurationCompleted() { |
30 if ([delegate_ respondsToSelector:@selector(onSyncConfigurationCompleted:)]) | 30 if ([delegate_ respondsToSelector:@selector(onSyncConfigurationCompleted)]) |
31 [delegate_ onSyncConfigurationCompleted]; | 31 [delegate_ onSyncConfigurationCompleted]; |
32 } | 32 } |
OLD | NEW |