Commit c924d58c authored by Vadym Doroshenko's avatar Vadym Doroshenko Committed by Commit Bot

Remove unused code in password_manager.h/cc.

Bug: None
Change-Id: Ib80295f0aaa4bb2001c2ffd28d78924030b06e4f
Reviewed-on: https://chromium-review.googlesource.com/1042289Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555733}
parent a6594bc8
...@@ -438,11 +438,6 @@ bool PasswordManager::IsPasswordFieldDetectedOnPage() { ...@@ -438,11 +438,6 @@ bool PasswordManager::IsPasswordFieldDetectedOnPage() {
return !pending_login_managers_.empty(); return !pending_login_managers_.empty();
} }
void PasswordManager::AddSubmissionCallback(
const PasswordSubmittedCallback& callback) {
submission_callbacks_.push_back(callback);
}
void PasswordManager::AddObserverAndDeliverCredentials( void PasswordManager::AddObserverAndDeliverCredentials(
LoginModelObserver* observer, LoginModelObserver* observer,
const PasswordForm& observed_form) { const PasswordForm& observed_form) {
...@@ -472,10 +467,6 @@ void PasswordManager::OnPasswordFormSubmitted( ...@@ -472,10 +467,6 @@ void PasswordManager::OnPasswordFormSubmitted(
password_manager::PasswordManagerDriver* driver, password_manager::PasswordManagerDriver* driver,
const PasswordForm& password_form) { const PasswordForm& password_form) {
ProvisionallySavePassword(password_form, driver); ProvisionallySavePassword(password_form, driver);
for (size_t i = 0; i < submission_callbacks_.size(); ++i) {
submission_callbacks_[i].Run(password_form);
}
pending_login_managers_.clear(); pending_login_managers_.clear();
} }
......
...@@ -56,14 +56,6 @@ class PasswordManager : public LoginModel { ...@@ -56,14 +56,6 @@ class PasswordManager : public LoginModel {
explicit PasswordManager(PasswordManagerClient* client); explicit PasswordManager(PasswordManagerClient* client);
~PasswordManager() override; ~PasswordManager() override;
typedef base::Callback<void(const autofill::PasswordForm&)>
PasswordSubmittedCallback;
// There is no corresponding remove function as currently all of the
// owners of these callbacks have sufficient lifetimes so that the callbacks
// should always be valid when called.
void AddSubmissionCallback(const PasswordSubmittedCallback& callback);
// Called by a PasswordFormManager when it decides a form can be autofilled // Called by a PasswordFormManager when it decides a form can be autofilled
// on the page. // on the page.
void Autofill( void Autofill(
...@@ -301,9 +293,6 @@ class PasswordManager : public LoginModel { ...@@ -301,9 +293,6 @@ class PasswordManager : public LoginModel {
// notification in const member functions. // notification in const member functions.
mutable base::ObserverList<LoginModelObserver> observers_; mutable base::ObserverList<LoginModelObserver> observers_;
// Callbacks to be notified when a password form has been submitted.
std::vector<PasswordSubmittedCallback> submission_callbacks_;
// Records all visible forms seen during a page load, in all frames of the // Records all visible forms seen during a page load, in all frames of the
// page. When the page stops loading, the password manager checks if one of // page. When the page stops loading, the password manager checks if one of
// the recorded forms matches the login form from the previous page // the recorded forms matches the login form from the previous page
......
...@@ -265,13 +265,6 @@ class PasswordManagerTest : public testing::Test { ...@@ -265,13 +265,6 @@ class PasswordManagerTest : public testing::Test {
manager()->OnPasswordFormSubmitted(&driver_, form); manager()->OnPasswordFormSubmitted(&driver_, form);
} }
PasswordManager::PasswordSubmittedCallback SubmissionCallback() {
return base::Bind(&PasswordManagerTest::FormSubmitted,
base::Unretained(this));
}
void FormSubmitted(const PasswordForm& form) { submitted_form_ = form; }
const GURL test_url_; const GURL test_url_;
base::MessageLoop message_loop_; base::MessageLoop message_loop_;
scoped_refptr<MockPasswordStore> store_; scoped_refptr<MockPasswordStore> store_;
...@@ -753,18 +746,6 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { ...@@ -753,18 +746,6 @@ TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) {
manager()->OnPasswordFormsParsed(&driver_, observed); manager()->OnPasswordFormsParsed(&driver_, observed);
} }
TEST_F(PasswordManagerTest, SubmissionCallbackTest) {
manager()->AddSubmissionCallback(SubmissionCallback());
PasswordForm form = MakeSimpleForm();
// Prefs are needed for failure logging about having no matching observed
// form.
EXPECT_CALL(client_, GetPrefs()).WillRepeatedly(Return(nullptr));
EXPECT_CALL(client_, IsSavingAndFillingEnabledForCurrentPage())
.WillRepeatedly(Return(true));
OnPasswordFormSubmitted(form);
EXPECT_EQ(form, submitted_form_);
}
TEST_F(PasswordManagerTest, PasswordFormReappearance) { TEST_F(PasswordManagerTest, PasswordFormReappearance) {
// If the password form reappears after submit, PasswordManager should deduce // If the password form reappears after submit, PasswordManager should deduce
// that the login failed and not offer saving. // that the login failed and not offer saving.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment