Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: components/autofill/core/browser/autofill_driver_factory.cc

Issue 2603623002: AutofillDriverFactory manages information about user gestures (Closed)
Patch Set: Fix typo Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_driver_factory.cc
diff --git a/components/autofill/core/browser/autofill_driver_factory.cc b/components/autofill/core/browser/autofill_driver_factory.cc
index 19d369bb1f9427631db2ebed991123de6af2fd14..224c1efde47f7a4a18239aded932f7243908702f 100644
--- a/components/autofill/core/browser/autofill_driver_factory.cc
+++ b/components/autofill/core/browser/autofill_driver_factory.cc
@@ -20,25 +20,39 @@ AutofillDriver* AutofillDriverFactory::DriverForKey(void* key) {
return mapping == driver_map_.end() ? nullptr : mapping->second.get();
}
+void AutofillDriverFactory::NavigationFinished() {
+ user_gesture_seen_ = false;
+ client_->HideAutofillPopup();
+}
+
+void AutofillDriverFactory::TabHidden() {
+ client_->HideAutofillPopup();
+}
+
+void AutofillDriverFactory::OnFirstUserGestureObserved() {
+ if (user_gesture_seen_)
+ return;
+
+ for (auto& driver : driver_map_)
+ driver.second->NotifyFirstUserGestureObservedInTab();
+
+ user_gesture_seen_ = true;
+}
+
void AutofillDriverFactory::AddForKey(
void* key,
base::Callback<std::unique_ptr<AutofillDriver>()> factory_method) {
auto insertion_result = driver_map_.insert(std::make_pair(key, nullptr));
// This can be called twice for the key representing the main frame.
- if (insertion_result.second)
+ if (insertion_result.second) {
insertion_result.first->second = factory_method.Run();
+ if (user_gesture_seen_)
+ insertion_result.first->second->NotifyFirstUserGestureObservedInTab();
+ }
}
void AutofillDriverFactory::DeleteForKey(void* key) {
driver_map_.erase(key);
}
-void AutofillDriverFactory::NavigationFinished() {
- client_->HideAutofillPopup();
-}
-
-void AutofillDriverFactory::TabHidden() {
- client_->HideAutofillPopup();
-}
-
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698