version_info.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_VERSION_INFO_VERSION_INFO_H_
  5. #define COMPONENTS_VERSION_INFO_VERSION_INFO_H_
  6. #include <string>
  7. #include "components/version_info/channel.h"
  8. namespace base {
  9. class Version;
  10. }
  11. namespace version_info {
  12. // Returns the product name and version information for the User-Agent header,
  13. // in the format: Chrome/<major_version>.<minor_version>.<build>.<patch>.
  14. const std::string& GetProductNameAndVersionForUserAgent();
  15. // Returns the product name and reduced version information for the User-Agent
  16. // header, in the format: Chrome/<major_version>.0.build_version.0, where
  17. // `build_version` is a frozen BUILD number.
  18. const std::string GetProductNameAndVersionForReducedUserAgent(
  19. const std::string& build_version);
  20. // Returns the product name, e.g. "Chromium" or "Google Chrome".
  21. std::string GetProductName();
  22. // Returns the version number, e.g. "6.0.490.1".
  23. std::string GetVersionNumber();
  24. // Returns the major component (aka the milestone) of the version as an int,
  25. // e.g. 6 when the version is "6.0.490.1".
  26. int GetMajorVersionNumberAsInt();
  27. // Like GetMajorVersionNumberAsInt(), but returns a string.
  28. std::string GetMajorVersionNumber();
  29. // Returns the result of GetVersionNumber() as a base::Version.
  30. const base::Version& GetVersion();
  31. // Returns a version control specific identifier of this release.
  32. std::string GetLastChange();
  33. // Returns whether this is an "official" release of the current version, i.e.
  34. // whether knowing GetVersionNumber() is enough to completely determine what
  35. // GetLastChange() is.
  36. bool IsOfficialBuild();
  37. // Returns the OS type, e.g. "Windows", "Linux", "FreeBSD", ...
  38. std::string GetOSType();
  39. // Returns a string equivalent of |channel|, independent of whether the build
  40. // is branded or not and without any additional modifiers.
  41. std::string GetChannelString(Channel channel);
  42. // Returns a list of sanitizers enabled in this build.
  43. std::string GetSanitizerList();
  44. } // namespace version_info
  45. #endif // COMPONENTS_VERSION_INFO_VERSION_INFO_H_