mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-04 19:26:09 +03:00
37 lines
958 B
C++
37 lines
958 B
C++
|
// Copyright 2015 The Chromium Authors
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
#include "base/version_info/version_info.h"
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
#include "base/no_destructor.h"
|
||
|
#include "base/strings/strcat.h"
|
||
|
#include "base/strings/string_number_conversions.h"
|
||
|
#include "base/version.h"
|
||
|
|
||
|
namespace version_info {
|
||
|
|
||
|
const std::string GetProductNameAndVersionForReducedUserAgent(
|
||
|
const std::string& build_version) {
|
||
|
return base::StrCat(
|
||
|
{"Chrome/", GetMajorVersionNumber(), ".0.", build_version, ".0"});
|
||
|
}
|
||
|
|
||
|
int GetMajorVersionNumberAsInt() {
|
||
|
DCHECK(GetVersion().IsValid());
|
||
|
return GetVersion().components()[0];
|
||
|
}
|
||
|
|
||
|
std::string GetMajorVersionNumber() {
|
||
|
return base::NumberToString(GetMajorVersionNumberAsInt());
|
||
|
}
|
||
|
|
||
|
const base::Version& GetVersion() {
|
||
|
static const base::NoDestructor<base::Version> version(GetVersionNumber());
|
||
|
return *version;
|
||
|
}
|
||
|
|
||
|
} // namespace version_info
|