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_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 if (command_line->HasSwitch(switches::kEnableDropSyncCredential)) | 62 if (command_line->HasSwitch(switches::kEnableDropSyncCredential)) |
63 return true; | 63 return true; |
64 | 64 |
65 if (command_line->HasSwitch(switches::kDisableDropSyncCredential)) | 65 if (command_line->HasSwitch(switches::kDisableDropSyncCredential)) |
66 return false; | 66 return false; |
67 | 67 |
68 // Default to not saving. | 68 // Default to not saving. |
69 return group_name != "Disabled"; | 69 return group_name != "Disabled"; |
70 } | 70 } |
71 | 71 |
72 bool CompareURLContentsEqualIgnoreCase(const GURL& src, const GURL& dst) { | |
vabr (Chromium)
2014/08/21 14:54:12
nit: "Compare" seems superfluous in the function n
vabr (Chromium)
2014/08/21 14:54:12
Please spell out concretely that scheme is omitted
Pritam Nikam
2014/08/21 16:49:21
Done.
Pritam Nikam
2014/08/21 16:49:21
Done.
| |
73 return (base::StringToLowerASCII(src.GetContent()) == | |
74 base::StringToLowerASCII(dst.GetContent())); | |
75 } | |
76 | |
72 } // namespace | 77 } // namespace |
73 | 78 |
74 const char PasswordManager::kOtherPossibleUsernamesExperiment[] = | 79 const char PasswordManager::kOtherPossibleUsernamesExperiment[] = |
75 "PasswordManagerOtherPossibleUsernames"; | 80 "PasswordManagerOtherPossibleUsernames"; |
76 | 81 |
77 // static | 82 // static |
78 void PasswordManager::RegisterProfilePrefs( | 83 void PasswordManager::RegisterProfilePrefs( |
79 user_prefs::PrefRegistrySyncable* registry) { | 84 user_prefs::PrefRegistrySyncable* registry) { |
80 registry->RegisterBooleanPref( | 85 registry->RegisterBooleanPref( |
81 prefs::kPasswordManagerSavingEnabled, | 86 prefs::kPasswordManagerSavingEnabled, |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 } | 435 } |
431 | 436 |
432 // Record all visible forms from the frame. | 437 // Record all visible forms from the frame. |
433 all_visible_forms_.insert(all_visible_forms_.end(), | 438 all_visible_forms_.insert(all_visible_forms_.end(), |
434 visible_forms.begin(), | 439 visible_forms.begin(), |
435 visible_forms.end()); | 440 visible_forms.end()); |
436 | 441 |
437 // If we see the login form again, then the login failed. | 442 // If we see the login form again, then the login failed. |
438 if (did_stop_loading) { | 443 if (did_stop_loading) { |
439 for (size_t i = 0; i < all_visible_forms_.size(); ++i) { | 444 for (size_t i = 0; i < all_visible_forms_.size(); ++i) { |
440 // TODO(vabr): The similarity check is just action equality for now. If it | 445 // TODO(vabr): The similarity check is just on case and scheme ignored |
vabr (Chromium)
2014/08/21 14:54:12
I'm not a native English speaker, but the first se
Pritam Nikam
2014/08/21 16:49:21
Done.
| |
441 // becomes more complex, it may make sense to consider modifying and using | 446 // action URL equality for now. If it becomes more complex, it may make |
442 // PasswordFormManager::DoesManage for it. | 447 // sense to consider modifying and using PasswordFormManager::DoesManage |
448 // for it. | |
443 if (all_visible_forms_[i].action.is_valid() && | 449 if (all_visible_forms_[i].action.is_valid() && |
444 provisional_save_manager_->pending_credentials().action == | 450 CompareURLContentsEqualIgnoreCase( |
vabr (Chromium)
2014/08/21 14:54:12
Please do not allow mixing of arbitrary schemes, j
Pritam Nikam
2014/08/21 16:49:21
Done.
jww
2014/08/21 19:19:13
This lgtm from a security perspective but is certa
| |
445 all_visible_forms_[i].action) { | 451 provisional_save_manager_->pending_credentials().action, |
452 all_visible_forms_[i].action)) { | |
446 if (logger) { | 453 if (logger) { |
447 logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_REAPPEARED, | 454 logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_REAPPEARED, |
448 visible_forms[i]); | 455 visible_forms[i]); |
449 logger->LogMessage(Logger::STRING_DECISION_DROP); | 456 logger->LogMessage(Logger::STRING_DECISION_DROP); |
450 } | 457 } |
451 provisional_save_manager_->SubmitFailed(); | 458 provisional_save_manager_->SubmitFailed(); |
452 provisional_save_manager_.reset(); | 459 provisional_save_manager_.reset(); |
453 // Clear all_visible_forms_ once we found the match. | 460 // Clear all_visible_forms_ once we found the match. |
454 all_visible_forms_.clear(); | 461 all_visible_forms_.clear(); |
455 return; | 462 return; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 observers_, | 568 observers_, |
562 OnAutofillDataAvailable(preferred_match.username_value, | 569 OnAutofillDataAvailable(preferred_match.username_value, |
563 preferred_match.password_value)); | 570 preferred_match.password_value)); |
564 break; | 571 break; |
565 } | 572 } |
566 | 573 |
567 client_->PasswordWasAutofilled(best_matches); | 574 client_->PasswordWasAutofilled(best_matches); |
568 } | 575 } |
569 | 576 |
570 } // namespace password_manager | 577 } // namespace password_manager |
OLD | NEW |