| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 //////////////////////////////////////////////////////////////////////////////// | 562 //////////////////////////////////////////////////////////////////////////////// |
| 563 // PasswordAutofillAgent, private: | 563 // PasswordAutofillAgent, private: |
| 564 | 564 |
| 565 void PasswordAutofillAgent::GetSuggestions( | 565 void PasswordAutofillAgent::GetSuggestions( |
| 566 const PasswordFormFillData& fill_data, | 566 const PasswordFormFillData& fill_data, |
| 567 const base::string16& input, | 567 const base::string16& input, |
| 568 std::vector<base::string16>* suggestions, | 568 std::vector<base::string16>* suggestions, |
| 569 std::vector<base::string16>* realms) { | 569 std::vector<base::string16>* realms) { |
| 570 if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) { | 570 if (StartsWith(fill_data.basic_data.fields[0].value, input, false)) { |
| 571 suggestions->push_back(fill_data.basic_data.fields[0].value); | 571 suggestions->push_back(fill_data.basic_data.fields[0].value); |
| 572 realms->push_back(UTF8ToUTF16(fill_data.preferred_realm)); | 572 realms->push_back(base::UTF8ToUTF16(fill_data.preferred_realm)); |
| 573 } | 573 } |
| 574 | 574 |
| 575 for (PasswordFormFillData::LoginCollection::const_iterator iter = | 575 for (PasswordFormFillData::LoginCollection::const_iterator iter = |
| 576 fill_data.additional_logins.begin(); | 576 fill_data.additional_logins.begin(); |
| 577 iter != fill_data.additional_logins.end(); ++iter) { | 577 iter != fill_data.additional_logins.end(); ++iter) { |
| 578 if (StartsWith(iter->first, input, false)) { | 578 if (StartsWith(iter->first, input, false)) { |
| 579 suggestions->push_back(iter->first); | 579 suggestions->push_back(iter->first); |
| 580 realms->push_back(UTF8ToUTF16(iter->second.realm)); | 580 realms->push_back(base::UTF8ToUTF16(iter->second.realm)); |
| 581 } | 581 } |
| 582 } | 582 } |
| 583 | 583 |
| 584 for (PasswordFormFillData::UsernamesCollection::const_iterator iter = | 584 for (PasswordFormFillData::UsernamesCollection::const_iterator iter = |
| 585 fill_data.other_possible_usernames.begin(); | 585 fill_data.other_possible_usernames.begin(); |
| 586 iter != fill_data.other_possible_usernames.end(); ++iter) { | 586 iter != fill_data.other_possible_usernames.end(); ++iter) { |
| 587 for (size_t i = 0; i < iter->second.size(); ++i) { | 587 for (size_t i = 0; i < iter->second.size(); ++i) { |
| 588 if (StartsWith(iter->second[i], input, false)) { | 588 if (StartsWith(iter->second[i], input, false)) { |
| 589 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SHOWN; | 589 usernames_usage_ = OTHER_POSSIBLE_USERNAME_SHOWN; |
| 590 suggestions->push_back(iter->second[i]); | 590 suggestions->push_back(iter->second[i]); |
| 591 realms->push_back(UTF8ToUTF16(iter->first.realm)); | 591 realms->push_back(base::UTF8ToUTF16(iter->first.realm)); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 | 596 |
| 597 bool PasswordAutofillAgent::ShowSuggestionPopup( | 597 bool PasswordAutofillAgent::ShowSuggestionPopup( |
| 598 const PasswordFormFillData& fill_data, | 598 const PasswordFormFillData& fill_data, |
| 599 const blink::WebInputElement& user_input) { | 599 const blink::WebInputElement& user_input) { |
| 600 blink::WebFrame* frame = user_input.document().frame(); | 600 blink::WebFrame* frame = user_input.document().frame(); |
| 601 if (!frame) | 601 if (!frame) |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 } | 840 } |
| 841 | 841 |
| 842 PasswordAutofillAgent::AutofillWebUserGestureHandler:: | 842 PasswordAutofillAgent::AutofillWebUserGestureHandler:: |
| 843 AutofillWebUserGestureHandler(PasswordAutofillAgent* agent) | 843 AutofillWebUserGestureHandler(PasswordAutofillAgent* agent) |
| 844 : agent_(agent) {} | 844 : agent_(agent) {} |
| 845 | 845 |
| 846 PasswordAutofillAgent::AutofillWebUserGestureHandler:: | 846 PasswordAutofillAgent::AutofillWebUserGestureHandler:: |
| 847 ~AutofillWebUserGestureHandler() {} | 847 ~AutofillWebUserGestureHandler() {} |
| 848 | 848 |
| 849 } // namespace autofill | 849 } // namespace autofill |
| OLD | NEW |