Chromium Code Reviews| Index: components/password_manager/content/browser/credential_manager_dispatcher.cc |
| diff --git a/components/password_manager/content/browser/credential_manager_dispatcher.cc b/components/password_manager/content/browser/credential_manager_dispatcher.cc |
| index 8d20793c37bd2f03ac8295590114d1b35d7b8ddc..0f5141aa9de543ad027ebf82c2880d2fecb9f198 100644 |
| --- a/components/password_manager/content/browser/credential_manager_dispatcher.cc |
| +++ b/components/password_manager/content/browser/credential_manager_dispatcher.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/bind.h" |
| #include "base/memory/scoped_vector.h" |
| +#include "base/prefs/pref_service.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "components/autofill/core/common/password_form.h" |
| @@ -236,8 +237,10 @@ void CredentialManagerDispatcher::OnNotifySignedIn( |
| void CredentialManagerDispatcher::OnProvisionalSaveComplete() { |
| DCHECK(form_manager_); |
| - client_->PromptUserToSavePassword( |
| - form_manager_.Pass(), CredentialSourceType::CREDENTIAL_SOURCE_API); |
| + if (IsSavingEnabledForCurrentPage() && !form_manager_->IsBlacklisted()) { |
| + client_->PromptUserToSavePassword( |
| + form_manager_.Pass(), CredentialSourceType::CREDENTIAL_SOURCE_API); |
| + } |
| } |
| void CredentialManagerDispatcher::OnNotifySignedOut(int request_id) { |
| @@ -302,8 +305,11 @@ PasswordStore* CredentialManagerDispatcher::GetPasswordStore() { |
| } |
| bool CredentialManagerDispatcher::IsSavingEnabledForCurrentPage() const { |
|
vabr (Chromium)
2015/03/30 10:58:42
Currently, this duplicates PasswordManager::IsSavi
melandory
2015/04/07 13:14:13
Done.
|
| - // TODO(vasilii): add more, see http://crbug.com/450583. |
| - return !client_->IsOffTheRecord(); |
| + bool is_saving_enabled = client_->GetPrefs()->GetBoolean( |
| + password_manager::prefs::kPasswordManagerSavingEnabled); |
| + return is_saving_enabled && !client_->IsOffTheRecord() && |
| + !client_->DidLastPageLoadEncounterSSLErrors() && |
| + client_->IsPasswordManagerEnabledForCurrentPage(); |
| } |
| bool CredentialManagerDispatcher::IsZeroClickAllowed() const { |