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

Side by Side Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 2035143002: Basic implementation of showing password fill dialog on page load (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Cleanup and tests Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/content/renderer/autofill_agent.h" 5 #include "components/autofill/content/renderer/autofill_agent.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <tuple> 9 #include <tuple>
10 10
(...skipping 16 matching lines...) Expand all
27 #include "components/autofill/content/renderer/password_autofill_agent.h" 27 #include "components/autofill/content/renderer/password_autofill_agent.h"
28 #include "components/autofill/content/renderer/password_generation_agent.h" 28 #include "components/autofill/content/renderer/password_generation_agent.h"
29 #include "components/autofill/core/common/autofill_constants.h" 29 #include "components/autofill/core/common/autofill_constants.h"
30 #include "components/autofill/core/common/autofill_data_validation.h" 30 #include "components/autofill/core/common/autofill_data_validation.h"
31 #include "components/autofill/core/common/autofill_switches.h" 31 #include "components/autofill/core/common/autofill_switches.h"
32 #include "components/autofill/core/common/autofill_util.h" 32 #include "components/autofill/core/common/autofill_util.h"
33 #include "components/autofill/core/common/form_data.h" 33 #include "components/autofill/core/common/form_data.h"
34 #include "components/autofill/core/common/form_data_predictions.h" 34 #include "components/autofill/core/common/form_data_predictions.h"
35 #include "components/autofill/core/common/form_field_data.h" 35 #include "components/autofill/core/common/form_field_data.h"
36 #include "components/autofill/core/common/password_form.h" 36 #include "components/autofill/core/common/password_form.h"
37 #include "components/autofill/core/common/password_form_fill_data.h"
37 #include "content/public/common/content_switches.h" 38 #include "content/public/common/content_switches.h"
38 #include "content/public/common/service_registry.h" 39 #include "content/public/common/service_registry.h"
39 #include "content/public/common/ssl_status.h" 40 #include "content/public/common/ssl_status.h"
40 #include "content/public/common/url_constants.h" 41 #include "content/public/common/url_constants.h"
41 #include "content/public/renderer/render_frame.h" 42 #include "content/public/renderer/render_frame.h"
42 #include "content/public/renderer/render_view.h" 43 #include "content/public/renderer/render_view.h"
43 #include "net/cert/cert_status_flags.h" 44 #include "net/cert/cert_status_flags.h"
44 #include "third_party/WebKit/public/platform/WebURLRequest.h" 45 #include "third_party/WebKit/public/platform/WebURLRequest.h"
45 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 46 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
46 #include "third_party/WebKit/public/web/WebDataSource.h" 47 #include "third_party/WebKit/public/web/WebDataSource.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm) 214 IPC_MESSAGE_HANDLER(AutofillMsg_ClearPreviewedForm, OnClearPreviewedForm)
214 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue) 215 IPC_MESSAGE_HANDLER(AutofillMsg_FillFieldWithValue, OnFillFieldWithValue)
215 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue, 216 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewFieldWithValue,
216 OnPreviewFieldWithValue) 217 OnPreviewFieldWithValue)
217 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion, 218 IPC_MESSAGE_HANDLER(AutofillMsg_AcceptDataListSuggestion,
218 OnAcceptDataListSuggestion) 219 OnAcceptDataListSuggestion)
219 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordSuggestion, 220 IPC_MESSAGE_HANDLER(AutofillMsg_FillPasswordSuggestion,
220 OnFillPasswordSuggestion) 221 OnFillPasswordSuggestion)
221 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPasswordSuggestion, 222 IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPasswordSuggestion,
222 OnPreviewPasswordSuggestion) 223 OnPreviewPasswordSuggestion)
224 IPC_MESSAGE_HANDLER(AutofillMsg_ShowInitialPasswordAccountSuggestions,
225 OnShowInitialPasswordAccountSuggestions);
223 IPC_MESSAGE_UNHANDLED(handled = false) 226 IPC_MESSAGE_UNHANDLED(handled = false)
224 IPC_END_MESSAGE_MAP() 227 IPC_END_MESSAGE_MAP()
225 return handled; 228 return handled;
226 } 229 }
227 230
228 void AutofillAgent::DidCommitProvisionalLoad(bool is_new_navigation, 231 void AutofillAgent::DidCommitProvisionalLoad(bool is_new_navigation,
229 bool is_same_page_navigation) { 232 bool is_same_page_navigation) {
230 blink::WebFrame* frame = render_frame()->GetWebFrame(); 233 blink::WebFrame* frame = render_frame()->GetWebFrame();
231 // TODO(dvadym): check if we need to check if it is main frame navigation 234 // TODO(dvadym): check if we need to check if it is main frame navigation
232 // http://crbug.com/443155 235 // http://crbug.com/443155
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 void AutofillAgent::OnPreviewPasswordSuggestion( 591 void AutofillAgent::OnPreviewPasswordSuggestion(
589 const base::string16& username, 592 const base::string16& username,
590 const base::string16& password) { 593 const base::string16& password) {
591 bool handled = password_autofill_agent_->PreviewSuggestion( 594 bool handled = password_autofill_agent_->PreviewSuggestion(
592 element_, 595 element_,
593 username, 596 username,
594 password); 597 password);
595 DCHECK(handled); 598 DCHECK(handled);
596 } 599 }
597 600
601 void AutofillAgent::OnShowInitialPasswordAccountSuggestions(
602 int key,
603 const PasswordFormFillData& form_data) {
604 std::vector<blink::WebInputElement> elements;
605 password_autofill_agent_->GetFillableElementFromFormData(key, form_data,
606 false, &elements);
607 ShowSuggestionsOptions options;
608 options.autofill_on_empty_values = true;
609 options.show_full_suggestion_list = true;
610 for (auto element : elements)
611 ShowSuggestions(element, options);
612 }
613
598 void AutofillAgent::OnSamePageNavigationCompleted() { 614 void AutofillAgent::OnSamePageNavigationCompleted() {
599 if (!last_interacted_form_.isNull()) { 615 if (!last_interacted_form_.isNull()) {
600 // Assume form submission only if the form is now gone, either invisible or 616 // Assume form submission only if the form is now gone, either invisible or
601 // removed from the DOM. 617 // removed from the DOM.
602 if (form_util::AreFormContentsVisible(last_interacted_form_)) 618 if (form_util::AreFormContentsVisible(last_interacted_form_))
603 return; 619 return;
604 620
605 FireHostSubmitEvents(last_interacted_form_, /*form_submitted=*/true); 621 FireHostSubmitEvents(last_interacted_form_, /*form_submitted=*/true);
606 last_interacted_form_.reset(); 622 last_interacted_form_.reset();
607 } 623 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 813 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
798 // No-op. Don't delete |this|. 814 // No-op. Don't delete |this|.
799 } 815 }
800 816
801 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { 817 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
802 if (agent_) 818 if (agent_)
803 agent_->FocusChangeComplete(); 819 agent_->FocusChangeComplete();
804 } 820 }
805 821
806 } // namespace autofill 822 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698