Chromium Code Reviews| 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..329c1a68edda14781ac65f2c23bc5b10b412fd19 100644 |
| --- a/components/autofill/core/browser/autofill_driver_factory.cc |
| +++ b/components/autofill/core/browser/autofill_driver_factory.cc |
| @@ -20,25 +20,40 @@ 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_) { |
|
dvadym
2017/02/24 12:48:21
Nit: do we need {} here?
vabr (Chromium)
2017/02/24 12:54:25
We don't need them, but they are allowed [1]. Howe
|
| + 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 |