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

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 119683003: [Autofill] Fix up AutofillAgent a bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/autofill_agent.cc
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index d2817874d7e7786bce890f4aa6a666d5d32628da..11ac21d49587c6b28dc399ee20a56aef75fc50d0 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -158,22 +158,18 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
OnFieldTypePredictionsAvailable)
IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionFill,
OnSetAutofillActionFill)
- IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm,
- OnClearForm)
+ IPC_MESSAGE_HANDLER(AutofillMsg_ClearForm, OnClearForm)
IPC_MESSAGE_HANDLER(AutofillMsg_SetAutofillActionPreview,
OnSetAutofillActionPreview)
- IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm,
- OnClearPreviewedForm)
- IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText,
- OnSetNodeText)
+ IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm)
+ IPC_MESSAGE_HANDLER(AutofillMsg_SetNodeText, OnSetNodeText)
IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion,
OnAcceptDataListSuggestion)
IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion,
OnAcceptPasswordAutofillSuggestion)
IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteResult,
OnRequestAutocompleteResult)
- IPC_MESSAGE_HANDLER(AutofillMsg_PageShown,
- OnPageShown)
+ IPC_MESSAGE_HANDLER(AutofillMsg_PageShown, OnPageShown)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -314,22 +310,6 @@ void AutofillAgent::InputElementLostFocus() {
HideAutofillUI();
}
-void AutofillAgent::didClearAutofillSelection(const WebNode& node) {
- if (password_autofill_agent_->DidClearAutofillSelection(node))
- return;
-
- if (!element_.isNull() && node == element_) {
- ClearPreviewedFormWithElement(element_, was_query_node_autofilled_);
- } else {
- // TODO(isherman): There seem to be rare cases where this code *is*
- // reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would
- // understand those cases and fix the code to avoid them. However, so far I
- // have been unable to reproduce such a case locally. If you hit this
- // NOTREACHED(), please file a bug against me.
- NOTREACHED();
- }
-}
-
void AutofillAgent::textFieldDidEndEditing(const WebInputElement& element) {
password_autofill_agent_->TextFieldDidEndEditing(element);
has_shown_autofill_popup_for_current_edit_ = false;
@@ -465,7 +445,19 @@ void AutofillAgent::OnSetAutofillActionPreview() {
}
void AutofillAgent::OnClearPreviewedForm() {
- didClearAutofillSelection(element_);
+ if (password_autofill_agent_->DidClearAutofillSelection(element_))
+ return;
+
+ if (!element_.isNull()) {
Dan Beam 2013/12/20 03:52:34 why'd you remove the && node == element_ ?
Ilya Sherman 2013/12/20 03:54:37 Because |node| doesn't exist anymore, or rather is
Dan Beam 2013/12/20 03:55:13 oh, duh, sorry
+ ClearPreviewedFormWithElement(element_, was_query_node_autofilled_);
+ } else {
+ // TODO(isherman): There seem to be rare cases where this code *is*
+ // reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would
+ // understand those cases and fix the code to avoid them. However, so far I
+ // have been unable to reproduce such a case locally. If you hit this
+ // NOTREACHED(), please file a bug against me.
+ NOTREACHED();
+ }
}
void AutofillAgent::OnSetNodeText(const base::string16& value) {
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698