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/password_manager/core/browser/password_form_manager.h" | 5 #include "components/password_manager/core/browser/password_form_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 bool origins_match = form.origin == observed_form_.origin; | 154 bool origins_match = form.origin == observed_form_.origin; |
155 // If this is a replay of the same form in the case a user entered an invalid | 155 // If this is a replay of the same form in the case a user entered an invalid |
156 // password, the origin of the new form may equal the action of the "first" | 156 // password, the origin of the new form may equal the action of the "first" |
157 // form instead. | 157 // form instead. |
158 origins_match = origins_match || (form.origin == observed_form_.action); | 158 origins_match = origins_match || (form.origin == observed_form_.action); |
159 // Otherwise, if action hosts are the same, the old URL scheme is HTTP while | 159 // Otherwise, if action hosts are the same, the old URL scheme is HTTP while |
160 // the new one is HTTPS, and the new path equals to or extends the old path, | 160 // the new one is HTTPS, and the new path equals to or extends the old path, |
161 // we also consider the actions a match. This is to accommodate cases where | 161 // we also consider the actions a match. This is to accommodate cases where |
162 // the original login form is on an HTTP page, but a failed login attempt | 162 // the original login form is on an HTTP page, but a failed login attempt |
163 // redirects to HTTPS (as in http://example.org -> https://example.org/auth). | 163 // redirects to HTTPS (as in http://example.org -> https://example.org/auth). |
164 if (!origins_match && !observed_form_.origin.SchemeIsSecure() && | 164 if (!origins_match && !observed_form_.origin.SchemeIsCryptographic() && |
165 form.origin.SchemeIsSecure()) { | 165 form.origin.SchemeIsCryptographic()) { |
166 const std::string& old_path = observed_form_.origin.path(); | 166 const std::string& old_path = observed_form_.origin.path(); |
167 const std::string& new_path = form.origin.path(); | 167 const std::string& new_path = form.origin.path(); |
168 origins_match = | 168 origins_match = |
169 observed_form_.origin.host() == form.origin.host() && | 169 observed_form_.origin.host() == form.origin.host() && |
170 observed_form_.origin.port() == form.origin.port() && | 170 observed_form_.origin.port() == form.origin.port() && |
171 StartsWithASCII(new_path, old_path, /*case_sensitive=*/true); | 171 StartsWithASCII(new_path, old_path, /*case_sensitive=*/true); |
172 } | 172 } |
173 | 173 |
174 if (!origins_match) | 174 if (!origins_match) |
175 return result; | 175 return result; |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED); | 958 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMITTED); |
959 } | 959 } |
960 | 960 |
961 void PasswordFormManager::SubmitFailed() { | 961 void PasswordFormManager::SubmitFailed() { |
962 submit_result_ = kSubmitResultFailed; | 962 submit_result_ = kSubmitResultFailed; |
963 if (has_generated_password_) | 963 if (has_generated_password_) |
964 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED); | 964 LogPasswordGenerationSubmissionEvent(PASSWORD_SUBMISSION_FAILED); |
965 } | 965 } |
966 | 966 |
967 } // namespace password_manager | 967 } // namespace password_manager |
OLD | NEW |