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 #include "chrome/browser/sync/glue/bridged_sync_notifier.h" | |
6 | |
7 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" | |
8 | |
9 namespace browser_sync { | |
10 | |
11 BridgedSyncNotifier::BridgedSyncNotifier( | |
12 ChromeSyncNotificationBridge* bridge, | |
13 syncer::SyncNotifier* delegate) | |
14 : bridge_(bridge), delegate_(delegate) { | |
15 DCHECK(bridge_); | |
16 } | |
17 | |
18 BridgedSyncNotifier::~BridgedSyncNotifier() { | |
19 } | |
20 | |
21 void BridgedSyncNotifier::RegisterHandler( | |
22 syncer::SyncNotifierObserver* handler) { | |
23 if (delegate_.get()) | |
24 delegate_->RegisterHandler(handler); | |
25 bridge_->RegisterHandler(handler); | |
26 } | |
27 | |
28 void BridgedSyncNotifier::UpdateRegisteredIds( | |
29 syncer::SyncNotifierObserver* handler, | |
30 const syncer::ObjectIdSet& ids) { | |
31 if (delegate_.get()) | |
32 delegate_->UpdateRegisteredIds(handler, ids); | |
33 bridge_->UpdateRegisteredIds(handler, ids); | |
34 } | |
35 | |
36 void BridgedSyncNotifier::UnregisterHandler( | |
37 syncer::SyncNotifierObserver* handler) { | |
38 if (delegate_.get()) | |
39 delegate_->UnregisterHandler(handler); | |
40 bridge_->UnregisterHandler(handler); | |
41 } | |
42 | |
43 void BridgedSyncNotifier::SetUniqueId(const std::string& unique_id) { | |
44 if (delegate_.get()) | |
45 delegate_->SetUniqueId(unique_id); | |
46 } | |
47 | |
48 void BridgedSyncNotifier::SetStateDeprecated(const std::string& state) { | |
49 if (delegate_.get()) | |
50 delegate_->SetStateDeprecated(state); | |
51 } | |
52 | |
53 void BridgedSyncNotifier::UpdateCredentials( | |
54 const std::string& email, const std::string& token) { | |
55 if (delegate_.get()) | |
56 delegate_->UpdateCredentials(email, token); | |
57 } | |
58 | |
59 void BridgedSyncNotifier::SendNotification( | |
60 syncer::ModelTypeSet changed_types) { | |
61 if (delegate_.get()) | |
62 delegate_->SendNotification(changed_types); | |
63 } | |
64 | |
65 } // namespace browser_sync | |
OLD | NEW |