Chromium Code Reviews| 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/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 DCHECK(!IsNewLogin() && pending_credentials_.preferred); | 441 DCHECK(!IsNewLogin() && pending_credentials_.preferred); |
| 442 DCHECK(!profile_->IsOffTheRecord()); | 442 DCHECK(!profile_->IsOffTheRecord()); |
| 443 | 443 |
| 444 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( | 444 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( |
| 445 profile_, Profile::IMPLICIT_ACCESS); | 445 profile_, Profile::IMPLICIT_ACCESS); |
| 446 if (!password_store) { | 446 if (!password_store) { |
| 447 NOTREACHED(); | 447 NOTREACHED(); |
| 448 return; | 448 return; |
| 449 } | 449 } |
| 450 | 450 |
| 451 // Update metadata. | |
| 452 pending_credentials_.times_used++; | |
|
Ilya Sherman
2013/05/14 07:25:34
nit: Please use the pre-increment operator rather
Garrett Casto
2013/05/14 20:17:58
Done.
| |
| 453 | |
| 451 UpdatePreferredLoginState(password_store); | 454 UpdatePreferredLoginState(password_store); |
| 452 | 455 |
| 453 // Update the new preferred login. | 456 // Update the new preferred login. |
| 454 // Note origin.spec().length > signon_realm.length implies the origin has a | 457 // Note origin.spec().length > signon_realm.length implies the origin has a |
| 455 // path, since signon_realm is a prefix of origin for HTML password forms. | 458 // path, since signon_realm is a prefix of origin for HTML password forms. |
| 456 if ((observed_form_.scheme == PasswordForm::SCHEME_HTML) && | 459 if ((observed_form_.scheme == PasswordForm::SCHEME_HTML) && |
| 457 (observed_form_.origin.spec().length() > | 460 (observed_form_.origin.spec().length() > |
| 458 observed_form_.signon_realm.length()) && | 461 observed_form_.signon_realm.length()) && |
| 459 (observed_form_.signon_realm == pending_credentials_.origin.spec())) { | 462 (observed_form_.signon_realm == pending_credentials_.origin.spec())) { |
| 460 // The user logged in successfully with one of our autofilled logins on a | 463 // The user logged in successfully with one of our autofilled logins on a |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 536 |
| 534 void PasswordFormManager::SubmitFailed() { | 537 void PasswordFormManager::SubmitFailed() { |
| 535 submit_result_ = kSubmitResultFailed; | 538 submit_result_ = kSubmitResultFailed; |
| 536 } | 539 } |
| 537 | 540 |
| 538 void PasswordFormManager::SendNotBlacklistedToRenderer() { | 541 void PasswordFormManager::SendNotBlacklistedToRenderer() { |
| 539 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); | 542 content::RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 540 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), | 543 host->Send(new AutofillMsg_FormNotBlacklisted(host->GetRoutingID(), |
| 541 observed_form_)); | 544 observed_form_)); |
| 542 } | 545 } |
| OLD | NEW |