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 "chrome/browser/password_manager/password_form_manager.h" | 5 #include "chrome/browser/password_manager/password_form_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 pending_credentials_.other_possible_usernames = | 231 pending_credentials_.other_possible_usernames = |
232 credentials.other_possible_usernames; | 232 credentials.other_possible_usernames; |
233 } | 233 } |
234 | 234 |
235 pending_credentials_.action = credentials.action; | 235 pending_credentials_.action = credentials.action; |
236 // If the user selected credentials we autofilled from a PasswordForm | 236 // If the user selected credentials we autofilled from a PasswordForm |
237 // that contained no action URL (IE6/7 imported passwords, for example), | 237 // that contained no action URL (IE6/7 imported passwords, for example), |
238 // bless it with the action URL from the observed form. See bug 1107719. | 238 // bless it with the action URL from the observed form. See bug 1107719. |
239 if (pending_credentials_.action.is_empty()) | 239 if (pending_credentials_.action.is_empty()) |
240 pending_credentials_.action = observed_form_.action; | 240 pending_credentials_.action = observed_form_.action; |
| 241 // Similarly, bless incomplete credentials with *_element info. |
| 242 if (pending_credentials_.password_element.empty()) |
| 243 pending_credentials_.password_element = observed_form_.password_element; |
| 244 if (pending_credentials_.username_element.empty()) |
| 245 pending_credentials_.username_element = observed_form_.username_element; |
| 246 if (pending_credentials_.submit_element.empty()) |
| 247 pending_credentials_.submit_element = observed_form_.submit_element; |
241 | 248 |
242 pending_credentials_.password_value = credentials.password_value; | 249 pending_credentials_.password_value = credentials.password_value; |
243 pending_credentials_.preferred = credentials.preferred; | 250 pending_credentials_.preferred = credentials.preferred; |
244 | 251 |
245 if (has_generated_password_) | 252 if (has_generated_password_) |
246 pending_credentials_.type = PasswordForm::TYPE_GENERATED; | 253 pending_credentials_.type = PasswordForm::TYPE_GENERATED; |
247 } | 254 } |
248 | 255 |
249 void PasswordFormManager::Save() { | 256 void PasswordFormManager::Save() { |
250 DCHECK_EQ(state_, POST_MATCHING_PHASE); | 257 DCHECK_EQ(state_, POST_MATCHING_PHASE); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 return score; | 644 return score; |
638 } | 645 } |
639 | 646 |
640 void PasswordFormManager::SubmitPassed() { | 647 void PasswordFormManager::SubmitPassed() { |
641 submit_result_ = kSubmitResultPassed; | 648 submit_result_ = kSubmitResultPassed; |
642 } | 649 } |
643 | 650 |
644 void PasswordFormManager::SubmitFailed() { | 651 void PasswordFormManager::SubmitFailed() { |
645 submit_result_ = kSubmitResultFailed; | 652 submit_result_ = kSubmitResultFailed; |
646 } | 653 } |
OLD | NEW |