diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 2119437b3..1306955d9 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -229,24 +229,24 @@ void CefContentClient::AddAdditionalSchemes(Schemes* schemes) { scheme_info_list_locked_ = true; } -std::string CefContentClient::GetUserAgent() const { - std::string product_version; +std::string CefContentClient::GetProduct() const { + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kProductVersion)) + return command_line->GetSwitchValueASCII(switches::kProductVersion); + return base::StringPrintf("Chrome/%d.%d.%d.%d", CHROME_VERSION_MAJOR, + CHROME_VERSION_MINOR, CHROME_VERSION_BUILD, + CHROME_VERSION_PATCH); +} + +std::string CefContentClient::GetUserAgent() const { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kUserAgent)) return command_line->GetSwitchValueASCII(switches::kUserAgent); - if (command_line->HasSwitch(switches::kProductVersion)) { - product_version = - command_line->GetSwitchValueASCII(switches::kProductVersion); - } else { - product_version = base::StringPrintf( - "Chrome/%d.%d.%d.%d", CHROME_VERSION_MAJOR, CHROME_VERSION_MINOR, - CHROME_VERSION_BUILD, CHROME_VERSION_PATCH); - } - - return content::BuildUserAgentFromProduct(product_version); + return content::BuildUserAgentFromProduct(GetProduct()); } base::string16 CefContentClient::GetLocalizedString(int message_id) const { diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index 2deaa32f4..f155dcc77 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -34,6 +34,7 @@ class CefContentClient : public content::ContentClient, void AddPepperPlugins( std::vector* plugins) override; void AddAdditionalSchemes(Schemes* schemes) override; + std::string GetProduct() const override; std::string GetUserAgent() const override; base::string16 GetLocalizedString(int message_id) const override; base::StringPiece GetDataResource(