Commit 5ab2b206 authored by Mathias Carlen's avatar Mathias Carlen Committed by Commit Bot

[Autofill Assistant] Set cookie experiment related parameter.

Propagate the cookie experiment bool to the initial request parameters
by setting it explicitly in the parameters map.

This will allow the backend to make informed decisions for previously
seen sites where we may not have a clean slate.

Note: This parameter only gets set when the cookie experiment is
enabled.

Note 2: This patch introduces a different pattern to set parameters not
actually provided by callers.

Bug: 806868
Change-Id: Ibe7b19ad8bda2636e531884b89928d3a9cebb0f1
Reviewed-on: https://chromium-review.googlesource.com/c/1349226Reviewed-by: default avatarStephane Zermatten <szermatt@chromium.org>
Commit-Queue: Mathias Carlen <mcarlen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610624}
parent c2c6c889
...@@ -43,6 +43,13 @@ static const char* const kCallerScriptParameterName = "CALLER"; ...@@ -43,6 +43,13 @@ static const char* const kCallerScriptParameterName = "CALLER";
// TODO(crbug.com/806868): Introduce a dedicated experiment extra parameter to // TODO(crbug.com/806868): Introduce a dedicated experiment extra parameter to
// pass allow passing more than one experiment. // pass allow passing more than one experiment.
static const char* const kCookieExperimentName = "EXP_COOKIE"; static const char* const kCookieExperimentName = "EXP_COOKIE";
// Website visited before parameter.
// Note: This parameter goes with the previous experiment name. I.e. it is only
// set when the cookie experiment is active.
static const char* const kWebsiteVisitedBeforeParameterName =
"WEBSITE_VISITED_BEFORE";
static const char* const kTrueValue = "true";
} // namespace } // namespace
...@@ -365,9 +372,9 @@ void Controller::OnClickOverlay() { ...@@ -365,9 +372,9 @@ void Controller::OnClickOverlay() {
void Controller::OnGetCookie(const GURL& initial_url, bool has_cookie) { void Controller::OnGetCookie(const GURL& initial_url, bool has_cookie) {
if (has_cookie) { if (has_cookie) {
// This code is only active with the experiment parameter. // This code is only active with the experiment parameter.
// TODO(crbug.com/806868): Set a proper, localized message. parameters_->insert(
GetUiController()->ShowStatusMessage("Warning: You have been here before!"); std::make_pair(kWebsiteVisitedBeforeParameterName, kTrueValue));
GetUiController()->ShutdownGracefully(); OnSetCookie(initial_url, has_cookie);
return; return;
} }
GetWebController()->SetCookie( GetWebController()->SetCookie(
......
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