Commit d01d02ea authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Introduces a new command line parameter to set the server url.

The new parameter is 'autofill-assistant-url'. This allows us to remove the dependency on finch trials to be able to override the server url from the command line (see related CL cr/235482708).

Bug: 806868
Change-Id: I25c75201c92d02540b5fa44e75a07d90a990fbb3
Reviewed-on: https://chromium-review.googlesource.com/c/1494656Reviewed-by: default avatarStephane Zermatten <szermatt@chromium.org>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#636742}
parent bbd1a866
...@@ -43,13 +43,13 @@ using base::android::JavaRef; ...@@ -43,13 +43,13 @@ using base::android::JavaRef;
namespace autofill_assistant { namespace autofill_assistant {
namespace switches { namespace switches {
const char* const kAutofillAssistantServerKey = "autofill-assistant-key"; const char* const kAutofillAssistantServerKey = "autofill-assistant-key";
const char* const kAutofillAssistantUrl = "autofill-assistant-url";
} // namespace switches } // namespace switches
namespace { namespace {
const base::FeatureParam<std::string> kAutofillAssistantServerUrl{ const char* const kDefaultAutofillAssistantServerUrl =
&autofill_assistant::features::kAutofillAssistant, "url", "https://automate-pa.googleapis.com";
"https://automate-pa.googleapis.com"};
// Fills a map from two Java arrays of strings of the same length. // Fills a map from two Java arrays of strings of the same length.
void FillParametersFromJava(JNIEnv* env, void FillParametersFromJava(JNIEnv* env,
...@@ -83,7 +83,13 @@ ClientAndroid::ClientAndroid(content::WebContents* web_contents) ...@@ -83,7 +83,13 @@ ClientAndroid::ClientAndroid(content::WebContents* web_contents)
java_object_(Java_AutofillAssistantClient_create( java_object_(Java_AutofillAssistantClient_create(
AttachCurrentThread(), AttachCurrentThread(),
reinterpret_cast<intptr_t>(this))), reinterpret_cast<intptr_t>(this))),
weak_ptr_factory_(this) {} weak_ptr_factory_(this) {
server_url_ = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kAutofillAssistantUrl);
if (server_url_.empty()) {
server_url_ = kDefaultAutofillAssistantServerUrl;
}
}
ClientAndroid::~ClientAndroid() { ClientAndroid::~ClientAndroid() {
if (controller_ != nullptr) { if (controller_ != nullptr) {
...@@ -221,7 +227,7 @@ autofill::PersonalDataManager* ClientAndroid::GetPersonalDataManager() { ...@@ -221,7 +227,7 @@ autofill::PersonalDataManager* ClientAndroid::GetPersonalDataManager() {
} }
std::string ClientAndroid::GetServerUrl() { std::string ClientAndroid::GetServerUrl() {
return kAutofillAssistantServerUrl.Get(); return server_url_;
} }
UiController* ClientAndroid::GetUiController() { UiController* ClientAndroid::GetUiController() {
......
...@@ -99,6 +99,7 @@ class ClientAndroid : public Client, ...@@ -99,6 +99,7 @@ class ClientAndroid : public Client,
std::unique_ptr<UiControllerAndroid> ui_controller_android_; std::unique_ptr<UiControllerAndroid> ui_controller_android_;
base::OnceCallback<void(bool, const std::string&)> base::OnceCallback<void(bool, const std::string&)>
fetch_access_token_callback_; fetch_access_token_callback_;
std::string server_url_;
base::WeakPtrFactory<ClientAndroid> weak_ptr_factory_; base::WeakPtrFactory<ClientAndroid> weak_ptr_factory_;
......
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