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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.h

Issue 208453002: Add "previewing on hover" support for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per further review comments. Created 6 years, 7 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/content/renderer/password_autofill_agent.h
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h
index 24a7aa9099f7f7e37200b66cc1db11d9f4b64e14..a1ebefc5c394024c87330e5244124be69232a9a2 100644
--- a/components/autofill/content/renderer/password_autofill_agent.h
+++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -40,13 +40,19 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
// Fills the username and password fields of this form with the given values.
// Returns true if the fields were filled, false otherwise.
- bool AcceptSuggestion(const blink::WebNode& node,
- const blink::WebString& username,
- const blink::WebString& password);
-
- // A no-op. Password forms are not previewed, so they do not need to be
- // cleared when the selection changes. However, this method returns
- // true when |node| is fillable by password Autofill.
+ bool FillSuggestion(const blink::WebNode& node,
+ const blink::WebString& username,
+ const blink::WebString& password);
+
+ // Previews the username and password fields of this form with the given
+ // values. Returns true if the fields were previewed, false otherwise.
+ bool PreviewSuggestion(const blink::WebNode& node,
+ const blink::WebString& username,
+ const blink::WebString& password);
+
+ // Clears the preview for the username and password fields, restoring both to
+ // their previous filled state. Return false if no login information was
+ // found for the form.
bool DidClearAutofillSelection(const blink::WebNode& node);
// Shows an Autofill popup with username suggestions for |element|.
// Returns true if any suggestions were shown, false otherwise.
@@ -153,12 +159,11 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
blink::WebInputElement username_element,
blink::WebInputElement password_element);
- bool FillUserNameAndPassword(
- blink::WebInputElement* username_element,
- blink::WebInputElement* password_element,
- const PasswordFormFillData& fill_data,
- bool exact_username_match,
- bool set_selection);
+ bool FillUserNameAndPassword(blink::WebInputElement* username_element,
+ blink::WebInputElement* password_element,
+ const PasswordFormFillData& fill_data,
+ bool exact_username_match,
+ bool set_selection);
// Fills |login_input| and |password| with the most relevant suggestion from
// |fill_data| and shows a popup with other suggestions.
@@ -176,6 +181,11 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
blink::WebInputElement* found_input,
PasswordInfo* found_password);
+ // Clears the preview for the username and password fields, restoring both to
+ // their previous filled state.
+ void ClearPreview(blink::WebInputElement* username,
+ blink::WebInputElement* password);
+
// If |provisionally_saved_forms_| contains a form for |current_frame| or its
// children, return such frame.
blink::WebFrame* CurrentOrChildFrameWithSavedForms(
@@ -199,6 +209,15 @@ class PasswordAutofillAgent : public content::RenderViewObserver {
// True indicates that user debug information should be logged.
bool logging_state_active_;
+ // True indicates that the username field was autofilled, false otherwise.
+ bool was_username_autofilled_;
+ // True indicates that the password field was autofilled, false otherwise.
+ bool was_password_autofilled_;
+
+ // Records original starting point of username element's selection range
+ // before preview.
+ int username_selection_start_;
+
base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);

Powered by Google App Engine
This is Rietveld 408576698