Commit 0ab4099c authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[Passwords] Metrics for Password Edit

This change adds metrics for the Password Edit dialog. It records what
exectly user updated.

Bug: 377410
Change-Id: I8940bb9960eaf79b569cae2130246ea043e1adda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2426594
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811679}
parent 173af1c8
...@@ -8,8 +8,14 @@ ...@@ -8,8 +8,14 @@
#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store.h"
namespace {
using password_manager::metrics_util::IsPasswordChanged;
using password_manager::metrics_util::IsUsernameChanged;
} // namespace
void EditSavedPasswords( void EditSavedPasswords(
Profile* profile, Profile* profile,
const base::span<const std::unique_ptr<autofill::PasswordForm>> const base::span<const std::unique_ptr<autofill::PasswordForm>>
...@@ -20,8 +26,10 @@ void EditSavedPasswords( ...@@ -20,8 +26,10 @@ void EditSavedPasswords(
const std::string signon_realm = forms_to_change[0]->signon_realm; const std::string signon_realm = forms_to_change[0]->signon_realm;
const bool username_changed = IsUsernameChanged username_changed(new_username !=
new_username != forms_to_change[0]->username_value; forms_to_change[0]->username_value);
IsPasswordChanged password_changed(new_password !=
forms_to_change[0]->password_value);
// An updated username implies a change in the primary key, thus we need to // An updated username implies a change in the primary key, thus we need to
// make sure to call the right API. Update every entry in the equivalence // make sure to call the right API. Update every entry in the equivalence
...@@ -47,6 +55,8 @@ void EditSavedPasswords( ...@@ -47,6 +55,8 @@ void EditSavedPasswords(
store->UpdateLogin(new_form); store->UpdateLogin(new_form);
} }
} }
password_manager::metrics_util::LogPasswordEditResult(username_changed,
password_changed);
} }
scoped_refptr<password_manager::PasswordStore> GetPasswordStore( scoped_refptr<password_manager::PasswordStore> GetPasswordStore(
......
...@@ -336,6 +336,22 @@ void LogProtectedPasswordHashCounts(size_t gaia_hash_count, ...@@ -336,6 +336,22 @@ void LogProtectedPasswordHashCounts(size_t gaia_hash_count,
void LogProtectedPasswordReuse(PasswordType reused_password_type) {} void LogProtectedPasswordReuse(PasswordType reused_password_type) {}
#endif #endif
void LogPasswordEditResult(IsUsernameChanged username_changed,
IsPasswordChanged password_changed) {
PasswordEditUpdatedValues values;
if (username_changed && password_changed) {
values = PasswordEditUpdatedValues::kBoth;
} else if (username_changed) {
values = PasswordEditUpdatedValues::kUsername;
} else if (password_changed) {
values = PasswordEditUpdatedValues::kPassword;
} else {
values = PasswordEditUpdatedValues::kNone;
}
base::UmaHistogramEnumeration("PasswordManager.PasswordEditUpdatedValues",
values);
}
} // namespace metrics_util } // namespace metrics_util
} // namespace password_manager } // namespace password_manager
...@@ -17,6 +17,9 @@ namespace password_manager { ...@@ -17,6 +17,9 @@ namespace password_manager {
namespace metrics_util { namespace metrics_util {
using IsUsernameChanged = util::StrongAlias<class IsUsernameChangedTag, bool>;
using IsPasswordChanged = util::StrongAlias<class IsPasswordChangedTag, bool>;
// These values are persisted to logs. Entries should not be renumbered and // These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. // numeric values should never be reused.
// Metrics: "PasswordBubble.DisplayDisposition" // Metrics: "PasswordBubble.DisplayDisposition"
...@@ -473,6 +476,20 @@ enum class GetChangePasswordUrlMetric { ...@@ -473,6 +476,20 @@ enum class GetChangePasswordUrlMetric {
kMaxValue = kGroupUrlOverrideUsed, kMaxValue = kGroupUrlOverrideUsed,
}; };
// Used to record what exactly was updated during password editing flow.
// Entries should not be renumbered and numeric values should never be reused.
enum class PasswordEditUpdatedValues {
// Nothing was updated.
kNone = 0,
// Only username was changed.
kUsername = 1,
// Only password was changed.
kPassword = 2,
// Both password and username were updated.
kBoth = 3,
kMaxValue = kBoth,
};
std::string GetPasswordAccountStorageUserStateHistogramSuffix( std::string GetPasswordAccountStorageUserStateHistogramSuffix(
PasswordAccountStorageUserState user_state); PasswordAccountStorageUserState user_state);
...@@ -619,6 +636,10 @@ void LogProtectedPasswordHashCounts(size_t gaia_hash_count, ...@@ -619,6 +636,10 @@ void LogProtectedPasswordHashCounts(size_t gaia_hash_count,
#endif #endif
// Log the result of the password edit action.
void LogPasswordEditResult(IsUsernameChanged password_changed,
IsPasswordChanged username_changed);
} // namespace metrics_util } // namespace metrics_util
} // namespace password_manager } // namespace password_manager
......
...@@ -54918,6 +54918,13 @@ Called by update_net_trust_anchors.py.--> ...@@ -54918,6 +54918,13 @@ Called by update_net_trust_anchors.py.-->
<int value="1" label="Passwords and generate new password"/> <int value="1" label="Passwords and generate new password"/>
</enum> </enum>
<enum name="PasswordEditUpdatedValues">
<int value="0" label="None"/>
<int value="1" label="Username"/>
<int value="2" label="Password"/>
<int value="3" label="Both"/>
</enum>
<enum name="PasswordFormQueryVolume"> <enum name="PasswordFormQueryVolume">
<int value="0" label="New password query"/> <int value="0" label="New password query"/>
<int value="1" label="Current query"/> <int value="1" label="Current query"/>
...@@ -1572,6 +1572,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -1572,6 +1572,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<summary>Logs the state of the password dropdown when it's shown.</summary> <summary>Logs the state of the password dropdown when it's shown.</summary>
</histogram> </histogram>
<histogram name="PasswordManager.PasswordEditUpdatedValues"
enum="PasswordEditUpdatedValues" expires_after="M92">
<owner>vsemeniuk@google.com</owner>
<owner>vasilii@chromium.org</owner>
<summary>
This metric shows what exactly users change in the password edit dialog:
nothing, username, password or both.
</summary>
</histogram>
<histogram name="PasswordManager.PasswordReuse.NumberOfMatches" <histogram name="PasswordManager.PasswordReuse.NumberOfMatches"
units="credentials" expires_after="2021-01-30"> units="credentials" expires_after="2021-01-30">
<owner>vakh@chromium.org</owner> <owner>vakh@chromium.org</owner>
......
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