chrome: Support configuration of user agent and locale (see issue #2969)

This change adds support for CefSettings and command-line configuration of
user_agent, user_agent_product (formerly product_version) and locale.
This commit is contained in:
Marshall Greenblatt
2021-04-27 12:39:09 -04:00
parent 328de502ac
commit c03a6f4386
10 changed files with 53 additions and 18 deletions

View File

@@ -695,9 +695,9 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLocalesDirPath,
switches::kLogFile,
switches::kLogSeverity,
switches::kProductVersion,
switches::kResourcesDirPath,
embedder_support::kUserAgent,
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));

View File

@@ -91,6 +91,16 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
const base::CommandLine* browser_cmd = base::CommandLine::ForCurrentProcess();
{
// Propagate the following switches to all command lines (along with any
// associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
base::size(kSwitchNames));
}
const std::string& process_type =
command_line->GetSwitchValueASCII(switches::kProcessType);
if (process_type == switches::kRendererProcess) {