Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef BASE_GUID_H_ |
michael@0 | 6 | #define BASE_GUID_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include <string> |
michael@0 | 9 | |
michael@0 | 10 | #include "base/base_export.h" |
michael@0 | 11 | #include "base/basictypes.h" |
michael@0 | 12 | #include "build/build_config.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace base { |
michael@0 | 15 | |
michael@0 | 16 | // Generate a 128-bit random GUID of the form: "%08X-%04X-%04X-%04X-%012llX". |
michael@0 | 17 | // If GUID generation fails an empty string is returned. |
michael@0 | 18 | // The POSIX implementation uses psuedo random number generation to create |
michael@0 | 19 | // the GUID. The Windows implementation uses system services. |
michael@0 | 20 | BASE_EXPORT std::string GenerateGUID(); |
michael@0 | 21 | |
michael@0 | 22 | // Returns true if the input string conforms to the GUID format. |
michael@0 | 23 | BASE_EXPORT bool IsValidGUID(const std::string& guid); |
michael@0 | 24 | |
michael@0 | 25 | #if defined(OS_POSIX) |
michael@0 | 26 | // For unit testing purposes only. Do not use outside of tests. |
michael@0 | 27 | BASE_EXPORT std::string RandomDataToGUIDString(const uint64 bytes[2]); |
michael@0 | 28 | #endif |
michael@0 | 29 | |
michael@0 | 30 | } // namespace guid |
michael@0 | 31 | |
michael@0 | 32 | #endif // BASE_GUID_H_ |