| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_CHROME_VERSION_INFO_H_ | 5 #ifndef CHROME_COMMON_CHROME_VERSION_INFO_H_ |
| 6 #define CHROME_COMMON_CHROME_VERSION_INFO_H_ | 6 #define CHROME_COMMON_CHROME_VERSION_INFO_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 class FileVersionInfo; | 14 class FileVersionInfo; |
| 15 | 15 |
| 16 namespace chrome { | 16 namespace chrome { |
| 17 | 17 |
| 18 // An instance of chrome::VersionInfo has information about the | 18 // An instance of chrome::VersionInfo has information about the |
| 19 // current running build of Chrome. | 19 // current running build of Chrome. |
| 20 class VersionInfo { | 20 class VersionInfo { |
| 21 public: | 21 public: |
| 22 // The possible channels for an installation, from most fun to most stable. |
| 23 enum Channel { |
| 24 CHANNEL_UNKNOWN = 0, // Probably blue |
| 25 CHANNEL_CANARY, // Yellow |
| 26 CHANNEL_DEV, // Technicolor |
| 27 CHANNEL_BETA, // Rainbow |
| 28 CHANNEL_STABLE // Full-spectrum |
| 29 }; |
| 30 |
| 22 VersionInfo(); | 31 VersionInfo(); |
| 23 ~VersionInfo(); | 32 ~VersionInfo(); |
| 24 | 33 |
| 25 // In the rare case where we fail to get the version info, | 34 // In the rare case where we fail to get the version info, |
| 26 // is_valid() will return false. The other functions will return | 35 // is_valid() will return false. The other functions will return |
| 27 // the empty string in this case, so it's not harmful if you don't | 36 // the empty string in this case, so it's not harmful if you don't |
| 28 // check is_valid(). | 37 // check is_valid(). |
| 29 bool is_valid() const; | 38 bool is_valid() const; |
| 30 | 39 |
| 31 // E.g. "Chromium" or "Google Chrome". | 40 // E.g. "Chromium" or "Google Chrome". |
| 32 std::string Name() const; | 41 std::string Name() const; |
| 33 | 42 |
| 34 // Version number, e.g. "6.0.490.1". | 43 // Version number, e.g. "6.0.490.1". |
| 35 std::string Version() const; | 44 std::string Version() const; |
| 36 | 45 |
| 37 // The SVN revision of this release. E.g. "55800". | 46 // The SVN revision of this release. E.g. "55800". |
| 38 std::string LastChange() const; | 47 std::string LastChange() const; |
| 39 | 48 |
| 40 // OS type. E.g. "Windows", "Linux", "FreeBSD", ... | |
| 41 std::string OSType() const; | |
| 42 | |
| 43 // Whether this is an "official" release of the current Version(): | 49 // Whether this is an "official" release of the current Version(): |
| 44 // whether knowing Version() is enough to completely determine what | 50 // whether knowing Version() is enough to completely determine what |
| 45 // LastChange() is. | 51 // LastChange() is. |
| 46 bool IsOfficialBuild() const; | 52 bool IsOfficialBuild() const; |
| 47 | 53 |
| 54 // OS type. E.g. "Windows", "Linux", "FreeBSD", ... |
| 55 std::string OSType() const; |
| 56 |
| 57 // Returns a human-readable modifier for the version string. For a branded |
| 58 // build, this modifier is the channel ("canary", "dev", or "beta", but "" |
| 59 // for stable). On Windows, this may be modified with additional information |
| 60 // after a hyphen. For multi-user installations, it will return "canary-m", |
| 61 // "dev-m", "beta-m", and for a stable channel multi-user installation, "m". |
| 62 // In branded builds, when the channel cannot be determined, "unknown" will |
| 63 // be returned. In unbranded builds, the modifier is usually an empty string |
| 64 // (""), although on Linux, it may vary in certain distributions. |
| 65 // GetVersionStringModifier() is intended to be used for display purposes. |
| 66 // To simply test the channel, use GetChannel(). |
| 67 static std::string GetVersionStringModifier(); |
| 68 |
| 69 // Returns the channel for the installation. In branded builds, this will be |
| 70 // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded |
| 71 // builds, or in branded builds when the channel cannot be determined, this |
| 72 // will be CHANNEL_UNKNOWN. |
| 73 static Channel GetChannel(); |
| 74 |
| 48 private: | 75 private: |
| 49 #if defined(OS_WIN) || defined(OS_MACOSX) | 76 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 50 scoped_ptr<FileVersionInfo> version_info_; | 77 scoped_ptr<FileVersionInfo> version_info_; |
| 51 #endif | 78 #endif |
| 52 | 79 |
| 53 DISALLOW_COPY_AND_ASSIGN(VersionInfo); | 80 DISALLOW_COPY_AND_ASSIGN(VersionInfo); |
| 54 }; | 81 }; |
| 55 | 82 |
| 56 } // namespace chrome | 83 } // namespace chrome |
| 57 | 84 |
| 58 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_ | 85 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_ |
| OLD | NEW |