OLD | NEW |
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/password_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 : content::RenderFrameObserver(render_frame), | 552 : content::RenderFrameObserver(render_frame), |
553 logging_state_active_(false), | 553 logging_state_active_(false), |
554 was_username_autofilled_(false), | 554 was_username_autofilled_(false), |
555 was_password_autofilled_(false) { | 555 was_password_autofilled_(false) { |
556 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id())); | 556 Send(new AutofillHostMsg_PasswordAutofillAgentConstructed(routing_id())); |
557 } | 557 } |
558 | 558 |
559 PasswordAutofillAgent::~PasswordAutofillAgent() { | 559 PasswordAutofillAgent::~PasswordAutofillAgent() { |
560 } | 560 } |
561 | 561 |
| 562 void PasswordAutofillAgent::SetAutofillAgent(AutofillAgent* autofill_agent) { |
| 563 autofill_agent_ = autofill_agent; |
| 564 } |
| 565 |
562 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() | 566 PasswordAutofillAgent::PasswordValueGatekeeper::PasswordValueGatekeeper() |
563 : was_user_gesture_seen_(false) { | 567 : was_user_gesture_seen_(false) { |
564 } | 568 } |
565 | 569 |
566 PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() { | 570 PasswordAutofillAgent::PasswordValueGatekeeper::~PasswordValueGatekeeper() { |
567 } | 571 } |
568 | 572 |
569 void PasswordAutofillAgent::PasswordValueGatekeeper::RegisterElement( | 573 void PasswordAutofillAgent::PasswordValueGatekeeper::RegisterElement( |
570 blink::WebInputElement* element) { | 574 blink::WebInputElement* element) { |
571 if (was_user_gesture_seen_) | 575 if (was_user_gesture_seen_) |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 blink::WebFrame* frame = user_input.document().frame(); | 1408 blink::WebFrame* frame = user_input.document().frame(); |
1405 if (!frame) | 1409 if (!frame) |
1406 return false; | 1410 return false; |
1407 | 1411 |
1408 blink::WebView* webview = frame->view(); | 1412 blink::WebView* webview = frame->view(); |
1409 if (!webview) | 1413 if (!webview) |
1410 return false; | 1414 return false; |
1411 | 1415 |
1412 if (user_input.isPasswordField() && !user_input.isAutofilled() && | 1416 if (user_input.isPasswordField() && !user_input.isAutofilled() && |
1413 !user_input.value().isEmpty()) { | 1417 !user_input.value().isEmpty()) { |
1414 Send(new AutofillHostMsg_HidePopup(routing_id())); | 1418 GetAutofillDriver()->HidePopup(); |
1415 return false; | 1419 return false; |
1416 } | 1420 } |
1417 | 1421 |
1418 FormData form; | 1422 FormData form; |
1419 FormFieldData field; | 1423 FormFieldData field; |
1420 form_util::FindFormAndFieldForFormControlElement(user_input, &form, &field); | 1424 form_util::FindFormAndFieldForFormControlElement(user_input, &form, &field); |
1421 | 1425 |
1422 int options = 0; | 1426 int options = 0; |
1423 if (show_all) | 1427 if (show_all) |
1424 options |= SHOW_ALL; | 1428 options |= SHOW_ALL; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 provisionally_saved_form_ = std::move(password_form); | 1477 provisionally_saved_form_ = std::move(password_form); |
1474 } | 1478 } |
1475 | 1479 |
1476 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { | 1480 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { |
1477 return provisionally_saved_form_ && | 1481 return provisionally_saved_form_ && |
1478 !provisionally_saved_form_->username_value.empty() && | 1482 !provisionally_saved_form_->username_value.empty() && |
1479 !(provisionally_saved_form_->password_value.empty() && | 1483 !(provisionally_saved_form_->password_value.empty() && |
1480 provisionally_saved_form_->new_password_value.empty()); | 1484 provisionally_saved_form_->new_password_value.empty()); |
1481 } | 1485 } |
1482 | 1486 |
| 1487 const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() { |
| 1488 DCHECK(autofill_agent_); |
| 1489 return autofill_agent_->GetAutofillDriver(); |
| 1490 } |
| 1491 |
1483 } // namespace autofill | 1492 } // namespace autofill |
OLD | NEW |