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

Side by Side Diff: chrome/browser/password_manager/password_form_manager.cc

Issue 14811010: Add metadata to content::PasswordForm to keep track of the password usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 7 years, 7 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
OLDNEW
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
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;
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698