Commit 17eff5f8 authored by Doug Turner's avatar Doug Turner Committed by Commit Bot

[Weblayer] Use version_info instead of MainParams

This CL cleans up the use MainParams by removing duplicate
functionality provided by version_info. As noted in the
bug, this CL also will update the user agent string to be
consistent with the Chrome user agent.


Bug: 1018236
Change-Id: Iee35d1312861537013eeaeb047b75cd05d877851
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1909282
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714936}
parent c6ba6e18
...@@ -219,6 +219,7 @@ jumbo_static_library("weblayer_lib") { ...@@ -219,6 +219,7 @@ jumbo_static_library("weblayer_lib") {
"//components/security_interstitials/content:security_interstitial_page", "//components/security_interstitials/content:security_interstitial_page",
"//components/security_interstitials/content/renderer:security_interstitial_page_controller", "//components/security_interstitials/content/renderer:security_interstitial_page_controller",
"//components/security_interstitials/core", "//components/security_interstitials/core",
"//components/version_info",
"//components/web_cache/browser", "//components/web_cache/browser",
"//content:resources", "//content:resources",
"//content/app/resources", "//content/app/resources",
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "base/android/library_loader/library_loader_hooks.h" #include "base/android/library_loader/library_loader_hooks.h"
#include "base/logging.h" #include "base/logging.h"
#include "components/version_info/version_info.h"
#include "components/version_info/version_info_values.h" #include "components/version_info/version_info_values.h"
#include "content/public/app/content_jni_onload.h" #include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h" #include "content/public/app/content_main.h"
...@@ -21,11 +22,12 @@ class MainDelegateImpl : public MainDelegate { ...@@ -21,11 +22,12 @@ class MainDelegateImpl : public MainDelegate {
bool OnJNIOnLoadInit() { bool OnJNIOnLoadInit() {
if (!content::android::OnJNIOnLoadInit()) if (!content::android::OnJNIOnLoadInit())
return false; return false;
base::android::SetVersionNumber(version_info::GetVersionNumber().c_str());
weblayer::MainParams params; weblayer::MainParams params;
params.delegate = new weblayer::MainDelegateImpl; params.delegate = new weblayer::MainDelegateImpl;
params.brand = "WebLayer";
base::android::SetVersionNumber(PRODUCT_VERSION);
content::SetContentMainDelegate( content::SetContentMainDelegate(
new weblayer::ContentMainDelegateImpl(params)); new weblayer::ContentMainDelegateImpl(params));
return true; return true;
......
...@@ -4,6 +4,7 @@ include_rules = [ ...@@ -4,6 +4,7 @@ include_rules = [
"+components/embedder_support", "+components/embedder_support",
"+components/safe_browsing", "+components/safe_browsing",
"+components/security_interstitials", "+components/security_interstitials",
"+components/version_info",
"+components/web_cache/browser", "+components/web_cache/browser",
"+content/public", "+content/public",
"+mojo/public", "+mojo/public",
......
...@@ -14,10 +14,12 @@ ...@@ -14,10 +14,12 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "components/security_interstitials/content/ssl_cert_reporter.h" #include "components/security_interstitials/content/ssl_cert_reporter.h"
#include "components/security_interstitials/content/ssl_error_navigation_throttle.h" #include "components/security_interstitials/content/ssl_error_navigation_throttle.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/devtools_manager_delegate.h" #include "content/public/browser/devtools_manager_delegate.h"
#include "content/public/browser/navigation_throttle.h" #include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/network_service_instance.h" #include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h" #include "content/public/common/service_names.mojom.h"
#include "content/public/common/user_agent.h" #include "content/public/common/user_agent.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
...@@ -116,18 +118,24 @@ ContentBrowserClientImpl::GetServiceManifestOverlay(base::StringPiece name) { ...@@ -116,18 +118,24 @@ ContentBrowserClientImpl::GetServiceManifestOverlay(base::StringPiece name) {
} }
std::string ContentBrowserClientImpl::GetUserAgent() { std::string ContentBrowserClientImpl::GetUserAgent() {
std::string product = "Chrome/"; std::string product = version_info::GetProductNameAndVersionForUserAgent();
product += params_->full_version;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kUseMobileUserAgent))
product += " Mobile";
return content::BuildUserAgentFromProduct(product); return content::BuildUserAgentFromProduct(product);
} }
blink::UserAgentMetadata ContentBrowserClientImpl::GetUserAgentMetadata() { blink::UserAgentMetadata ContentBrowserClientImpl::GetUserAgentMetadata() {
blink::UserAgentMetadata metadata; blink::UserAgentMetadata metadata;
metadata.brand = params_->brand; metadata.brand = version_info::GetProductName();
metadata.full_version = params_->full_version; metadata.full_version = version_info::GetVersionNumber();
metadata.major_version = params_->major_version; metadata.major_version = version_info::GetMajorVersionNumber();
metadata.platform = content::BuildOSCpuInfo(false); metadata.platform = version_info::GetOSType();
metadata.architecture = ""; metadata.architecture = "";
metadata.model = ""; metadata.model = "";
......
...@@ -34,7 +34,7 @@ class CrashReporterClientImpl : public crash_reporter::CrashReporterClient { ...@@ -34,7 +34,7 @@ class CrashReporterClientImpl : public crash_reporter::CrashReporterClient {
void GetProductNameAndVersion(std::string* product_name, void GetProductNameAndVersion(std::string* product_name,
std::string* version, std::string* version,
std::string* channel) override { std::string* channel) override {
*version = PRODUCT_VERSION; *version = version_info::GetVersionNumber();
*product_name = "WebLayer"; *product_name = "WebLayer";
*channel = *channel =
version_info::GetChannelString(version_info::android::GetChannel()); version_info::GetChannelString(version_info::android::GetChannel());
......
...@@ -36,14 +36,6 @@ struct MainParams { ...@@ -36,14 +36,6 @@ struct MainParams {
// The name of the file that has the PAK data. // The name of the file that has the PAK data.
std::string pak_name; std::string pak_name;
std::string brand;
// e.g. 1.2.3.4
std::string full_version;
// e.g. 1
std::string major_version;
}; };
int Main(MainParams params int Main(MainParams params
......
...@@ -15,12 +15,6 @@ if (is_android) { ...@@ -15,12 +15,6 @@ if (is_android) {
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
} }
declare_args() {
weblayer_shell_product_name = "WebLayer Shell"
weblayer_shell_version = "99.77.34.5"
weblayer_shell_major_version = "99"
}
jumbo_static_library("weblayer_shell_lib") { jumbo_static_library("weblayer_shell_lib") {
testonly = true testonly = true
sources = [ sources = [
...@@ -40,11 +34,6 @@ jumbo_static_library("weblayer_shell_lib") { ...@@ -40,11 +34,6 @@ jumbo_static_library("weblayer_shell_lib") {
"//build/config/compiler:no_size_t_to_int_warning", "//build/config/compiler:no_size_t_to_int_warning",
] ]
defines = [
"WEBLAYER_SHELL_VERSION=\"$weblayer_shell_version\"",
"WEBLAYER_SHELL_MAJOR_VERSION=\"$weblayer_shell_major_version\"",
]
public_deps = [ public_deps = [
"//weblayer:weblayer_lib", "//weblayer:weblayer_lib",
] ]
......
...@@ -121,9 +121,6 @@ MainParams CreateMainParams() { ...@@ -121,9 +121,6 @@ MainParams CreateMainParams() {
params.pak_name = "weblayer.pak"; params.pak_name = "weblayer.pak";
params.brand = "weblayer_shell";
params.full_version = WEBLAYER_SHELL_VERSION;
params.major_version = WEBLAYER_SHELL_MAJOR_VERSION;
return params; return params;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment