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

Side by Side Diff: components/autofill/common/password_form_fill_data.cc

Issue 15660018: [autofill] Add support for PSL domain matching for password autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments from isherman and aurimas Created 7 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 | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
44 password_field.value = preferred_match->password_value; 45 password_field.value = preferred_match->password_value;
45 password_field.form_control_type = "password"; 46 password_field.form_control_type = "password";
46 47
47 // Fill basic form data. 48 // Fill basic form data.
48 result->basic_data.origin = form_on_page.origin; 49 result->basic_data.origin = form_on_page.origin;
49 result->basic_data.action = form_on_page.action; 50 result->basic_data.action = form_on_page.action;
50 result->basic_data.fields.push_back(username_field); 51 result->basic_data.fields.push_back(username_field);
51 result->basic_data.fields.push_back(password_field); 52 result->basic_data.fields.push_back(password_field);
52 result->wait_for_username = wait_for_username_before_autofill; 53 result->wait_for_username = wait_for_username_before_autofill;
53 54
55 if (preferred_match->original_signon_realm.empty()) {
56 result->preferred_realm = ASCIIToUTF16(preferred_match->signon_realm);
57 } else {
58 result->preferred_realm =
59 ASCIIToUTF16(preferred_match->original_signon_realm);
60 }
61
54 // Copy additional username/value pairs. 62 // Copy additional username/value pairs.
55 content::PasswordFormMap::const_iterator iter; 63 content::PasswordFormMap::const_iterator iter;
56 for (iter = matches.begin(); iter != matches.end(); iter++) { 64 for (iter = matches.begin(); iter != matches.end(); iter++) {
57 if (iter->second != preferred_match) 65 if (iter->second != preferred_match) {
58 result->additional_logins[iter->first] = iter->second->password_value; 66 PasswordAndRealm value;
67 value.password = iter->second->password_value;
68 if (iter->second->original_signon_realm.empty())
69 value.realm = ASCIIToUTF16(iter->second->signon_realm);
70 else
71 value.realm = ASCIIToUTF16(iter->second->original_signon_realm);
72 result->additional_logins[iter->first] = value;
73 }
59 if (enable_other_possible_usernames && 74 if (enable_other_possible_usernames &&
60 !iter->second->other_possible_usernames.empty()) { 75 !iter->second->other_possible_usernames.empty()) {
61 // Note that there may be overlap between other_possible_usernames and 76 // Note that there may be overlap between other_possible_usernames and
62 // other saved usernames or with other other_possible_usernames. For now 77 // other saved usernames or with other other_possible_usernames. For now
63 // we will ignore this overlap as it should be a rare occurence. We may 78 // we will ignore this overlap as it should be a rare occurence. We may
64 // want to revisit this in the future. 79 // want to revisit this in the future.
65 UsernamesCollectionKey key; 80 UsernamesCollectionKey key;
66 key.username = iter->first; 81 key.username = iter->first;
67 key.password = iter->second->password_value; 82 key.password = iter->second->password_value;
68 result->other_possible_usernames[key] = 83 result->other_possible_usernames[key] =
69 iter->second->other_possible_usernames; 84 iter->second->other_possible_usernames;
70 } 85 }
71 } 86 }
72 } 87 }
73 88
74 } // namespace autofill 89 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698