OLD | NEW |
(Empty) | |
| 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 |
| 5 #include "components/version_info/version_info.h" |
| 6 |
| 7 #include "build/build_config.h" |
| 8 #include "components/version_info/version_info_values.h" |
| 9 #include "grit/components_strings.h" |
| 10 #include "ui/base/l10n/l10n_util.h" |
| 11 |
| 12 namespace version_info { |
| 13 |
| 14 std::string GetProductNameAndVersionForUserAgent() { |
| 15 return "Chrome/" + GetVersionNumber(); |
| 16 } |
| 17 |
| 18 std::string GetProductName() { |
| 19 return PRODUCT_NAME; |
| 20 } |
| 21 |
| 22 std::string GetVersionNumber() { |
| 23 return PRODUCT_VERSION; |
| 24 } |
| 25 |
| 26 std::string GetLastChange() { |
| 27 return LAST_CHANGE; |
| 28 } |
| 29 |
| 30 bool IsOfficialBuild() { |
| 31 return IS_OFFICIAL_BUILD; |
| 32 } |
| 33 |
| 34 std::string GetOSType() { |
| 35 #if defined(OS_WIN) |
| 36 return "Windows"; |
| 37 #elif defined(OS_IOS) |
| 38 return "iOS"; |
| 39 #elif defined(OS_MACOSX) |
| 40 return "Mac OS X"; |
| 41 #elif defined(OS_CHROMEOS) |
| 42 # if defined(GOOGLE_CHROME_BUILD) |
| 43 return "Chrome OS"; |
| 44 # else |
| 45 return "Chromium OS"; |
| 46 # endif |
| 47 #elif defined(OS_ANDROID) |
| 48 return "Android"; |
| 49 #elif defined(OS_LINUX) |
| 50 return "Linux"; |
| 51 #elif defined(OS_FREEBSD) |
| 52 return "FreeBSD"; |
| 53 #elif defined(OS_OPENBSD) |
| 54 return "OpenBSD"; |
| 55 #elif defined(OS_SOLARIS) |
| 56 return "Solaris"; |
| 57 #else |
| 58 return "Unknown"; |
| 59 #endif |
| 60 } |
| 61 |
| 62 std::string GetChannelString(Channel channel) { |
| 63 switch (channel) { |
| 64 case Channel::STABLE: |
| 65 return "stable"; |
| 66 break; |
| 67 case Channel::BETA: |
| 68 return "beta"; |
| 69 break; |
| 70 case Channel::DEV: |
| 71 return "dev"; |
| 72 break; |
| 73 case Channel::CANARY: |
| 74 return "canary"; |
| 75 break; |
| 76 case Channel::UNKNOWN: |
| 77 return "unknown"; |
| 78 break; |
| 79 } |
| 80 return std::string(); |
| 81 } |
| 82 |
| 83 std::string GetVersionStringWithModifier(const std::string& modifier) { |
| 84 std::string current_version; |
| 85 current_version += GetVersionNumber(); |
| 86 #if !defined(GOOGLE_CHROME_BUILD) |
| 87 current_version += " ("; |
| 88 current_version += l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL); |
| 89 current_version += " "; |
| 90 current_version += GetLastChange(); |
| 91 current_version += " "; |
| 92 current_version += GetOSType(); |
| 93 current_version += ")"; |
| 94 #endif |
| 95 if (!modifier.empty()) |
| 96 current_version += " " + modifier; |
| 97 return current_version; |
| 98 } |
| 99 |
| 100 } // namespace version_info |
OLD | NEW |