OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/common/chrome_version_info.h" | 5 #include "chrome/common/chrome_version_info.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 | 16 |
17 namespace chrome { | 17 namespace chrome { |
18 | 18 |
| 19 std::string VersionInfo::ProductNameAndVersionForUserAgent() const { |
| 20 if (!is_valid()) |
| 21 return std::string(); |
| 22 return "Chrome/" + Version(); |
| 23 } |
| 24 |
19 #if defined(OS_WIN) || defined(OS_MACOSX) | 25 #if defined(OS_WIN) || defined(OS_MACOSX) |
20 // On Windows and Mac, we get the Chrome version info by querying | 26 // On Windows and Mac, we get the Chrome version info by querying |
21 // FileVersionInfo for the current module. | 27 // FileVersionInfo for the current module. |
22 | 28 |
23 VersionInfo::VersionInfo() { | 29 VersionInfo::VersionInfo() { |
24 // The current module is already loaded in memory, so this will be cheap. | 30 // The current module is already loaded in memory, so this will be cheap. |
25 base::ThreadRestrictions::ScopedAllowIO allow_io; | 31 base::ThreadRestrictions::ScopedAllowIO allow_io; |
26 version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 32 version_info_.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
27 } | 33 } |
28 | 34 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #elif defined(OS_OPENBSD) | 137 #elif defined(OS_OPENBSD) |
132 return "OpenBSD"; | 138 return "OpenBSD"; |
133 #elif defined(OS_SOLARIS) | 139 #elif defined(OS_SOLARIS) |
134 return "Solaris"; | 140 return "Solaris"; |
135 #else | 141 #else |
136 return "Unknown"; | 142 return "Unknown"; |
137 #endif | 143 #endif |
138 } | 144 } |
139 | 145 |
140 } // namespace chrome | 146 } // namespace chrome |
OLD | NEW |