Chromium Code Reviews| Index: components/password_manager/core/browser/password_manager.cc |
| diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc |
| index dc06e20c4e8d73bb9c0a8fd03124d6a5b86714f6..9cda00edd51a5383da0800b073c6072125c388a3 100644 |
| --- a/components/password_manager/core/browser/password_manager.cc |
| +++ b/components/password_manager/core/browser/password_manager.cc |
| @@ -271,6 +271,13 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
| return; |
| } |
| + if (ShouldBlockPasswordForSameOriginButDifferentScheme(form)) { |
| + if (logger) |
| + logger->LogMessage( |
| + Logger::STRING_BLOCK_PASSWORD_SAME_ORIGIN_INSECURE_SCHEME); |
| + return; |
| + } |
| + |
| auto matched_manager_it = pending_login_managers_.end(); |
| PasswordFormManager::MatchResultMask current_match_result = |
| PasswordFormManager::RESULT_NO_MATCH; |
| @@ -560,6 +567,14 @@ bool PasswordManager::CanProvisionalManagerSave() { |
| return true; |
| } |
| +bool PasswordManager::ShouldBlockPasswordForSameOriginButDifferentScheme( |
| + const PasswordForm& form) const { |
| + const GURL& old_origin = main_frame_url_.GetOrigin(); |
| + const GURL& new_origin = form.origin.GetOrigin(); |
| + return URLsEqualUpToScheme(old_origin, new_origin) && |
| + old_origin != new_origin && !new_origin.SchemeIsCryptographic(); |
|
jdoerrie
2017/01/04 16:55:18
Using |provisional_save_manager_| does not work he
vasilii
2017/01/05 11:26:11
The problem with implementing it in PasswordManage
jdoerrie
2017/01/05 18:11:30
Discussed offline, the current solution is not ide
|
| +} |
| + |
| bool PasswordManager::ShouldPromptUserToSavePassword() const { |
| return !client_->IsAutomaticPasswordSavingEnabled() && |
| (provisional_save_manager_->IsNewLogin() || |