Commit 4a447c2d authored by Ioana Pandele's avatar Ioana Pandele Committed by Commit Bot

Don't create the keyboard accessory if generation is signaled unavailable

If there is no keyboard accessory, signaling that password generation is
unavailable doesn't constitute a state update. The keyboard accessory should
only be created and initialized if there is an action or data to display.

Bug: 888932
Change-Id: I9dbf8bd1ce4ae620f9b50e4e4aadb7c3c2335733
Reviewed-on: https://chromium-review.googlesource.com/1249084Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Ioana Pandele <ioanap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594761}
parent 2be15353
......@@ -709,8 +709,8 @@ void ChromePasswordManagerClient::AutomaticGenerationStatusChanged(
#if defined(OS_ANDROID)
// Either #passwords-keyboards-accessory or #experimental-ui must be enabled.
if (PasswordAccessoryController::AllowedForWebContents(web_contents())) {
PasswordAccessoryController::CreateForWebContents(web_contents());
if (available) {
PasswordAccessoryController::CreateForWebContents(web_contents());
password_manager::PasswordManagerDriver* driver =
driver_factory_->GetDriverForFrame(
password_manager_client_bindings_.GetCurrentTargetFrame());
......@@ -728,8 +728,12 @@ void ChromePasswordManagerClient::AutomaticGenerationStatusChanged(
driver->GetPasswordAutofillManager()->MaybeShowPasswordSuggestions(
element_bounds_in_screen_space, ui_data.value().text_direction);
} else {
PasswordAccessoryController::FromWebContents(web_contents())
->OnAutomaticGenerationStatusChanged(false, base::nullopt, nullptr);
PasswordAccessoryController* accessory =
PasswordAccessoryController::FromWebContents(web_contents());
if (accessory) {
accessory->OnAutomaticGenerationStatusChanged(false, base::nullopt,
nullptr);
}
}
}
#else
......
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