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

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

Issue 2869673002: Use OnceCallback on Mojo interfaces in //components/autofill (Closed)
Patch Set: rebase Created 3 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 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/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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 void PasswordAutofillAgent::SetLoggingState(bool active) { 1539 void PasswordAutofillAgent::SetLoggingState(bool active) {
1540 logging_state_active_ = active; 1540 logging_state_active_ = active;
1541 } 1541 }
1542 1542
1543 void PasswordAutofillAgent::AutofillUsernameAndPasswordDataReceived( 1543 void PasswordAutofillAgent::AutofillUsernameAndPasswordDataReceived(
1544 const FormsPredictionsMap& predictions) { 1544 const FormsPredictionsMap& predictions) {
1545 form_predictions_.insert(predictions.begin(), predictions.end()); 1545 form_predictions_.insert(predictions.begin(), predictions.end());
1546 } 1546 }
1547 1547
1548 void PasswordAutofillAgent::FindFocusedPasswordForm( 1548 void PasswordAutofillAgent::FindFocusedPasswordForm(
1549 const FindFocusedPasswordFormCallback& callback) { 1549 FindFocusedPasswordFormCallback callback) {
1550 std::unique_ptr<PasswordForm> password_form; 1550 std::unique_ptr<PasswordForm> password_form;
1551 1551
1552 blink::WebElement element = 1552 blink::WebElement element =
1553 render_frame()->GetWebFrame()->GetDocument().FocusedElement(); 1553 render_frame()->GetWebFrame()->GetDocument().FocusedElement();
1554 if (!element.IsNull() && element.HasHTMLTagName("input")) { 1554 if (!element.IsNull() && element.HasHTMLTagName("input")) {
1555 blink::WebInputElement input = element.To<blink::WebInputElement>(); 1555 blink::WebInputElement input = element.To<blink::WebInputElement>();
1556 if (input.IsPasswordField()) { 1556 if (input.IsPasswordField()) {
1557 if (!input.Form().IsNull()) { 1557 if (!input.Form().IsNull()) {
1558 password_form = CreatePasswordFormFromWebForm( 1558 password_form = CreatePasswordFormFromWebForm(
1559 input.Form(), &field_value_and_properties_map_, &form_predictions_); 1559 input.Form(), &field_value_and_properties_map_, &form_predictions_);
(...skipping 10 matching lines...) Expand all
1570 password_form.reset(); 1570 password_form.reset();
1571 } 1571 }
1572 } 1572 }
1573 } 1573 }
1574 1574
1575 if (!password_form) 1575 if (!password_form)
1576 password_form.reset(new PasswordForm()); 1576 password_form.reset(new PasswordForm());
1577 1577
1578 password_form->submission_event = 1578 password_form->submission_event =
1579 PasswordForm::SubmissionIndicatorEvent::MANUAL_SAVE; 1579 PasswordForm::SubmissionIndicatorEvent::MANUAL_SAVE;
1580 callback.Run(*password_form); 1580 std::move(callback).Run(*password_form);
1581 } 1581 }
1582 1582
1583 //////////////////////////////////////////////////////////////////////////////// 1583 ////////////////////////////////////////////////////////////////////////////////
1584 // PasswordAutofillAgent, private: 1584 // PasswordAutofillAgent, private:
1585 1585
1586 bool PasswordAutofillAgent::ShowSuggestionPopup( 1586 bool PasswordAutofillAgent::ShowSuggestionPopup(
1587 const PasswordInfo& password_info, 1587 const PasswordInfo& password_info,
1588 const blink::WebInputElement& user_input, 1588 const blink::WebInputElement& user_input,
1589 bool show_all, 1589 bool show_all,
1590 bool show_on_password_field) { 1590 bool show_on_password_field) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 PasswordAutofillAgent::GetPasswordManagerDriver() { 1673 PasswordAutofillAgent::GetPasswordManagerDriver() {
1674 if (!password_manager_driver_) { 1674 if (!password_manager_driver_) {
1675 render_frame()->GetRemoteInterfaces()->GetInterface( 1675 render_frame()->GetRemoteInterfaces()->GetInterface(
1676 mojo::MakeRequest(&password_manager_driver_)); 1676 mojo::MakeRequest(&password_manager_driver_));
1677 } 1677 }
1678 1678
1679 return password_manager_driver_; 1679 return password_manager_driver_;
1680 } 1680 }
1681 1681
1682 } // namespace autofill 1682 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698