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

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

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SyncAPINameToServerName(WideToUTF8(title), &new_legal_title); 60 SyncAPINameToServerName(WideToUTF8(title), &new_legal_title);
61 TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); 61 base::TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title);
62 } 62 }
63 63
64 std::string current_legal_title; 64 std::string current_legal_title;
65 if (BOOKMARKS == type && 65 if (BOOKMARKS == type &&
66 entry_->GetSpecifics().has_encrypted()) { 66 entry_->GetSpecifics().has_encrypted()) {
67 // Encrypted bookmarks only have their title in the unencrypted specifics. 67 // Encrypted bookmarks only have their title in the unencrypted specifics.
68 current_legal_title = GetBookmarkSpecifics().title(); 68 current_legal_title = GetBookmarkSpecifics().title();
69 } else { 69 } else {
70 // Non-bookmarks and legacy bookmarks (those with no title in their 70 // Non-bookmarks and legacy bookmarks (those with no title in their
71 // specifics) store their title in NON_UNIQUE_NAME. Non-legacy bookmarks 71 // specifics) store their title in NON_UNIQUE_NAME. Non-legacy bookmarks
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 MarkForSyncing(); 513 MarkForSyncing();
514 514
515 return true; 515 return true;
516 } 516 }
517 517
518 void WriteNode::MarkForSyncing() { 518 void WriteNode::MarkForSyncing() {
519 syncable::MarkForSyncing(entry_); 519 syncable::MarkForSyncing(entry_);
520 } 520 }
521 521
522 } // namespace syncer 522 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698