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

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

Issue 2603623002: AutofillDriverFactory manages information about user gestures (Closed)
Patch Set: Remove braces 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.h
diff --git a/components/autofill/core/browser/autofill_driver_factory.h b/components/autofill/core/browser/autofill_driver_factory.h
index 8446d7af363b917a9cff21f9647892e9f5c9a78c..23995e69317aa4a68eb8eb3736526262f2364a39 100644
--- a/components/autofill/core/browser/autofill_driver_factory.h
+++ b/components/autofill/core/browser/autofill_driver_factory.h
@@ -17,11 +17,9 @@ class AutofillClient;
class AutofillDriver;
// Manages the lifetime of AutofillDrivers for a particular AutofillClient by
-// creating, retrieveing and deleting on demand.
+// creating, notifying, retrieveing and deleting on demand.
Mathieu 2017/02/27 15:46:29 *retrieving
vabr (Chromium) 2017/02/27 16:45:46 Done.
class AutofillDriverFactory {
- // The API is protected to guarantee subclasses that nothing else can
- // interfere with the map of drivers.
- protected:
+ public:
explicit AutofillDriverFactory(AutofillClient* client);
~AutofillDriverFactory();
@@ -30,28 +28,41 @@ class AutofillDriverFactory {
// null if there is none.
AutofillDriver* DriverForKey(void* key);
- // Adds a driver, constructed by calling |factory_method|, for |key|. If there
- // already is a driver for |key|, |factory_method| is not called.
- void AddForKey(
- void* key,
- base::Callback<std::unique_ptr<AutofillDriver>()> factory_method);
-
- // Deletes the AutofillDriver for |key|.
- void DeleteForKey(void* key);
-
// Handles finished navigation in any of the frames.
void NavigationFinished();
// Handles hiding of the corresponding tab.
void TabHidden();
+ // Call this to notify the factory that one of the frames saw a user gesture.
+ // The factory will distribute this information to all drivers when it comes
+ // for the first time since the last main frame navigation to a different
+ // page. It will also notify drivers added later (see AddForKey).
+ void OnFirstUserGestureObserved();
+
AutofillClient* client() { return client_; };
+ protected:
+ // The API manipulating the drivers map is protected to guarantee subclasses
+ // that nothing else can interfere with the map of drivers.
+
+ // Adds a driver, constructed by calling |factory_method|, for |key|. If there
+ // already is a driver for |key|, |factory_method| is not called. This might
+ // end up notifying the driver that a user gesture has been observed.
+ void AddForKey(
+ void* key,
+ base::Callback<std::unique_ptr<AutofillDriver>()> factory_method);
+
+ // Deletes the AutofillDriver for |key|.
+ void DeleteForKey(void* key);
+
private:
AutofillClient* const client_;
std::unordered_map<void*, std::unique_ptr<AutofillDriver>> driver_map_;
+ bool user_gesture_seen_ = false; // The state for OnFirstUserGestureObserved.
+
DISALLOW_COPY_AND_ASSIGN(AutofillDriverFactory);
};
« no previous file with comments | « components/autofill/core/browser/autofill_driver.h ('k') | components/autofill/core/browser/autofill_driver_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698