OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/common/password_form_fill_data.h" | 5 #include "components/autofill/common/password_form_fill_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" |
8 #include "components/autofill/common/form_field_data.h" | 9 #include "components/autofill/common/form_field_data.h" |
9 | 10 |
10 namespace autofill { | 11 namespace autofill { |
11 | 12 |
12 UsernamesCollectionKey::UsernamesCollectionKey() {} | 13 UsernamesCollectionKey::UsernamesCollectionKey() {} |
13 | 14 |
14 UsernamesCollectionKey::~UsernamesCollectionKey() {} | 15 UsernamesCollectionKey::~UsernamesCollectionKey() {} |
15 | 16 |
16 bool UsernamesCollectionKey::operator<( | 17 bool UsernamesCollectionKey::operator<( |
17 const UsernamesCollectionKey& other) const { | 18 const UsernamesCollectionKey& other) const { |
(...skipping 25 matching lines...) Expand all Loading... |
43 password_field.name = form_on_page.password_element; | 44 password_field.name = form_on_page.password_element; |
44 password_field.value = preferred_match->password_value; | 45 password_field.value = preferred_match->password_value; |
45 | 46 |
46 // Fill basic form data. | 47 // Fill basic form data. |
47 result->basic_data.origin = form_on_page.origin; | 48 result->basic_data.origin = form_on_page.origin; |
48 result->basic_data.action = form_on_page.action; | 49 result->basic_data.action = form_on_page.action; |
49 result->basic_data.fields.push_back(username_field); | 50 result->basic_data.fields.push_back(username_field); |
50 result->basic_data.fields.push_back(password_field); | 51 result->basic_data.fields.push_back(password_field); |
51 result->wait_for_username = wait_for_username_before_autofill; | 52 result->wait_for_username = wait_for_username_before_autofill; |
52 | 53 |
| 54 result->preferred_is_psl_origin_match = preferred_match->is_psl_origin_match; |
| 55 if (preferred_match->is_psl_origin_match) { |
| 56 result->preferred_realm = |
| 57 ASCIIToUTF16(preferred_match->original_signon_realm); |
| 58 } else { |
| 59 result->preferred_realm = ASCIIToUTF16(preferred_match->signon_realm); |
| 60 } |
| 61 |
53 // Copy additional username/value pairs. | 62 // Copy additional username/value pairs. |
54 content::PasswordFormMap::const_iterator iter; | 63 content::PasswordFormMap::const_iterator iter; |
55 for (iter = matches.begin(); iter != matches.end(); iter++) { | 64 for (iter = matches.begin(); iter != matches.end(); iter++) { |
56 if (iter->second != preferred_match) | 65 if (iter->second != preferred_match) { |
57 result->additional_logins[iter->first] = iter->second->password_value; | 66 result->additional_logins_passwords[iter->first] = |
| 67 iter->second->password_value; |
| 68 if (iter->second->is_psl_origin_match) { |
| 69 result->additional_logins_is_psl_origin_match.insert(iter->first); |
| 70 result->additional_logins_realms[iter->first] = |
| 71 ASCIIToUTF16(iter->second->original_signon_realm); |
| 72 } else { |
| 73 result->additional_logins_realms[iter->first] = |
| 74 ASCIIToUTF16(iter->second->signon_realm); |
| 75 } |
| 76 } |
58 if (enable_other_possible_usernames && | 77 if (enable_other_possible_usernames && |
59 !iter->second->other_possible_usernames.empty()) { | 78 !iter->second->other_possible_usernames.empty()) { |
60 // Note that there may be overlap between other_possible_usernames and | 79 // Note that there may be overlap between other_possible_usernames and |
61 // other saved usernames or with other other_possible_usernames. For now | 80 // other saved usernames or with other other_possible_usernames. For now |
62 // we will ignore this overlap as it should be a rare occurence. We may | 81 // we will ignore this overlap as it should be a rare occurence. We may |
63 // want to revisit this in the future. | 82 // want to revisit this in the future. |
64 UsernamesCollectionKey key; | 83 UsernamesCollectionKey key; |
65 key.username = iter->first; | 84 key.username = iter->first; |
66 key.password = iter->second->password_value; | 85 key.password = iter->second->password_value; |
67 result->other_possible_usernames[key] = | 86 result->other_possible_usernames[key] = |
68 iter->second->other_possible_usernames; | 87 iter->second->other_possible_usernames; |
69 } | 88 } |
70 } | 89 } |
71 } | 90 } |
72 | 91 |
73 } // namespace autofill | 92 } // namespace autofill |
OLD | NEW |