Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: sync/internal_api/write_node.cc

Issue 273283002: Sync: Do not generate non-UTF8 names for delete directives. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: adapt to base namespace change in r268754 Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/delete_directive_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/history/delete_directive_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698