Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: chrome/common/chrome_version_info.h

Issue 1257633002: Componentize VersionInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments by brettw Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "components/version_info/version_info.h"
11 11
12 namespace chrome { 12 namespace chrome {
13 13
14 // An instance of chrome::VersionInfo has information about the 14 // An instance of chrome::VersionInfo has information about the
15 // current running build of Chrome. 15 // current running build of Chrome.
16 // TODO(sdefresne): this class should be removed in favor of calling directly
17 // version_info free functions and this file should just provide method to
18 // compute version string modifier (system dependent) and channel (embedder
19 // dependent). Tracked by http://crbug.com/514562.
16 class VersionInfo { 20 class VersionInfo {
17 public: 21 public:
18 // The possible channels for an installation, from most fun to most stable.
19 enum Channel {
20 CHANNEL_UNKNOWN = 0, // Probably blue
21 CHANNEL_CANARY, // Yellow
22 CHANNEL_DEV, // Technicolor
23 CHANNEL_BETA, // Rainbow
24 CHANNEL_STABLE // Full-spectrum
25 };
26
27 VersionInfo(); 22 VersionInfo();
28 ~VersionInfo(); 23 ~VersionInfo();
29 24
30 // E.g. "Chrome/a.b.c.d" 25 // E.g. "Chrome/a.b.c.d"
31 std::string ProductNameAndVersionForUserAgent() const; 26 static std::string ProductNameAndVersionForUserAgent();
32 27
33 // E.g. "Chromium" or "Google Chrome". 28 // E.g. "Chromium" or "Google Chrome".
34 std::string Name() const; 29 static std::string Name();
35 30
36 // Version number, e.g. "6.0.490.1". 31 // Version number, e.g. "6.0.490.1".
37 std::string Version() const; 32 static std::string Version();
38 33
39 // The SVN revision of this release. E.g. "55800". 34 // The SVN revision of this release. E.g. "55800".
40 std::string LastChange() const; 35 static std::string LastChange();
41 36
42 // Whether this is an "official" release of the current Version(): 37 // Whether this is an "official" release of the current Version():
43 // whether knowing Version() is enough to completely determine what 38 // whether knowing Version() is enough to completely determine what
44 // LastChange() is. 39 // LastChange() is.
45 bool IsOfficialBuild() const; 40 static bool IsOfficialBuild();
46 41
47 // OS type. E.g. "Windows", "Linux", "FreeBSD", ... 42 // OS type. E.g. "Windows", "Linux", "FreeBSD", ...
48 std::string OSType() const; 43 static std::string OSType();
49 44
50 // Returns a human-readable modifier for the version string. For a branded 45 // Returns a human-readable modifier for the version string. For a branded
51 // build, this modifier is the channel ("canary", "dev", or "beta", but "" 46 // build, this modifier is the channel ("canary", "dev", or "beta", but ""
52 // for stable). On Windows, this may be modified with additional information 47 // for stable). On Windows, this may be modified with additional information
53 // after a hyphen. For multi-user installations, it will return "canary-m", 48 // after a hyphen. For multi-user installations, it will return "canary-m",
54 // "dev-m", "beta-m", and for a stable channel multi-user installation, "m". 49 // "dev-m", "beta-m", and for a stable channel multi-user installation, "m".
55 // In branded builds, when the channel cannot be determined, "unknown" will 50 // In branded builds, when the channel cannot be determined, "unknown" will
56 // be returned. In unbranded builds, the modifier is usually an empty string 51 // be returned. In unbranded builds, the modifier is usually an empty string
57 // (""), although on Linux, it may vary in certain distributions. 52 // (""), although on Linux, it may vary in certain distributions.
58 // GetVersionStringModifier() is intended to be used for display purposes. 53 // GetVersionStringModifier() is intended to be used for display purposes.
59 // To simply test the channel, use GetChannel(). 54 // To simply test the channel, use GetChannel().
60 static std::string GetVersionStringModifier(); 55 static std::string GetVersionStringModifier();
61 56
62 // Returns the channel for the installation. In branded builds, this will be 57 // Returns the channel for the installation. In branded builds, this will be
63 // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded 58 // CHANNEL_STABLE, CHANNEL_BETA, CHANNEL_DEV, or CHANNEL_CANARY. In unbranded
64 // builds, or in branded builds when the channel cannot be determined, this 59 // builds, or in branded builds when the channel cannot be determined, this
65 // will be CHANNEL_UNKNOWN. 60 // will be CHANNEL_UNKNOWN.
66 static Channel GetChannel(); 61 static version_info::Channel GetChannel();
67 62
68 // Returns a string equivalent of the channel, independent of whether it is a 63 // Returns a string equivalent of the channel, independent of whether it is a
69 // branded build or not and without any additional modifiers. 64 // branded build or not and without any additional modifiers.
70 static std::string GetChannelString(); 65 static std::string GetChannelString();
71 66
72 #if defined(OS_CHROMEOS) 67 #if defined(OS_CHROMEOS)
73 // Sets channel before use. 68 // Sets channel before use.
74 static void SetChannel(const std::string& channel); 69 static void SetChannel(const std::string& channel);
75 #endif 70 #endif
76 71
77 // Returns a version string to be displayed in "About Chromium" dialog. 72 // Returns a version string to be displayed in "About Chromium" dialog.
78 std::string CreateVersionString() const; 73 static std::string CreateVersionString();
79 74
80 private: 75 private:
81 DISALLOW_COPY_AND_ASSIGN(VersionInfo); 76 DISALLOW_COPY_AND_ASSIGN(VersionInfo);
82 }; 77 };
83 78
84 } // namespace chrome 79 } // namespace chrome
85 80
86 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_ 81 #endif // CHROME_COMMON_CHROME_VERSION_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698