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 // SyncSessionContext encapsulates the contextual information and engine | 5 // SyncSessionContext encapsulates the contextual information and engine |
6 // components specific to a SyncSession. A context is accessible via | 6 // components specific to a SyncSession. A context is accessible via |
7 // a SyncSession so that session SyncerCommands and parts of the engine have | 7 // a SyncSession so that session SyncerCommands and parts of the engine have |
8 // a convenient way to access other parts. In this way it can be thought of as | 8 // a convenient way to access other parts. In this way it can be thought of as |
9 // the surrounding environment for the SyncSession. The components of this | 9 // the surrounding environment for the SyncSession. The components of this |
10 // environment are either valid or not valid for the entire context lifetime, | 10 // environment are either valid or not valid for the entire context lifetime, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK(account_name_.empty()); | 103 DCHECK(account_name_.empty()); |
104 account_name_ = name; | 104 account_name_ = name; |
105 } | 105 } |
106 const std::string& account_name() const { return account_name_; } | 106 const std::string& account_name() const { return account_name_; } |
107 | 107 |
108 void set_max_commit_batch_size(int batch_size) { | 108 void set_max_commit_batch_size(int batch_size) { |
109 max_commit_batch_size_ = batch_size; | 109 max_commit_batch_size_ = batch_size; |
110 } | 110 } |
111 int32 max_commit_batch_size() const { return max_commit_batch_size_; } | 111 int32 max_commit_batch_size() const { return max_commit_batch_size_; } |
112 | 112 |
| 113 const ModelSafeRoutingInfo& previous_session_routing_info() const { |
| 114 return previous_session_routing_info_; |
| 115 } |
| 116 |
| 117 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) { |
| 118 previous_session_routing_info_ = info; |
| 119 } |
| 120 |
113 void NotifyListeners(const SyncEngineEvent& event) { | 121 void NotifyListeners(const SyncEngineEvent& event) { |
114 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, | 122 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, |
115 OnSyncEngineEvent(event)); | 123 OnSyncEngineEvent(event)); |
116 } | 124 } |
117 | 125 |
118 TrafficRecorder* traffic_recorder() { | 126 TrafficRecorder* traffic_recorder() { |
119 return traffic_recorder_; | 127 return traffic_recorder_; |
120 } | 128 } |
121 | 129 |
122 private: | 130 private: |
(...skipping 25 matching lines...) Expand all Loading... |
148 // Kept up to date with talk events to determine whether notifications are | 156 // Kept up to date with talk events to determine whether notifications are |
149 // enabled. True only if the notification channel is authorized and open. | 157 // enabled. True only if the notification channel is authorized and open. |
150 bool notifications_enabled_; | 158 bool notifications_enabled_; |
151 | 159 |
152 // The name of the account being synced. | 160 // The name of the account being synced. |
153 std::string account_name_; | 161 std::string account_name_; |
154 | 162 |
155 // The server limits the number of items a client can commit in one batch. | 163 // The server limits the number of items a client can commit in one batch. |
156 int max_commit_batch_size_; | 164 int max_commit_batch_size_; |
157 | 165 |
| 166 // Some routing info history to help us clean up types that get disabled |
| 167 // by the user. |
| 168 ModelSafeRoutingInfo previous_session_routing_info_; |
| 169 |
158 ThrottledDataTypeTracker* throttled_data_type_tracker_; | 170 ThrottledDataTypeTracker* throttled_data_type_tracker_; |
159 | 171 |
160 // We use this to get debug info to send to the server for debugging | 172 // We use this to get debug info to send to the server for debugging |
161 // client behavior on server side. | 173 // client behavior on server side. |
162 DebugInfoGetter* const debug_info_getter_; | 174 DebugInfoGetter* const debug_info_getter_; |
163 | 175 |
164 TrafficRecorder* traffic_recorder_; | 176 TrafficRecorder* traffic_recorder_; |
165 | 177 |
166 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); | 178 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); |
167 }; | 179 }; |
(...skipping 18 matching lines...) Expand all Loading... |
186 private: | 198 private: |
187 SyncSessionContext* context_; | 199 SyncSessionContext* context_; |
188 ConflictResolver* resolver_; | 200 ConflictResolver* resolver_; |
189 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); | 201 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); |
190 }; | 202 }; |
191 | 203 |
192 } // namespace sessions | 204 } // namespace sessions |
193 } // namespace syncer | 205 } // namespace syncer |
194 | 206 |
195 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 207 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
OLD | NEW |