Commit 58fab4a9 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Touch To Fill Fixes

This change introduces a couple of small fixes to the Touch To Fill
feature. In particular, it breaks a circular dependency between the
constructors of the TouchToFillController and the
ManualFillingController and exposes the Touch to Fill feature flag to
Android.

Bug: 957532
Change-Id: Id1c9f227139d7b5273d1db6b0ca13a5004addf52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649513
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667173}
parent 74442cff
......@@ -210,6 +210,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&omnibox::kUIExperimentShowSuggestionFavicons,
&password_manager::features::kGooglePasswordManager,
&password_manager::features::kPasswordsKeyboardAccessory,
&password_manager::features::kTouchToFillAndroid,
&safe_browsing::kCaptureSafetyNetId,
&signin::kMiceFeature,
&switches::kSyncSendTabToSelf,
......
......@@ -63,7 +63,8 @@ void TouchToFillController::Show(
/*is_selectable=*/false);
}
mf_controller_->ShowTouchToFillSheet(std::move(builder).Build());
GetManualFillingController()->ShowTouchToFillSheet(
std::move(builder).Build());
}
void TouchToFillController::OnFillingTriggered(
......@@ -79,9 +80,7 @@ void TouchToFillController::OnOptionSelected(
}
TouchToFillController::TouchToFillController(WebContents* web_contents)
: mf_controller_(ManualFillingController::GetOrCreate(web_contents)) {
DCHECK(mf_controller_);
}
: web_contents_(web_contents) {}
TouchToFillController::TouchToFillController(
base::WeakPtr<ManualFillingController> mf_controller)
......@@ -89,4 +88,11 @@ TouchToFillController::TouchToFillController(
DCHECK(mf_controller_);
}
ManualFillingController* TouchToFillController::GetManualFillingController() {
if (!mf_controller_)
mf_controller_ = ManualFillingController::GetOrCreate(web_contents_);
DCHECK(mf_controller_);
return mf_controller_.get();
}
WEB_CONTENTS_USER_DATA_KEY_IMPL(TouchToFillController)
......@@ -61,6 +61,15 @@ class TouchToFillController
explicit TouchToFillController(
base::WeakPtr<ManualFillingController> mf_controller);
// Lazy-initializes and returns the ManualFillingController for the current
// |web_contents_|. The lazy initialization is required to break a circular
// dependency between the constructors of the TouchToFillController and
// ManualFillingController.
ManualFillingController* GetManualFillingController();
// The tab for which this class is scoped.
content::WebContents* web_contents_ = nullptr;
// The manual filling controller object to forward client requests to.
base::WeakPtr<ManualFillingController> mf_controller_;
......
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