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