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

Side by Side Diff: components/password_manager/core/browser/password_manager.cc

Issue 870513002: [PasswordManager] Improve detection of ignorable change password forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed breakage. Created 5 years, 10 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 "components/password_manager/core/browser/password_manager.h" 5 #include "components/password_manager/core/browser/password_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // instances for UMA. 227 // instances for UMA.
228 bool has_found_matching_managers_which_were_not_ready = false; 228 bool has_found_matching_managers_which_were_not_ready = false;
229 for (ScopedVector<PasswordFormManager>::iterator iter = 229 for (ScopedVector<PasswordFormManager>::iterator iter =
230 pending_login_managers_.begin(); 230 pending_login_managers_.begin();
231 iter != pending_login_managers_.end(); ++iter) { 231 iter != pending_login_managers_.end(); ++iter) {
232 PasswordFormManager::MatchResultMask result = (*iter)->DoesManage(form); 232 PasswordFormManager::MatchResultMask result = (*iter)->DoesManage(form);
233 233
234 if (result == PasswordFormManager::RESULT_NO_MATCH) 234 if (result == PasswordFormManager::RESULT_NO_MATCH)
235 continue; 235 continue;
236 236
237 if ((*iter)->IsIgnorableChangePasswordForm()) {
238 if (logger)
239 logger->LogMessage(Logger::STRING_CHANGE_PASSWORD_FORM);
240 continue;
241 }
242
243 if (!(*iter)->HasCompletedMatching()) { 237 if (!(*iter)->HasCompletedMatching()) {
244 has_found_matching_managers_which_were_not_ready = true; 238 has_found_matching_managers_which_were_not_ready = true;
245 continue; 239 continue;
246 } 240 }
247 241
248 if (result == PasswordFormManager::RESULT_COMPLETE_MATCH) { 242 if (result == PasswordFormManager::RESULT_COMPLETE_MATCH) {
249 // If we find a manager that exactly matches the submitted form including 243 // If we find a manager that exactly matches the submitted form including
250 // the action URL, exit the loop. 244 // the action URL, exit the loop.
251 if (logger) 245 if (logger)
252 logger->LogMessage(Logger::STRING_EXACT_MATCH); 246 logger->LogMessage(Logger::STRING_EXACT_MATCH);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 310 }
317 PasswordFormManager::OtherPossibleUsernamesAction action = 311 PasswordFormManager::OtherPossibleUsernamesAction action =
318 PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES; 312 PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES;
319 if (OtherPossibleUsernamesEnabled()) 313 if (OtherPossibleUsernamesEnabled())
320 action = PasswordFormManager::ALLOW_OTHER_POSSIBLE_USERNAMES; 314 action = PasswordFormManager::ALLOW_OTHER_POSSIBLE_USERNAMES;
321 if (logger) { 315 if (logger) {
322 logger->LogBoolean( 316 logger->LogBoolean(
323 Logger::STRING_IGNORE_POSSIBLE_USERNAMES, 317 Logger::STRING_IGNORE_POSSIBLE_USERNAMES,
324 action == PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); 318 action == PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
325 } 319 }
326 manager->ProvisionallySave(provisionally_saved_form, action); 320 if (!manager->ProvisionallySave(provisionally_saved_form, action)) {
321 if (logger) {
322 logger->LogPasswordForm(Logger::STRING_CHANGE_PASSWORD_FORM,
323 provisionally_saved_form);
324 }
325 return;
326 }
327
327 provisional_save_manager_.swap(manager); 328 provisional_save_manager_.swap(manager);
328 329
329 // Cache the user-visible URL (i.e., the one seen in the omnibox). Once the 330 // Cache the user-visible URL (i.e., the one seen in the omnibox). Once the
330 // post-submit navigation concludes, we compare the landing URL against the 331 // post-submit navigation concludes, we compare the landing URL against the
331 // cached and report the difference through UMA. 332 // cached and report the difference through UMA.
332 main_frame_url_ = client_->GetMainFrameURL(); 333 main_frame_url_ = client_->GetMainFrameURL();
333 } 334 }
334 335
335 void PasswordManager::RecordFailure(ProvisionalSaveFailure failure, 336 void PasswordManager::RecordFailure(ProvisionalSaveFailure failure,
336 const GURL& form_origin, 337 const GURL& form_origin,
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 observers_, 688 observers_,
688 OnAutofillDataAvailable(preferred_match.username_value, 689 OnAutofillDataAvailable(preferred_match.username_value,
689 preferred_match.password_value)); 690 preferred_match.password_value));
690 break; 691 break;
691 } 692 }
692 693
693 client_->PasswordWasAutofilled(best_matches); 694 client_->PasswordWasAutofilled(best_matches);
694 } 695 }
695 696
696 } // namespace password_manager 697 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698