summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics/metrics_service.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 20:54:13 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-08 20:54:13 +0000
commit06aaac23ed35f7f34ab523172fc31322a88f1e38 (patch)
tree65ac6bd34e39cb5dbbdb800ba611e7e254ce4dae /chrome/browser/metrics/metrics_service.h
parent837be4ad6a8e740fe45e19e2d1699d21f83f7ea4 (diff)
downloadchromium_src-06aaac23ed35f7f34ab523172fc31322a88f1e38.zip
chromium_src-06aaac23ed35f7f34ab523172fc31322a88f1e38.tar.gz
chromium_src-06aaac23ed35f7f34ab523172fc31322a88f1e38.tar.bz2
http://codereview.chromium.org/147084
Implements unique client ID generation for Posix. Client ID generation happens once-per-install of Chromium (...well, this is mostly true, at least). On Windows, the code currently uses some system library code that generates a GUID. We don't ACTUALLY need a GUID, something that's quite random and in the same format will work. Since we don't want to add a dependency on libuuid for POSIX, I created a less-random-but-still-good-enough version. BUG=15418 TEST=none Review URL: http://codereview.chromium.org/149343 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics/metrics_service.h')
-rw-r--r--chrome/browser/metrics/metrics_service.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index a955da1..e173915 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -22,6 +22,7 @@
#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
#include "webkit/glue/webplugin.h"
+#include "testing/gtest/include/gtest/gtest_prod.h"
class BookmarkModel;
class BookmarkNode;
@@ -160,6 +161,12 @@ class MetricsService : public NotificationObserver,
// Generates a new client ID to use to identify self to metrics server.
static std::string GenerateClientID();
+#if defined(OS_POSIX)
+ // Generates a new client ID to use to identify self to metrics server,
+ // given 128 bits of randomness.
+ static std::string RandomBytesToGUIDString(const uint64 bytes[2]);
+#endif
+
// Schedule the next save of LocalState information. This is called
// automatically by the task that performs each save to schedule the next one.
void ScheduleNextStateSave();
@@ -475,6 +482,9 @@ class MetricsService : public NotificationObserver,
// Indicate that a timer for sending the next log has already been queued.
bool timer_pending_;
+ FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesAllZeroes);
+ FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesCorrectly);
+ FRIEND_TEST(MetricsServiceTest, ClientIdCorrectlyFormatted);
DISALLOW_COPY_AND_ASSIGN(MetricsService);
};