OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test/fake_server/fake_server.h" | 5 #include "sync/test/fake_server/fake_server.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 if (!DeleteChildren(client_entity.id_string())) { | 329 if (!DeleteChildren(client_entity.id_string())) { |
330 return string(); | 330 return string(); |
331 } | 331 } |
332 } else if (GetModelType(client_entity) == syncer::NIGORI) { | 332 } else if (GetModelType(client_entity) == syncer::NIGORI) { |
333 // NIGORI is the only permanent item type that should be updated by the | 333 // NIGORI is the only permanent item type that should be updated by the |
334 // client. | 334 // client. |
335 entity = PermanentEntity::CreateUpdatedNigoriEntity( | 335 entity = PermanentEntity::CreateUpdatedNigoriEntity( |
336 client_entity, | 336 client_entity, |
337 entities_[client_entity.id_string()]); | 337 entities_[client_entity.id_string()]); |
338 } else if (client_entity.has_client_defined_unique_tag()) { | 338 } else if (client_entity.has_client_defined_unique_tag()) { |
339 if (entities_.find(client_entity.id_string()) != entities_.end()) { | 339 const std::string& effective_id = |
pval...(no longer on Chromium)
2014/07/23 23:54:15
Looking back at this, perhaps I was assuming that
rlarocque
2014/07/24 00:18:39
Could be. It's also possible that you implemented
| |
340 UniqueClientEntity::EffectiveIdForClientTaggedEntity(client_entity); | |
341 if (entities_.find(effective_id) != entities_.end()) { | |
340 entity = UniqueClientEntity::CreateUpdatedVersion( | 342 entity = UniqueClientEntity::CreateUpdatedVersion( |
341 client_entity, | 343 client_entity, entities_[effective_id]); |
342 entities_[client_entity.id_string()]); | |
343 } else { | 344 } else { |
344 entity = UniqueClientEntity::CreateNew(client_entity); | 345 entity = UniqueClientEntity::CreateNew(client_entity); |
345 } | 346 } |
346 } else { | 347 } else { |
347 // TODO(pvalenzuela): Validate entity's parent ID. | 348 // TODO(pvalenzuela): Validate entity's parent ID. |
348 if (entities_.find(client_entity.id_string()) != entities_.end()) { | 349 if (entities_.find(client_entity.id_string()) != entities_.end()) { |
349 entity = BookmarkEntity::CreateUpdatedVersion( | 350 entity = BookmarkEntity::CreateUpdatedVersion( |
350 client_entity, | 351 client_entity, |
351 entities_[client_entity.id_string()], | 352 entities_[client_entity.id_string()], |
352 parent_id); | 353 parent_id); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 | 521 |
521 void FakeServer::AddObserver(Observer* observer) { | 522 void FakeServer::AddObserver(Observer* observer) { |
522 observers_.AddObserver(observer); | 523 observers_.AddObserver(observer); |
523 } | 524 } |
524 | 525 |
525 void FakeServer::RemoveObserver(Observer* observer) { | 526 void FakeServer::RemoveObserver(Observer* observer) { |
526 observers_.RemoveObserver(observer); | 527 observers_.RemoveObserver(observer); |
527 } | 528 } |
528 | 529 |
529 } // namespace fake_server | 530 } // namespace fake_server |
OLD | NEW |