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/internal_api/public/write_node.h" | 5 #include "sync/internal_api/public/write_node.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "sync/internal_api/public/base_transaction.h" | 10 #include "sync/internal_api/public/base_transaction.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 378 |
379 if (!entry_->good()) | 379 if (!entry_->good()) |
380 return INIT_FAILED_COULD_NOT_CREATE_ENTRY; | 380 return INIT_FAILED_COULD_NOT_CREATE_ENTRY; |
381 | 381 |
382 // Has no impact if the client tag is already set. | 382 // Has no impact if the client tag is already set. |
383 entry_->PutUniqueClientTag(hash); | 383 entry_->PutUniqueClientTag(hash); |
384 | 384 |
385 // We don't support directory and tag combinations. | 385 // We don't support directory and tag combinations. |
386 entry_->PutIsDir(false); | 386 entry_->PutIsDir(false); |
387 | 387 |
388 if (!parent_id.IsNull()) { | 388 if (entry_->ShouldMaintainPosition()) { |
389 if (!PutPredecessor(NULL)) | 389 if (!entry_->PutPredecessor(syncable::Id())) |
390 return INIT_FAILED_SET_PREDECESSOR; | 390 return INIT_FAILED_SET_PREDECESSOR; |
391 } | 391 } |
392 | 392 |
393 // Mark this entry as unsynced, to wake up the syncer. | 393 // Mark this entry as unsynced, to wake up the syncer. |
394 MarkForSyncing(); | 394 MarkForSyncing(); |
395 | 395 |
396 return INIT_SUCCESS; | 396 return INIT_SUCCESS; |
397 } | 397 } |
398 | 398 |
399 bool WriteNode::SetPosition(const BaseNode& new_parent, | 399 bool WriteNode::SetPosition(const BaseNode& new_parent, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 syncable::Id predecessor_id = predecessor ? | 463 syncable::Id predecessor_id = predecessor ? |
464 predecessor->GetEntry()->GetId() : syncable::Id(); | 464 predecessor->GetEntry()->GetId() : syncable::Id(); |
465 return entry_->PutPredecessor(predecessor_id); | 465 return entry_->PutPredecessor(predecessor_id); |
466 } | 466 } |
467 | 467 |
468 void WriteNode::MarkForSyncing() { | 468 void WriteNode::MarkForSyncing() { |
469 syncable::MarkForSyncing(entry_); | 469 syncable::MarkForSyncing(entry_); |
470 } | 470 } |
471 | 471 |
472 } // namespace syncer | 472 } // namespace syncer |
OLD | NEW |