1 // Copyright (c) 2011 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.
5 #ifndef CHROME_COMMON_CHROME_VERSION_INFO_H_
6 #define CHROME_COMMON_CHROME_VERSION_INFO_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
13 class FileVersionInfo
;
17 // An instance of chrome::VersionInfo has information about the
18 // current running build of Chrome.
21 // The possible channels for an installation, from most fun to most stable.
23 CHANNEL_UNKNOWN
= 0, // Probably blue
24 CHANNEL_CANARY
, // Yellow
25 CHANNEL_DEV
, // Technicolor
26 CHANNEL_BETA
, // Rainbow
27 CHANNEL_STABLE
// Full-spectrum
33 // In the rare case where we fail to get the version info,
34 // is_valid() will return false. The other functions will return
35 // the empty string in this case, so it's not harmful if you don't
37 bool is_valid() const;
39 // E.g. "Chrome/a.b.c.d"
40 std::string
ProductNameAndVersionForUserAgent() const;
42 // E.g. "Chromium" or "Google Chrome".
43 std::string
Name() const;
45 // Version number, e.g. "6.0.490.1".
46 std::string
Version() const;
48 // The SVN revision of this release. E.g. "55800".
49 std::string
LastChange() const;
51 // Whether this is an "official" release of the current Version():
52 // whether knowing Version() is enough to completely determine what
54 bool IsOfficialBuild() const;
56 // OS type. E.g. "Windows", "Linux", "FreeBSD", ...
57 std::string
OSType() const;
59 // Returns a human-readable modifier for the version string. For a branded
60 // build, this modifier is the channel ("canary", "dev", or "beta", but ""
61 // for stable). On Windows, this may be modified with additional information
62 // after a hyphen. For multi-user installations, it will return "canary-m",
63 // "dev-m", "beta-m", and for a stable channel multi-user installation, "m".
64 // In branded builds, when the channel cannot be determined, "unknown" will
65 // be returned. In unbranded builds, the modifier is usually an empty string
66 // (""), although on Linux, it may vary in certain distributions.
67 // GetVersionStringModifier() is intended to be used for display purposes.
68 // To simply test the channel, use GetChannel().
69 static std::string
GetVersionStringModifier();
71 // Returns the channel for the installation. In branded builds, this will be
72 // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded
73 // builds, or in branded builds when the channel cannot be determined, this
74 // will be CHANNEL_UNKNOWN.
75 static Channel
GetChannel();
77 #if defined(OS_CHROMEOS)
78 // Sets channel before use.
79 static void SetChannel(const std::string
& channel
);
82 // Returns a version string to be displayed in "About Chromium" dialog.
83 std::string
CreateVersionString() const;
86 #if defined(OS_WIN) || defined(OS_MACOSX)
87 scoped_ptr
<FileVersionInfo
> version_info_
;
90 DISALLOW_COPY_AND_ASSIGN(VersionInfo
);
95 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_