media: Specify WebRTC owners in media OWNERS file.
[chromium-blink-merge.git] / chrome / common / chrome_version_info.cc
blob4562bfd2a79b7485410bf25aed65b8a26e336efe
1 // Copyright (c) 2012 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 #include "chrome/common/chrome_version_info.h"
7 #include "base/basictypes.h"
8 #include "base/file_version_info.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_restrictions.h"
11 #include "build/build_config.h"
12 #include "chrome/common/chrome_version_info_values.h"
13 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
17 namespace chrome {
19 std::string VersionInfo::ProductNameAndVersionForUserAgent() const {
20 return "Chrome/" + Version();
23 VersionInfo::VersionInfo() {
26 VersionInfo::~VersionInfo() {
29 std::string VersionInfo::Name() const {
30 return PRODUCT_NAME;
33 std::string VersionInfo::Version() const {
34 return PRODUCT_VERSION;
37 std::string VersionInfo::LastChange() const {
38 return LAST_CHANGE;
41 bool VersionInfo::IsOfficialBuild() const {
42 return IS_OFFICIAL_BUILD;
45 std::string VersionInfo::CreateVersionString() const {
46 std::string current_version;
47 current_version += Version();
48 #if !defined(GOOGLE_CHROME_BUILD)
49 current_version += " (";
50 current_version += l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_UNOFFICIAL);
51 current_version += " ";
52 current_version += LastChange();
53 current_version += " ";
54 current_version += OSType();
55 current_version += ")";
56 #endif
57 std::string modifier = GetVersionStringModifier();
58 if (!modifier.empty())
59 current_version += " " + modifier;
60 return current_version;
63 std::string VersionInfo::OSType() const {
64 #if defined(OS_WIN)
65 return "Windows";
66 #elif defined(OS_IOS)
67 return "iOS";
68 #elif defined(OS_MACOSX)
69 return "Mac OS X";
70 #elif defined(OS_CHROMEOS)
71 #if defined(GOOGLE_CHROME_BUILD)
72 return "Chrome OS";
73 #else
74 return "Chromium OS";
75 #endif
76 #elif defined(OS_ANDROID)
77 return "Android";
78 #elif defined(OS_LINUX)
79 return "Linux";
80 #elif defined(OS_FREEBSD)
81 return "FreeBSD";
82 #elif defined(OS_OPENBSD)
83 return "OpenBSD";
84 #elif defined(OS_SOLARIS)
85 return "Solaris";
86 #else
87 return "Unknown";
88 #endif
91 } // namespace chrome