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

Unified Diff: chrome/browser/history/delete_directive_handler.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/rand_util.h ('k') | sync/internal_api/write_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/delete_directive_handler.cc
===================================================================
--- chrome/browser/history/delete_directive_handler.cc (revision 268622)
+++ chrome/browser/history/delete_directive_handler.cc (working copy)
@@ -18,6 +18,15 @@
namespace {
+std::string RandASCIIString(size_t length) {
+ std::string result;
+ const int kMin = static_cast<int>(' ');
+ const int kMax = static_cast<int>('~');
+ for (size_t i = 0; i < length; ++i)
+ result.push_back(static_cast<char>(base::RandInt(kMin, kMax)));
+ return result;
+}
+
std::string DeleteDirectiveToString(
const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive) {
scoped_ptr<base::DictionaryValue> value(
@@ -354,7 +363,7 @@
// Generate a random sync tag since history delete directives don't
// have a 'built-in' ID. 8 bytes should suffice.
- std::string sync_tag = base::RandBytesAsString(8);
+ std::string sync_tag = RandASCIIString(8);
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_history_delete_directive()->CopyFrom(
delete_directive);
« no previous file with comments | « base/rand_util.h ('k') | sync/internal_api/write_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698