Fix use-after-free in ExtensionHost::DidStopLoading.
[chromium-blink-merge.git] / chrome / common / chrome_version_info.h
blob4f3d3be4a2013861e0854724ef00e0c52bafb945
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_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
13 class FileVersionInfo;
15 namespace chrome {
17 // An instance of chrome::VersionInfo has information about the
18 // current running build of Chrome.
19 class VersionInfo {
20 public:
21 // The possible channels for an installation, from most fun to most stable.
22 enum Channel {
23 CHANNEL_UNKNOWN = 0, // Probably blue
24 CHANNEL_CANARY, // Yellow
25 CHANNEL_DEV, // Technicolor
26 CHANNEL_BETA, // Rainbow
27 CHANNEL_STABLE // Full-spectrum
30 VersionInfo();
31 ~VersionInfo();
33 // E.g. "Chrome/a.b.c.d"
34 std::string ProductNameAndVersionForUserAgent() const;
36 // E.g. "Chromium" or "Google Chrome".
37 std::string Name() const;
39 // Version number, e.g. "6.0.490.1".
40 std::string Version() const;
42 // The SVN revision of this release. E.g. "55800".
43 std::string LastChange() const;
45 // Whether this is an "official" release of the current Version():
46 // whether knowing Version() is enough to completely determine what
47 // LastChange() is.
48 bool IsOfficialBuild() const;
50 // OS type. E.g. "Windows", "Linux", "FreeBSD", ...
51 std::string OSType() const;
53 // Returns a human-readable modifier for the version string. For a branded
54 // build, this modifier is the channel ("canary", "dev", or "beta", but ""
55 // for stable). On Windows, this may be modified with additional information
56 // after a hyphen. For multi-user installations, it will return "canary-m",
57 // "dev-m", "beta-m", and for a stable channel multi-user installation, "m".
58 // In branded builds, when the channel cannot be determined, "unknown" will
59 // be returned. In unbranded builds, the modifier is usually an empty string
60 // (""), although on Linux, it may vary in certain distributions.
61 // GetVersionStringModifier() is intended to be used for display purposes.
62 // To simply test the channel, use GetChannel().
63 static std::string GetVersionStringModifier();
65 // Returns the channel for the installation. In branded builds, this will be
66 // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded
67 // builds, or in branded builds when the channel cannot be determined, this
68 // will be CHANNEL_UNKNOWN.
69 static Channel GetChannel();
71 #if defined(OS_CHROMEOS)
72 // Sets channel before use.
73 static void SetChannel(const std::string& channel);
74 #endif
76 // Returns a version string to be displayed in "About Chromium" dialog.
77 std::string CreateVersionString() const;
79 private:
80 #if defined(OS_WIN) || defined(OS_MACOSX)
81 scoped_ptr<FileVersionInfo> version_info_;
82 #endif
84 DISALLOW_COPY_AND_ASSIGN(VersionInfo);
87 } // namespace chrome
89 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_