OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/password_autofill_manager.h" | 5 #include "components/autofill/browser/password_autofill_manager.h" |
6 #include "components/autofill/common/autofill_messages.h" | 6 #include "components/autofill/common/autofill_messages.h" |
7 #include "content/public/browser/render_view_host.h" | 7 #include "content/public/browser/render_view_host.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 bool PasswordAutofillManager::WillFillUserNameAndPassword( | 57 bool PasswordAutofillManager::WillFillUserNameAndPassword( |
58 const base::string16& current_username, | 58 const base::string16& current_username, |
59 const PasswordFormFillData& fill_data) { | 59 const PasswordFormFillData& fill_data) { |
60 // Look for any suitable matches to current field text. | 60 // Look for any suitable matches to current field text. |
61 if (fill_data.basic_data.fields[0].value == current_username) | 61 if (fill_data.basic_data.fields[0].value == current_username) |
62 return true; | 62 return true; |
63 | 63 |
64 // Scan additional logins for a match. | 64 // Scan additional logins for a match. |
65 for (PasswordFormFillData::LoginCollection::const_iterator iter = | 65 for (PasswordFormFillData::LoginCollection::const_iterator iter = |
66 fill_data.additional_logins.begin(); | 66 fill_data.additional_logins_passwords.begin(); |
67 iter != fill_data.additional_logins.end(); ++iter) { | 67 iter != fill_data.additional_logins_passwords.end(); ++iter) { |
68 if (iter->first == current_username) | 68 if (iter->first == current_username) |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 for (PasswordFormFillData::UsernamesCollection::const_iterator usernames_iter | 72 for (PasswordFormFillData::UsernamesCollection::const_iterator usernames_iter |
73 = fill_data.other_possible_usernames.begin(); | 73 = fill_data.other_possible_usernames.begin(); |
74 usernames_iter != fill_data.other_possible_usernames.end(); | 74 usernames_iter != fill_data.other_possible_usernames.end(); |
75 ++usernames_iter) { | 75 ++usernames_iter) { |
76 for (size_t i = 0; i < usernames_iter->second.size(); ++i) { | 76 for (size_t i = 0; i < usernames_iter->second.size(); ++i) { |
77 if (usernames_iter->second[i] == current_username) | 77 if (usernames_iter->second[i] == current_username) |
78 return true; | 78 return true; |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
85 bool PasswordAutofillManager::FindLoginInfo( | 85 bool PasswordAutofillManager::FindLoginInfo( |
86 const FormFieldData& field, | 86 const FormFieldData& field, |
87 PasswordFormFillData* found_password) { | 87 PasswordFormFillData* found_password) { |
88 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); | 88 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(field); |
89 if (iter == login_to_password_info_.end()) | 89 if (iter == login_to_password_info_.end()) |
90 return false; | 90 return false; |
91 | 91 |
92 *found_password = iter->second; | 92 *found_password = iter->second; |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 } // namespace autofill | 96 } // namespace autofill |
OLD | NEW |