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

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 palmer 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 25 matching lines...) Expand all
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 if (preferred_match->is_psl_origin_match) {
55 result->preferred_realm =
56 ASCIIToUTF16(preferred_match->original_signon_realm);
57 } else {
58 result->preferred_realm = ASCIIToUTF16(preferred_match->signon_realm);
59 }
60
53 // Copy additional username/value pairs. 61 // Copy additional username/value pairs.
54 content::PasswordFormMap::const_iterator iter; 62 content::PasswordFormMap::const_iterator iter;
55 for (iter = matches.begin(); iter != matches.end(); iter++) { 63 for (iter = matches.begin(); iter != matches.end(); iter++) {
56 if (iter->second != preferred_match) 64 if (iter->second != preferred_match) {
57 result->additional_logins[iter->first] = iter->second->password_value; 65 PasswordAndRealm value;
66 value.password = iter->second->password_value;
67 if (iter->second->is_psl_origin_match) {
68 value.realm = ASCIIToUTF16(iter->second->original_signon_realm);
69 } else {
70 value.realm = ASCIIToUTF16(iter->second->signon_realm);
71 }
Ilya Sherman 2013/06/07 23:47:56 nit: No longer a need for curlies.
nyquist 2013/06/11 03:36:01 Done.
72 result->additional_logins[iter->first] = value;
73 }
58 if (enable_other_possible_usernames && 74 if (enable_other_possible_usernames &&
59 !iter->second->other_possible_usernames.empty()) { 75 !iter->second->other_possible_usernames.empty()) {
60 // Note that there may be overlap between other_possible_usernames and 76 // Note that there may be overlap between other_possible_usernames and
61 // other saved usernames or with other other_possible_usernames. For now 77 // 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 78 // we will ignore this overlap as it should be a rare occurence. We may
63 // want to revisit this in the future. 79 // want to revisit this in the future.
64 UsernamesCollectionKey key; 80 UsernamesCollectionKey key;
65 key.username = iter->first; 81 key.username = iter->first;
66 key.password = iter->second->password_value; 82 key.password = iter->second->password_value;
67 result->other_possible_usernames[key] = 83 result->other_possible_usernames[key] =
68 iter->second->other_possible_usernames; 84 iter->second->other_possible_usernames;
69 } 85 }
70 } 86 }
71 } 87 }
72 88
73 } // namespace autofill 89 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698