| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 entry_->GetSpecifics().has_encrypted(); | 50 entry_->GetSpecifics().has_encrypted(); |
| 51 | 51 |
| 52 // If this datatype is encrypted and is not a bookmark, we disregard the | 52 // If this datatype is encrypted and is not a bookmark, we disregard the |
| 53 // specified title in favor of kEncryptedString. For encrypted bookmarks the | 53 // specified title in favor of kEncryptedString. For encrypted bookmarks the |
| 54 // NON_UNIQUE_NAME will still be kEncryptedString, but we store the real title | 54 // NON_UNIQUE_NAME will still be kEncryptedString, but we store the real title |
| 55 // into the specifics. All strings compared are server legal strings. | 55 // into the specifics. All strings compared are server legal strings. |
| 56 std::string new_legal_title; | 56 std::string new_legal_title; |
| 57 if (type != BOOKMARKS && needs_encryption) { | 57 if (type != BOOKMARKS && needs_encryption) { |
| 58 new_legal_title = kEncryptedString; | 58 new_legal_title = kEncryptedString; |
| 59 } else { | 59 } else { |
| 60 DCHECK(base::IsStringUTF8(title)); |
| 60 SyncAPINameToServerName(title, &new_legal_title); | 61 SyncAPINameToServerName(title, &new_legal_title); |
| 61 base::TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); | 62 base::TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); |
| 62 } | 63 } |
| 63 | 64 |
| 64 std::string current_legal_title; | 65 std::string current_legal_title; |
| 65 if (BOOKMARKS == type && | 66 if (BOOKMARKS == type && |
| 66 entry_->GetSpecifics().has_encrypted()) { | 67 entry_->GetSpecifics().has_encrypted()) { |
| 67 // Encrypted bookmarks only have their title in the unencrypted specifics. | 68 // Encrypted bookmarks only have their title in the unencrypted specifics. |
| 68 current_legal_title = GetBookmarkSpecifics().title(); | 69 current_legal_title = GetBookmarkSpecifics().title(); |
| 69 } else { | 70 } else { |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 MarkForSyncing(); | 505 MarkForSyncing(); |
| 505 | 506 |
| 506 return true; | 507 return true; |
| 507 } | 508 } |
| 508 | 509 |
| 509 void WriteNode::MarkForSyncing() { | 510 void WriteNode::MarkForSyncing() { |
| 510 syncable::MarkForSyncing(entry_); | 511 syncable::MarkForSyncing(entry_); |
| 511 } | 512 } |
| 512 | 513 |
| 513 } // namespace syncer | 514 } // namespace syncer |
| OLD | NEW |