Commit 3f390134 authored by David Black's avatar David Black Committed by Commit Bot

Cleans up Assistant user agent config.

User agent is now set via internal config, not InternalOptions. This
CL cleans up the deprecated InternalOptions code path.

During the transition, ARC was also accidentally omitted from the new
user agent config so this CL restores that.

Bug: b:138583234
Change-Id: Ifa4f94f9b3a5b76f4f737fa83ff70dc870d2e5e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725100Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#682340}
parent bebb5c66
......@@ -14,12 +14,9 @@
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/task/post_task.h"
#include "base/unguessable_token.h"
#include "build/util/webkit_version.h"
#include "chromeos/assistant/internal/internal_constants.h"
#include "chromeos/assistant/internal/internal_util.h"
#include "chromeos/assistant/internal/proto/google3/assistant/api/client_input/warmer_welcome_input.pb.h"
......@@ -1159,24 +1156,10 @@ void AssistantManagerServiceImpl::OnAndroidAppListRefreshed(
void AssistantManagerServiceImpl::UpdateInternalOptions(
assistant_client::AssistantManagerInternal* assistant_manager_internal) {
// Build user agent string.
std::string user_agent;
base::StringAppendF(&user_agent,
"Mozilla/5.0 (X11; CrOS %s %s; %s) "
"AppleWebKit/%d.%d (KHTML, like Gecko)",
base::SysInfo::OperatingSystemArchitecture().c_str(),
base::SysInfo::OperatingSystemVersion().c_str(),
base::SysInfo::GetLsbReleaseBoard().c_str(),
WEBKIT_VERSION_MAJOR, WEBKIT_VERSION_MINOR);
std::string arc_version = chromeos::version_loader::GetARCVersion();
if (!arc_version.empty())
base::StringAppendF(&user_agent, " ARC/%s", arc_version.c_str());
// Build internal options
auto* internal_options =
assistant_manager_internal->CreateDefaultInternalOptions();
SetAssistantOptions(internal_options, user_agent,
SetAssistantOptions(internal_options,
service_->assistant_state()->locale().value(),
spoken_feedback_enabled_);
......
......@@ -34,6 +34,10 @@ void CreateUserAgent(std::string* user_agent) {
base::SysInfo::OperatingSystemVersion().c_str(),
base::SysInfo::GetLsbReleaseBoard().c_str(),
WEBKIT_VERSION_MAJOR, WEBKIT_VERSION_MINOR);
std::string arc_version = chromeos::version_loader::GetARCVersion();
if (!arc_version.empty())
base::StringAppendF(user_agent, " ARC/%s", arc_version.c_str());
}
} // namespace
......
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