Commit 95d6100e authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Clean up ManagePasswordsBubbleModel after removing Cocoa bubble.

The class contained some functions used only on Mac. With this CL the "Update password" bubble is gone.

Bug: 832676
Change-Id: Ifebaa0edcd445ee64605fd85fc6b2b24a2ba6646
Reviewed-on: https://chromium-review.googlesource.com/1065973
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561475}
parent 6e3209ad
...@@ -358,7 +358,9 @@ void BubbleObserver::AcceptSavePrompt() const { ...@@ -358,7 +358,9 @@ void BubbleObserver::AcceptSavePrompt() const {
void BubbleObserver::AcceptUpdatePrompt( void BubbleObserver::AcceptUpdatePrompt(
const autofill::PasswordForm& form) const { const autofill::PasswordForm& form) const {
ASSERT_TRUE(IsUpdatePromptAvailable()); ASSERT_TRUE(IsUpdatePromptAvailable());
passwords_ui_controller_->UpdatePassword(form); passwords_ui_controller_->SavePassword(
passwords_ui_controller_->GetPendingPassword().username_value,
passwords_ui_controller_->GetPendingPassword().password_value);
EXPECT_FALSE(IsUpdatePromptAvailable()); EXPECT_FALSE(IsUpdatePromptAvailable());
} }
......
...@@ -380,20 +380,6 @@ void ManagePasswordsBubbleModel::OnSaveClicked() { ...@@ -380,20 +380,6 @@ void ManagePasswordsBubbleModel::OnSaveClicked() {
} }
} }
void ManagePasswordsBubbleModel::OnUpdateClicked(
const autofill::PasswordForm& password_form) {
if (delegate_)
delegate_->UpdatePassword(password_form);
}
void ManagePasswordsBubbleModel::OnDoneClicked() {
interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_DONE);
}
void ManagePasswordsBubbleModel::OnOKClicked() {
interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_OK);
}
void ManagePasswordsBubbleModel::OnManageClicked() { void ManagePasswordsBubbleModel::OnManageClicked() {
interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_MANAGE); interaction_keeper_->set_dismissal_reason(metrics_util::CLICKED_MANAGE);
if (delegate_) if (delegate_)
...@@ -466,11 +452,6 @@ content::WebContents* ManagePasswordsBubbleModel::GetWebContents() const { ...@@ -466,11 +452,6 @@ content::WebContents* ManagePasswordsBubbleModel::GetWebContents() const {
return delegate_ ? delegate_->GetWebContents() : nullptr; return delegate_ ? delegate_->GetWebContents() : nullptr;
} }
bool ManagePasswordsBubbleModel::ShouldShowMultipleAccountUpdateUI() const {
return state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE &&
local_credentials_.size() > 1;
}
bool ManagePasswordsBubbleModel::IsCurrentStateUpdate() const { bool ManagePasswordsBubbleModel::IsCurrentStateUpdate() const {
DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || DCHECK(state_ == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
state_ == password_manager::ui::PENDING_PASSWORD_STATE); state_ == password_manager::ui::PENDING_PASSWORD_STATE);
......
...@@ -63,17 +63,6 @@ class ManagePasswordsBubbleModel { ...@@ -63,17 +63,6 @@ class ManagePasswordsBubbleModel {
// Called by the view code when the save/update button is clicked by the user. // Called by the view code when the save/update button is clicked by the user.
void OnSaveClicked(); void OnSaveClicked();
// Called by the view code when the update link is clicked by the user.
// TODO(vasilii): remove when the cocoa bubble is gone.
void OnUpdateClicked(const autofill::PasswordForm& password_form);
// Called by the view code when the "Done" button is clicked by the user.
// TODO(vasilii): remove when the cocoa bubble is gone.
void OnDoneClicked();
// TODO(vasilii): remove when the cocoa bubble is gone.
void OnOKClicked();
// Called by the view code when the manage button is clicked by the user. // Called by the view code when the manage button is clicked by the user.
void OnManageClicked(); void OnManageClicked();
...@@ -143,11 +132,6 @@ class ManagePasswordsBubbleModel { ...@@ -143,11 +132,6 @@ class ManagePasswordsBubbleModel {
Profile* GetProfile() const; Profile* GetProfile() const;
content::WebContents* GetWebContents() const; content::WebContents* GetWebContents() const;
// Returns true iff the multiple account selection prompt for account update
// should be presented.
// TODO(vasilii): remove when the cocoa bubble is gone.
bool ShouldShowMultipleAccountUpdateUI() const;
// The password bubble can switch its state between "save" and "update" // The password bubble can switch its state between "save" and "update"
// depending on the user input. |state_| only captures the correct state on // depending on the user input. |state_| only captures the correct state on
// creation. This method returns true iff the current state is "update". // creation. This method returns true iff the current state is "update".
......
...@@ -375,14 +375,6 @@ TEST_F(ManagePasswordsBubbleModelTest, ClickManage) { ...@@ -375,14 +375,6 @@ TEST_F(ManagePasswordsBubbleModelTest, ClickManage) {
DestroyModelExpectReason(password_manager::metrics_util::CLICKED_MANAGE); DestroyModelExpectReason(password_manager::metrics_util::CLICKED_MANAGE);
} }
TEST_F(ManagePasswordsBubbleModelTest, ClickDone) {
PretendManagingPasswords();
model()->OnDoneClicked();
EXPECT_EQ(password_manager::ui::MANAGE_STATE, model()->state());
DestroyModelExpectReason(password_manager::metrics_util::CLICKED_DONE);
}
TEST_F(ManagePasswordsBubbleModelTest, PopupAutoSigninToast) { TEST_F(ManagePasswordsBubbleModelTest, PopupAutoSigninToast) {
PretendAutoSigningIn(); PretendAutoSigningIn();
......
...@@ -428,24 +428,6 @@ void ManagePasswordsUIController::SavePassword(const base::string16& username, ...@@ -428,24 +428,6 @@ void ManagePasswordsUIController::SavePassword(const base::string16& username,
bubble_status_ = SHOWN_PENDING_ICON_UPDATE; bubble_status_ = SHOWN_PENDING_ICON_UPDATE;
} }
void ManagePasswordsUIController::UpdatePassword(
const autofill::PasswordForm& password_form) {
DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, GetState());
UMA_HISTOGRAM_BOOLEAN("PasswordManager.PasswordUpdatedWithManualFallback",
BubbleIsManualFallbackForSaving());
if (GetPasswordFormMetricsRecorder() && BubbleIsManualFallbackForSaving()) {
GetPasswordFormMetricsRecorder()->RecordDetailedUserAction(
password_manager::PasswordFormMetricsRecorder::DetailedUserAction::
kTriggeredManualFallbackForUpdating);
}
save_fallback_timer_.Stop();
UpdatePasswordInternal(password_form);
ClearPopUpFlagForBubble();
passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE);
UpdateBubbleAndIconVisibility();
}
void ManagePasswordsUIController::ChooseCredential( void ManagePasswordsUIController::ChooseCredential(
const autofill::PasswordForm& form, const autofill::PasswordForm& form,
password_manager::CredentialType credential_type) { password_manager::CredentialType credential_type) {
...@@ -533,13 +515,6 @@ void ManagePasswordsUIController::SavePasswordInternal() { ...@@ -533,13 +515,6 @@ void ManagePasswordsUIController::SavePasswordInternal() {
form_manager->Save(); form_manager->Save();
} }
void ManagePasswordsUIController::UpdatePasswordInternal(
const autofill::PasswordForm& password_form) {
password_manager::PasswordFormManagerForUI* form_manager =
passwords_data_.form_manager();
form_manager->Update(password_form);
}
void ManagePasswordsUIController::NeverSavePasswordInternal() { void ManagePasswordsUIController::NeverSavePasswordInternal() {
password_manager::PasswordFormManagerForUI* form_manager = password_manager::PasswordFormManagerForUI* form_manager =
passwords_data_.form_manager(); passwords_data_.form_manager();
......
...@@ -122,7 +122,6 @@ class ManagePasswordsUIController ...@@ -122,7 +122,6 @@ class ManagePasswordsUIController
void OnPasswordsRevealed() override; void OnPasswordsRevealed() override;
void SavePassword(const base::string16& username, void SavePassword(const base::string16& username,
const base::string16& password) override; const base::string16& password) override;
void UpdatePassword(const autofill::PasswordForm& password_form) override;
void ChooseCredential( void ChooseCredential(
const autofill::PasswordForm& form, const autofill::PasswordForm& form,
password_manager::CredentialType credential_type) override; password_manager::CredentialType credential_type) override;
...@@ -149,8 +148,6 @@ class ManagePasswordsUIController ...@@ -149,8 +148,6 @@ class ManagePasswordsUIController
// The pieces of saving and blacklisting passwords that interact with // The pieces of saving and blacklisting passwords that interact with
// FormManager, split off into internal functions for testing/mocking. // FormManager, split off into internal functions for testing/mocking.
virtual void SavePasswordInternal(); virtual void SavePasswordInternal();
virtual void UpdatePasswordInternal(
const autofill::PasswordForm& password_form);
virtual void NeverSavePasswordInternal(); virtual void NeverSavePasswordInternal();
// Called when a PasswordForm is autofilled, when a new PasswordForm is // Called when a PasswordForm is autofilled, when a new PasswordForm is
......
...@@ -111,8 +111,6 @@ class TestManagePasswordsUIController : public ManagePasswordsUIController { ...@@ -111,8 +111,6 @@ class TestManagePasswordsUIController : public ManagePasswordsUIController {
private: private:
void UpdateBubbleAndIconVisibility() override; void UpdateBubbleAndIconVisibility() override;
void SavePasswordInternal() override {} void SavePasswordInternal() override {}
void UpdatePasswordInternal(
const autofill::PasswordForm& password_form) override {}
void NeverSavePasswordInternal() override; void NeverSavePasswordInternal() override;
bool ShowAuthenticationDialog() override { return true; } bool ShowAuthenticationDialog() override { return true; }
...@@ -901,12 +899,14 @@ TEST_F(ManagePasswordsUIControllerTest, PasswordUpdated) { ...@@ -901,12 +899,14 @@ TEST_F(ManagePasswordsUIControllerTest, PasswordUpdated) {
controller()->OnUpdatePasswordSubmitted(std::move(test_form_manager)); controller()->OnUpdatePasswordSubmitted(std::move(test_form_manager));
ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE); ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
EXPECT_CALL(*controller(), OnUpdateBubbleAndIconVisibility());
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
controller()->UpdatePassword(autofill::PasswordForm()); controller()->SavePassword(test_local_form().username_value,
test_local_form().password_value);
ExpectIconStateIs(password_manager::ui::MANAGE_STATE); ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
histogram_tester.ExpectUniqueSample( histogram_tester.ExpectUniqueSample(
"PasswordManager.PasswordUpdatedWithManualFallback", false, 1); "PasswordManager.PasswordSavedWithManualFallback", false, 1);
EXPECT_CALL(*controller(), OnUpdateBubbleAndIconVisibility());
controller()->OnBubbleHidden();
} }
TEST_F(ManagePasswordsUIControllerTest, SavePendingStatePasswordAutofilled) { TEST_F(ManagePasswordsUIControllerTest, SavePendingStatePasswordAutofilled) {
...@@ -971,12 +971,8 @@ TEST_F(ManagePasswordsUIControllerTest, ManualFallbackForSaving_UseFallback) { ...@@ -971,12 +971,8 @@ TEST_F(ManagePasswordsUIControllerTest, ManualFallbackForSaving_UseFallback) {
EXPECT_FALSE(controller()->opened_automatic_bubble()); EXPECT_FALSE(controller()->opened_automatic_bubble());
// A user clicks on omnibox icon, opens the bubble and press Save/Update. // A user clicks on omnibox icon, opens the bubble and press Save/Update.
if (is_update) { controller()->SavePassword(test_local_form().username_value,
controller()->UpdatePassword(autofill::PasswordForm()); test_local_form().password_value);
} else {
controller()->SavePassword(test_local_form().username_value,
test_local_form().password_value);
}
// Fake navigation so that the old form manager gets destroyed and // Fake navigation so that the old form manager gets destroyed and
// reports its metrics. Need to close the bubble, otherwise the bubble // reports its metrics. Need to close the bubble, otherwise the bubble
...@@ -998,19 +994,10 @@ TEST_F(ManagePasswordsUIControllerTest, ManualFallbackForSaving_UseFallback) { ...@@ -998,19 +994,10 @@ TEST_F(ManagePasswordsUIControllerTest, ManualFallbackForSaving_UseFallback) {
auto* entry = entries[0]; auto* entry = entries[0];
EXPECT_EQ(source_id, entry->source_id); EXPECT_EQ(source_id, entry->source_id);
if (is_update) { histogram_tester.ExpectUniqueSample(
histogram_tester.ExpectUniqueSample( "PasswordManager.PasswordSavedWithManualFallback", true, 1);
"PasswordManager.PasswordUpdatedWithManualFallback", true, 1); test_ukm_recorder.ExpectEntryMetric(
test_ukm_recorder.ExpectEntryMetric( entry, UkmEntry::kUser_Action_TriggeredManualFallbackForSavingName, 1u);
entry, UkmEntry::kUser_Action_TriggeredManualFallbackForUpdatingName,
1u);
} else {
histogram_tester.ExpectUniqueSample(
"PasswordManager.PasswordSavedWithManualFallback", true, 1);
test_ukm_recorder.ExpectEntryMetric(
entry, UkmEntry::kUser_Action_TriggeredManualFallbackForSavingName,
1u);
}
} }
} }
......
...@@ -94,9 +94,6 @@ class PasswordsModelDelegate { ...@@ -94,9 +94,6 @@ class PasswordsModelDelegate {
virtual void SavePassword(const base::string16& username, virtual void SavePassword(const base::string16& username,
const base::string16& password) = 0; const base::string16& password) = 0;
// Called from the model when the user chooses to update a password.
virtual void UpdatePassword(const autofill::PasswordForm& password_form) = 0;
// Called from the dialog controller when the user chooses a credential. // Called from the dialog controller when the user chooses a credential.
// Controller can be destroyed inside the method. // Controller can be destroyed inside the method.
virtual void ChooseCredential( virtual void ChooseCredential(
......
...@@ -39,14 +39,14 @@ PasswordFormMetricsRecorder::BubbleDismissalReason GetBubbleDismissalReason( ...@@ -39,14 +39,14 @@ PasswordFormMetricsRecorder::BubbleDismissalReason GetBubbleDismissalReason(
// Ignore these for metrics collection: // Ignore these for metrics collection:
case metrics_util::CLICKED_MANAGE: case metrics_util::CLICKED_MANAGE:
case metrics_util::CLICKED_DONE:
case metrics_util::CLICKED_OK:
case metrics_util::CLICKED_BRAND_NAME: case metrics_util::CLICKED_BRAND_NAME:
case metrics_util::CLICKED_PASSWORDS_DASHBOARD: case metrics_util::CLICKED_PASSWORDS_DASHBOARD:
case metrics_util::AUTO_SIGNIN_TOAST_TIMEOUT: case metrics_util::AUTO_SIGNIN_TOAST_TIMEOUT:
break; break;
// These should not reach here: // These should not reach here:
case metrics_util::CLICKED_DONE_OBSOLETE:
case metrics_util::CLICKED_OK_OBSOLETE:
case metrics_util::CLICKED_UNBLACKLIST_OBSOLETE: case metrics_util::CLICKED_UNBLACKLIST_OBSOLETE:
case metrics_util::CLICKED_CREDENTIAL_OBSOLETE: case metrics_util::CLICKED_CREDENTIAL_OBSOLETE:
case metrics_util::AUTO_SIGNIN_TOAST_CLICKED_OBSOLETE: case metrics_util::AUTO_SIGNIN_TOAST_CLICKED_OBSOLETE:
...@@ -118,14 +118,13 @@ PasswordFormMetricsRecorder::~PasswordFormMetricsRecorder() { ...@@ -118,14 +118,13 @@ PasswordFormMetricsRecorder::~PasswordFormMetricsRecorder() {
ukm_entry_builder_.SetUser_Action_TriggeredManualFallbackForSaving( ukm_entry_builder_.SetUser_Action_TriggeredManualFallbackForSaving(
action.second); action.second);
break; break;
case DetailedUserAction::kTriggeredManualFallbackForUpdating:
ukm_entry_builder_.SetUser_Action_TriggeredManualFallbackForUpdating(
action.second);
break;
case DetailedUserAction::kCorrectedUsernameInForm: case DetailedUserAction::kCorrectedUsernameInForm:
ukm_entry_builder_.SetUser_Action_CorrectedUsernameInForm( ukm_entry_builder_.SetUser_Action_CorrectedUsernameInForm(
action.second); action.second);
break; break;
case DetailedUserAction::kObsoleteTriggeredManualFallbackForUpdating:
NOTREACHED();
break;
} }
} }
......
...@@ -151,7 +151,7 @@ class PasswordFormMetricsRecorder ...@@ -151,7 +151,7 @@ class PasswordFormMetricsRecorder
kEditedUsernameInBubble = 100, kEditedUsernameInBubble = 100,
kSelectedDifferentPasswordInBubble = 101, kSelectedDifferentPasswordInBubble = 101,
kTriggeredManualFallbackForSaving = 102, kTriggeredManualFallbackForSaving = 102,
kTriggeredManualFallbackForUpdating = 103, kObsoleteTriggeredManualFallbackForUpdating = 103, // unused
// Interactions with form. // Interactions with form.
kCorrectedUsernameInForm = 200, kCorrectedUsernameInForm = 200,
......
...@@ -50,10 +50,10 @@ enum UIDismissalReason { ...@@ -50,10 +50,10 @@ enum UIDismissalReason {
CLICKED_CANCEL, CLICKED_CANCEL,
CLICKED_NEVER, CLICKED_NEVER,
CLICKED_MANAGE, CLICKED_MANAGE,
CLICKED_DONE, CLICKED_DONE_OBSOLETE, // obsolete
CLICKED_UNBLACKLIST_OBSOLETE, // obsolete. CLICKED_UNBLACKLIST_OBSOLETE, // obsolete.
CLICKED_OK, CLICKED_OK_OBSOLETE, // obsolete
CLICKED_CREDENTIAL_OBSOLETE, // obsolete. CLICKED_CREDENTIAL_OBSOLETE, // obsolete.
AUTO_SIGNIN_TOAST_TIMEOUT, AUTO_SIGNIN_TOAST_TIMEOUT,
AUTO_SIGNIN_TOAST_CLICKED_OBSOLETE, // obsolete. AUTO_SIGNIN_TOAST_CLICKED_OBSOLETE, // obsolete.
CLICKED_BRAND_NAME, CLICKED_BRAND_NAME,
......
...@@ -65704,6 +65704,9 @@ uploading your change for review. ...@@ -65704,6 +65704,9 @@ uploading your change for review.
<histogram name="PasswordManager.PasswordUpdatedWithManualFallback" <histogram name="PasswordManager.PasswordUpdatedWithManualFallback"
enum="BooleanPasswordSavedWithFallback"> enum="BooleanPasswordSavedWithFallback">
<obsolete>
Deprecated as of 05/2018.
</obsolete>
<owner>kolos@chromium.org</owner> <owner>kolos@chromium.org</owner>
<summary> <summary>
Measures whether users update passwords with automatic prompt or manual Measures whether users update passwords with automatic prompt or manual
...@@ -2424,6 +2424,9 @@ be describing additional metrics about the same event. ...@@ -2424,6 +2424,9 @@ be describing additional metrics about the same event.
</summary> </summary>
</metric> </metric>
<metric name="User.Action.TriggeredManualFallbackForUpdating"> <metric name="User.Action.TriggeredManualFallbackForUpdating">
<obsolete>
Deprecated. Use TriggeredManualFallbackForSaving instead.
</obsolete>
<summary> <summary>
Counts how many times the user triggered the manual fallback for password Counts how many times the user triggered the manual fallback for password
updating. This is only populated if events happened. updating. This is only populated if events happened.
......
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