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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 149343: http://codereview.chromium.org/147084... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 20172)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -166,6 +166,7 @@
#include "base/histogram.h"
#include "base/path_service.h"
#include "base/platform_thread.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "base/task.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -762,16 +763,29 @@
DCHECK(result == kGUIDSize);
return WideToUTF8(guid_string.substr(1, guid_string.length() - 2));
+#elif defined(LINUX2)
+ uint64 sixteen_bytes[2] = { base::RandUint64(), base::RandUint64() };
+ return RandomBytesToGUIDString(sixteen_bytes);
#else
- // TODO(port): Implement for Mac and linux.
- // Rather than actually implementing a random source, might this be a good
- // time to implement http://code.google.com/p/chromium/issues/detail?id=2278
- // ? I think so!
+ // TODO(cmasone): enable the above for all OS_POSIX platforms once the
+ // first-run dialog text is all up to date.
NOTIMPLEMENTED();
return std::string();
#endif
}
+#if defined(OS_POSIX)
+// TODO(cmasone): Once we're comfortable this works, migrate Windows code to
+// use this as well.
+std::string MetricsService::RandomBytesToGUIDString(const uint64 bytes[2]) {
+ return StringPrintf("%08llX-%04llX-%04llX-%04llX-%012llX",
+ bytes[0] >> 32,
+ (bytes[0] >> 16) & 0x0000ffff,
+ bytes[0] & 0x0000ffff,
+ bytes[1] >> 48,
+ bytes[1] & 0x0000ffffffffffffULL);
+}
+#endif
//------------------------------------------------------------------------------
// State save methods
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/metrics_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698