| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/sync/glue/bridged_invalidator.h" | 5 #include "chrome/browser/sync/glue/bridged_invalidator.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" | 7 #include "chrome/browser/sync/glue/chrome_sync_notification_bridge.h" |
| 8 | 8 |
| 9 namespace browser_sync { | 9 namespace browser_sync { |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 void BridgedInvalidator::UpdateRegisteredIds( | 31 void BridgedInvalidator::UpdateRegisteredIds( |
| 32 syncer::InvalidationHandler* handler, | 32 syncer::InvalidationHandler* handler, |
| 33 const syncer::ObjectIdSet& ids) { | 33 const syncer::ObjectIdSet& ids) { |
| 34 if (delegate_.get()) | 34 if (delegate_.get()) |
| 35 delegate_->UpdateRegisteredIds(handler, ids); | 35 delegate_->UpdateRegisteredIds(handler, ids); |
| 36 bridge_->UpdateRegisteredIds(handler, ids); | 36 bridge_->UpdateRegisteredIds(handler, ids); |
| 37 } | 37 } |
| 38 | 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( | 39 void BridgedInvalidator::UnregisterHandler( |
| 47 syncer::InvalidationHandler* handler) { | 40 syncer::InvalidationHandler* handler) { |
| 48 if (delegate_.get()) | 41 if (delegate_.get()) |
| 49 delegate_->UnregisterHandler(handler); | 42 delegate_->UnregisterHandler(handler); |
| 50 bridge_->UnregisterHandler(handler); | 43 bridge_->UnregisterHandler(handler); |
| 51 } | 44 } |
| 52 | 45 |
| 46 void BridgedInvalidator::Acknowledge(const invalidation::ObjectId& id, |
| 47 const syncer::AckHandle& ack_handle) { |
| 48 if (delegate_.get()) |
| 49 delegate_->Acknowledge(id, ack_handle); |
| 50 } |
| 51 |
| 52 syncer::InvalidatorState BridgedInvalidator::GetInvalidatorState() const { |
| 53 return |
| 54 delegate_.get() ? |
| 55 delegate_->GetInvalidatorState() : |
| 56 default_invalidator_state_; |
| 57 } |
| 58 |
| 53 void BridgedInvalidator::SetUniqueId(const std::string& unique_id) { | 59 void BridgedInvalidator::SetUniqueId(const std::string& unique_id) { |
| 54 if (delegate_.get()) | 60 if (delegate_.get()) |
| 55 delegate_->SetUniqueId(unique_id); | 61 delegate_->SetUniqueId(unique_id); |
| 56 } | 62 } |
| 57 | 63 |
| 58 void BridgedInvalidator::SetStateDeprecated(const std::string& state) { | 64 void BridgedInvalidator::SetStateDeprecated(const std::string& state) { |
| 59 if (delegate_.get()) | 65 if (delegate_.get()) |
| 60 delegate_->SetStateDeprecated(state); | 66 delegate_->SetStateDeprecated(state); |
| 61 } | 67 } |
| 62 | 68 |
| 63 void BridgedInvalidator::UpdateCredentials( | 69 void BridgedInvalidator::UpdateCredentials( |
| 64 const std::string& email, const std::string& token) { | 70 const std::string& email, const std::string& token) { |
| 65 if (delegate_.get()) | 71 if (delegate_.get()) |
| 66 delegate_->UpdateCredentials(email, token); | 72 delegate_->UpdateCredentials(email, token); |
| 67 } | 73 } |
| 68 | 74 |
| 69 void BridgedInvalidator::SendInvalidation( | 75 void BridgedInvalidator::SendInvalidation( |
| 70 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 76 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
| 71 if (delegate_.get()) | 77 if (delegate_.get()) |
| 72 delegate_->SendInvalidation(invalidation_map); | 78 delegate_->SendInvalidation(invalidation_map); |
| 73 } | 79 } |
| 74 | 80 |
| 75 } // namespace browser_sync | 81 } // namespace browser_sync |
| OLD | NEW |