Skip to content

Commit

Permalink
common: set Iridium version / User-Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
jengelh committed Dec 3, 2022
1 parent dd7df50 commit ebb8862
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
13 changes: 6 additions & 7 deletions components/version_info/version_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

namespace version_info {

const std::string& GetProductNameAndVersionForUserAgent() {
static const base::NoDestructor<std::string> product_and_version(
"Chrome/" + GetVersionNumber());
return *product_and_version;
const std::string &GetProductNameAndVersionForUserAgent() {
/* Disguise as chromium and screw google.com statistics */
static const std::string &s = "Chrome/108.0.5359.94";
return s;
}

const std::string GetProductNameAndVersionForReducedUserAgent(
const std::string& build_version) {
std::string product_and_version;
base::StrAppend(&product_and_version, {"Chrome/", GetMajorVersionNumber(),
".0.", build_version, ".0"});
base::StrAppend(&product_and_version, {"Chrome/108.0.0.0"});
return product_and_version;
}

Expand All @@ -37,7 +36,7 @@ std::string GetProductName() {
}

std::string GetVersionNumber() {
return PRODUCT_VERSION;
return "2022.12.108.0";
}

int GetMajorVersionNumberAsInt() {
Expand Down
2 changes: 1 addition & 1 deletion components/version_info/version_info_values.h.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define COMPONENTS_VERSION_INFO_VERSION_INFO_VALUES_H_

#define PRODUCT_NAME "@PRODUCT_FULLNAME@"
#define PRODUCT_VERSION "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
#define PRODUCT_VERSION "@MAJOR@.@MINOR@"
#define LAST_CHANGE "@LASTCHANGE@"
#define IS_OFFICIAL_BUILD @OFFICIAL_BUILD@

Expand Down
2 changes: 2 additions & 0 deletions content/common/user_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ std::string BuildUserAgentFromOSAndProduct(const std::string& os_info,
"Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) "
"%s Safari/537.36",
os_info.c_str(), product.c_str());
if (strncmp(product.c_str(), "Chrome/", 7) != 0)
base::StringAppendF(&user_agent, " Chrome/108.0.5359.94");
return user_agent;
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/shell/common/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef EXTENSIONS_SHELL_COMMON_VERSION_H_
#define EXTENSIONS_SHELL_COMMON_VERSION_H_

#define PRODUCT_VERSION "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
#define PRODUCT_VERSION "@MAJOR@.@MINOR@"
#define LAST_CHANGE "@LASTCHANGE@"

#endif // EXTENSIONS_SHELL_COMMON_VERSION_H_
2 changes: 1 addition & 1 deletion tools/metrics/histograms/extract_histograms.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
'Base histogram. Use suffixes of this histogram instead.')

EXPIRY_DATE_PATTERN = "%Y-%m-%d"
EXPIRY_MILESTONE_RE = re.compile(r'M[0-9]{2,3}\Z')
EXPIRY_MILESTONE_RE = re.compile(r'M[0-9]{2,4}\Z')


_ELEMENT_NODE = xml.dom.minidom.Node.ELEMENT_NODE
Expand Down
4 changes: 2 additions & 2 deletions tools/metrics/histograms/generate_expired_histograms_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import histogram_paths

_DATE_FILE_RE = re.compile(r".*MAJOR_BRANCH_DATE=(.+).*")
_CURRENT_MILESTONE_RE = re.compile(r"MAJOR=([0-9]{2,3})\n")
_MILESTONE_EXPIRY_RE = re.compile(r"\AM([0-9]{2,3})")
_CURRENT_MILESTONE_RE = re.compile(r"MAJOR=([0-9]{2,4})\n")
_MILESTONE_EXPIRY_RE = re.compile(r"\AM([0-9]{2,4})")

_SCRIPT_NAME = "generate_expired_histograms_array.py"
_HASH_DATATYPE = "uint32_t"
Expand Down

0 comments on commit ebb8862

Please sign in to comment.