Commit 3a57dd72 authored by Viktor Semeniuk's avatar Viktor Semeniuk Committed by Commit Bot

[iOS][Password Check] Password check interactions

This change adds metrics recording for password check interactions.

Bug: 1121906
Change-Id: Ib044e6174d4ef70a55500a21401fe2c69d1b833e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377725Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Viktor Semeniuk <vsemeniuk@google.com>
Cr-Commit-Position: refs/heads/master@{#803079}
parent f37e14dd
...@@ -309,7 +309,8 @@ PasswordManagerProxy.PasswordCheckStatus; ...@@ -309,7 +309,8 @@ PasswordManagerProxy.PasswordCheckStatus;
* 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.
* *
* Needs to stay in sync with PasswordCheckInteraction in enums.xml. * Needs to stay in sync with PasswordCheckInteraction in enums.xml and
* password_manager_metrics_util.h.
* *
* @enum {number} * @enum {number}
*/ */
......
...@@ -426,6 +426,23 @@ enum class PasswordAccountStorageUserState { ...@@ -426,6 +426,23 @@ enum class PasswordAccountStorageUserState {
kSyncUser = 6, kSyncUser = 6,
}; };
// Represents different user interactions related to password check.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. Always keep this enum in sync with the
// corresponding PasswordCheckInteraction in enums.xml and
// password_manager_proxy.js.
enum class PasswordCheckInteraction {
kAutomaticPasswordCheck = 0,
kManualPasswordCheck = 1,
kPasswordCheckStopped = 2,
kChangePassword = 3,
kEditPassword = 4,
kRemovePassword = 5,
kShowPassword = 6,
// Must be last.
kMaxValue = kShowPassword,
};
// Metrics: PasswordManager.MoveToAccountStoreTrigger. // Metrics: PasswordManager.MoveToAccountStoreTrigger.
// This must be kept in sync with the enum in password_move_to_account_dialog.js // This must be kept in sync with the enum in password_move_to_account_dialog.js
// (in chrome/browser/resources/settings/autofill_page). // (in chrome/browser/resources/settings/autofill_page).
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "ios/chrome/browser/ui/passwords/password_breach_coordinator.h" #import "ios/chrome/browser/ui/passwords/password_breach_coordinator.h"
#include "components/password_manager/core/browser/ui/password_check_referrer.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
...@@ -106,6 +107,8 @@ using password_manager::CredentialLeakType; ...@@ -106,6 +107,8 @@ using password_manager::CredentialLeakType;
- (void)startPasswordCheck { - (void)startPasswordCheck {
id<ApplicationCommands> handler = HandlerForProtocol( id<ApplicationCommands> handler = HandlerForProtocol(
self.browser->GetCommandDispatcher(), ApplicationCommands); self.browser->GetCommandDispatcher(), ApplicationCommands);
password_manager::LogPasswordCheckReferrer(
password_manager::PasswordCheckReferrer::kPasswordBreachDialog);
[handler showSavedPasswordsSettingsAndStartPasswordCheckFromViewController: [handler showSavedPasswordsSettingsAndStartPasswordCheckFromViewController:
self.baseViewController]; self.baseViewController];
} }
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
#import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator.h" #import "ios/chrome/browser/ui/settings/password/password_details/password_details_coordinator.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.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/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h"
...@@ -162,6 +164,10 @@ ...@@ -162,6 +164,10 @@
[weakSelf.delegate [weakSelf.delegate
passwordDetailsCoordinator:weakSelf passwordDetailsCoordinator:weakSelf
deletePassword:weakSelf.mediator.password]; deletePassword:weakSelf.mediator.password];
base::UmaHistogramEnumeration(
"PasswordManager.BulkCheck.UserAction",
password_manager::metrics_util::PasswordCheckInteraction::
kRemovePassword);
} }
style:UIAlertActionStyleDestructive]; style:UIAlertActionStyleDestructive];
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h"
...@@ -34,7 +35,9 @@ ...@@ -34,7 +35,9 @@
namespace { namespace {
using base::UmaHistogramEnumeration;
using password_manager::metrics_util::LogPasswordSettingsReauthResult; using password_manager::metrics_util::LogPasswordSettingsReauthResult;
using password_manager::metrics_util::PasswordCheckInteraction;
using password_manager::metrics_util::ReauthResult; using password_manager::metrics_util::ReauthResult;
// Padding used between the image and the text labels. // Padding used between the image and the text labels.
...@@ -255,6 +258,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) { ...@@ -255,6 +258,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) {
DCHECK(self.password.changePasswordURL.is_valid()); DCHECK(self.password.changePasswordURL.is_valid());
OpenNewTabCommand* command = [OpenNewTabCommand OpenNewTabCommand* command = [OpenNewTabCommand
commandWithURLFromChrome:self.password.changePasswordURL]; commandWithURLFromChrome:self.password.changePasswordURL];
UmaHistogramEnumeration("PasswordManager.BulkCheck.UserAction",
PasswordCheckInteraction::kChangePassword);
[self.commandsDispatcher closeSettingsUIAndOpenURL:command]; [self.commandsDispatcher closeSettingsUIAndOpenURL:command];
} }
break; break;
...@@ -399,6 +404,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) { ...@@ -399,6 +404,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) {
[[UIImage imageNamed:@"infobar_hide_password_icon"] [[UIImage imageNamed:@"infobar_hide_password_icon"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[self reconfigureCellsForItems:@[ self.passwordTextItem ]]; [self reconfigureCellsForItems:@[ self.passwordTextItem ]];
UmaHistogramEnumeration("PasswordManager.BulkCheck.UserAction",
PasswordCheckInteraction::kShowPassword);
break; break;
case ReauthenticationReasonCopy: case ReauthenticationReasonCopy:
// TODO:(crbug.com/1075494) - Implement copy password functionality. // TODO:(crbug.com/1075494) - Implement copy password functionality.
...@@ -432,6 +439,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) { ...@@ -432,6 +439,8 @@ typedef NS_ENUM(NSInteger, ReauthenticationReason) {
[self.delegate passwordDetailsViewController:self [self.delegate passwordDetailsViewController:self
didEditPasswordDetails:self.password]; didEditPasswordDetails:self.password];
[super editButtonPressed]; [super editButtonPressed];
UmaHistogramEnumeration("PasswordManager.BulkCheck.UserAction",
PasswordCheckInteraction::kEditPassword);
[self reloadData]; [self reloadData];
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/check_op.h" #include "base/check_op.h"
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h" #include "base/metrics/user_metrics_action.h"
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#include "components/password_manager/core/browser/password_manager_metrics_util.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"
#include "components/password_manager/core/browser/password_ui_utils.h" #include "components/password_manager/core/browser/password_ui_utils.h"
#include "components/password_manager/core/browser/ui/password_check_referrer.h"
#include "components/password_manager/core/common/password_manager_features.h" #include "components/password_manager/core/common/password_manager_features.h"
#include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_member.h" #include "components/prefs/pref_member.h"
...@@ -89,6 +91,9 @@ ...@@ -89,6 +91,9 @@
namespace { namespace {
using base::UmaHistogramEnumeration;
using password_manager::metrics_util::PasswordCheckInteraction;
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierSavePasswordsSwitch = kSectionIdentifierEnumZero, SectionIdentifierSavePasswordsSwitch = kSectionIdentifierEnumZero,
SectionIdentifierSavedPasswords, SectionIdentifierSavedPasswords,
...@@ -320,6 +325,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -320,6 +325,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
- (void)startPasswordCheck { - (void)startPasswordCheck {
if (_passwordCheck->GetPasswordCheckState() != PasswordCheckState::kRunning) { if (_passwordCheck->GetPasswordCheckState() != PasswordCheckState::kRunning) {
_passwordCheck->StartPasswordCheck(); _passwordCheck->StartPasswordCheck();
UmaHistogramEnumeration("PasswordManager.BulkCheck.UserAction",
PasswordCheckInteraction::kAutomaticPasswordCheck);
} }
} }
...@@ -1421,6 +1428,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -1421,6 +1428,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
_passwordIssuesCoordinator.delegate = self; _passwordIssuesCoordinator.delegate = self;
_passwordIssuesCoordinator.reauthModule = _reauthenticationModule; _passwordIssuesCoordinator.reauthModule = _reauthenticationModule;
[_passwordIssuesCoordinator start]; [_passwordIssuesCoordinator start];
password_manager::LogPasswordCheckReferrer(
password_manager::PasswordCheckReferrer::kPasswordSettings);
} }
#pragma mark UITableViewDelegate #pragma mark UITableViewDelegate
...@@ -1473,6 +1482,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf( ...@@ -1473,6 +1482,8 @@ std::vector<std::unique_ptr<autofill::PasswordForm>> CopyOf(
case ItemTypeCheckForProblemsButton: case ItemTypeCheckForProblemsButton:
if (self.passwordCheckState != PasswordCheckStateRunning) { if (self.passwordCheckState != PasswordCheckStateRunning) {
_passwordCheck->StartPasswordCheck(); _passwordCheck->StartPasswordCheck();
UmaHistogramEnumeration("PasswordManager.BulkCheck.UserAction",
PasswordCheckInteraction::kManualPasswordCheck);
} }
break; break;
default: default:
......
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