summaryrefslogtreecommitdiffstats
path: root/chrome/browser/guid.h
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 20:34:59 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-14 20:34:59 +0000
commit3469e7e544aeea3a5cee8aee9a8891a29c61a17d (patch)
tree4d9d1056f06f90f724ba702e94aa2b4d47da7fa6 /chrome/browser/guid.h
parent94e9666e60bf1d5e3559bfe216845a2cb054b204 (diff)
downloadchromium_src-3469e7e544aeea3a5cee8aee9a8891a29c61a17d.zip
chromium_src-3469e7e544aeea3a5cee8aee9a8891a29c61a17d.tar.gz
chromium_src-3469e7e544aeea3a5cee8aee9a8891a29c61a17d.tar.bz2
Moving GUID generation from base to chrome/browser/guid*
Moves GUID generation into chrome/browser/guid*. GUID generation is used only within chrome/browser. So am moving it there. BUG=58813 TEST=GUIDTest.GUIDGeneratesAllZeroes, GUIDTest.GUIDGeneratesCorrectly, GUIDTest.GUIDCorrectlyFormatted, MetricsServiceTest.ClientIdCorrectlyFormatted Review URL: http://codereview.chromium.org/3800003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/guid.h')
-rw-r--r--chrome/browser/guid.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/guid.h b/chrome/browser/guid.h
new file mode 100644
index 0000000..bc47ed8
--- /dev/null
+++ b/chrome/browser/guid.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_GUID_H_
+#define CHROME_BROWSER_GUID_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "build/build_config.h"
+
+namespace guid {
+
+// Generate a 128-bit random GUID of the form: "%08X-%04X-%04X-%04X-%012llX".
+// If GUID generation fails an empty string is returned.
+// The POSIX implementation uses psuedo random number generation to create
+// the GUID. The Windows implementation uses system services.
+std::string GenerateGUID();
+
+#if defined(OS_POSIX)
+// For unit testing purposes only. Do not use outside of tests.
+std::string RandomDataToGUIDString(const uint64 bytes[2]);
+#endif
+
+} // namespace guid
+
+#endif // CHROME_BROWSER_GUID_H_