1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/chromium/base/guid.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef BASE_GUID_H_ 1.9 +#define BASE_GUID_H_ 1.10 + 1.11 +#include <string> 1.12 + 1.13 +#include "base/base_export.h" 1.14 +#include "base/basictypes.h" 1.15 +#include "build/build_config.h" 1.16 + 1.17 +namespace base { 1.18 + 1.19 +// Generate a 128-bit random GUID of the form: "%08X-%04X-%04X-%04X-%012llX". 1.20 +// If GUID generation fails an empty string is returned. 1.21 +// The POSIX implementation uses psuedo random number generation to create 1.22 +// the GUID. The Windows implementation uses system services. 1.23 +BASE_EXPORT std::string GenerateGUID(); 1.24 + 1.25 +// Returns true if the input string conforms to the GUID format. 1.26 +BASE_EXPORT bool IsValidGUID(const std::string& guid); 1.27 + 1.28 +#if defined(OS_POSIX) 1.29 +// For unit testing purposes only. Do not use outside of tests. 1.30 +BASE_EXPORT std::string RandomDataToGUIDString(const uint64 bytes[2]); 1.31 +#endif 1.32 + 1.33 +} // namespace guid 1.34 + 1.35 +#endif // BASE_GUID_H_