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 "sync/notifier/fake_invalidator.h" | 5 #include "sync/notifier/fake_invalidator.h" |
6 | 6 |
7 namespace syncer { | 7 namespace syncer { |
8 | 8 |
9 FakeInvalidator::FakeInvalidator() {} | 9 FakeInvalidator::FakeInvalidator() {} |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 const std::string& FakeInvalidator::GetCredentialsToken() const { | 34 const std::string& FakeInvalidator::GetCredentialsToken() const { |
35 return token_; | 35 return token_; |
36 } | 36 } |
37 | 37 |
38 const ObjectIdStateMap& FakeInvalidator::GetLastSentIdStateMap() const { | 38 const ObjectIdStateMap& FakeInvalidator::GetLastSentIdStateMap() const { |
39 return last_sent_id_state_map_; | 39 return last_sent_id_state_map_; |
40 } | 40 } |
41 | 41 |
42 void FakeInvalidator::EmitOnNotificationsEnabled() { | 42 void FakeInvalidator::EmitOnInvalidatorStateChange(InvalidatorState state) { |
43 registrar_.EmitOnNotificationsEnabled(); | 43 registrar_.UpdateInvalidatorState(state); |
44 } | 44 } |
45 | 45 |
46 void FakeInvalidator::EmitOnIncomingNotification( | 46 void FakeInvalidator::EmitOnIncomingInvalidation( |
47 const ObjectIdStateMap& id_state_map, | 47 const ObjectIdStateMap& id_state_map, |
48 IncomingNotificationSource source) { | 48 IncomingInvalidationSource source) { |
49 registrar_.DispatchInvalidationsToHandlers(id_state_map, source); | 49 registrar_.DispatchInvalidationsToHandlers(id_state_map, source); |
50 } | 50 } |
51 | 51 |
52 void FakeInvalidator::EmitOnNotificationsDisabled( | |
53 NotificationsDisabledReason reason) { | |
54 registrar_.EmitOnNotificationsDisabled(reason); | |
55 } | |
56 | |
57 void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) { | 52 void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) { |
58 registrar_.RegisterHandler(handler); | 53 registrar_.RegisterHandler(handler); |
59 } | 54 } |
60 | 55 |
61 void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, | 56 void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, |
62 const ObjectIdSet& ids) { | 57 const ObjectIdSet& ids) { |
63 registrar_.UpdateRegisteredIds(handler, ids); | 58 registrar_.UpdateRegisteredIds(handler, ids); |
64 } | 59 } |
65 | 60 |
66 void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) { | 61 void FakeInvalidator::UnregisterHandler(InvalidationHandler* handler) { |
67 registrar_.UnregisterHandler(handler); | 62 registrar_.UnregisterHandler(handler); |
68 } | 63 } |
69 | 64 |
| 65 InvalidatorState FakeInvalidator::GetInvalidatorState() const { |
| 66 return registrar_.GetInvalidatorState(); |
| 67 } |
| 68 |
70 void FakeInvalidator::SetUniqueId(const std::string& unique_id) { | 69 void FakeInvalidator::SetUniqueId(const std::string& unique_id) { |
71 unique_id_ = unique_id; | 70 unique_id_ = unique_id; |
72 } | 71 } |
73 | 72 |
74 void FakeInvalidator::SetStateDeprecated(const std::string& state) { | 73 void FakeInvalidator::SetStateDeprecated(const std::string& state) { |
75 state_ = state; | 74 state_ = state; |
76 } | 75 } |
77 | 76 |
78 void FakeInvalidator::UpdateCredentials( | 77 void FakeInvalidator::UpdateCredentials( |
79 const std::string& email, const std::string& token) { | 78 const std::string& email, const std::string& token) { |
80 email_ = email; | 79 email_ = email; |
81 token_ = token; | 80 token_ = token; |
82 } | 81 } |
83 | 82 |
84 void FakeInvalidator::SendNotification(const ObjectIdStateMap& id_state_map) { | 83 void FakeInvalidator::SendInvalidation(const ObjectIdStateMap& id_state_map) { |
85 last_sent_id_state_map_ = id_state_map; | 84 last_sent_id_state_map_ = id_state_map; |
86 } | 85 } |
87 | 86 |
88 } // namespace syncer | 87 } // namespace syncer |
OLD | NEW |