Commit b45ca899 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Move PasswordAccountStorageUserState to password_manager_metrics_util

Some functions in password_manager_metrics_util will soon depend on this
enum definition, so this avoids a cyclic include between
password_manager_util.h and password_manager_metrics_util.h.
(password_manager_util.h already includes _metrics_util.h via
password_manager_client.h.)

The function ComputePasswordAccountStorageUserState() remains in
password_manager_util where it fits well.

While we're here, let's also clean up some unused includes from
password_manager_metrics_util.

Bug: 1063852
Change-Id: I0752138d4a6c7725e68b1a982ff22a9004899118
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152813
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760419}
parent 315f4981
...@@ -6,23 +6,10 @@ ...@@ -6,23 +6,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "base/numerics/safe_conversions.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/autofill/core/common/password_generation_util.h" #include "components/autofill/core/common/password_generation_util.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "url/gurl.h"
using autofill::password_generation::PasswordGenerationType; using autofill::password_generation::PasswordGenerationType;
using base::ListValue;
using base::Value;
namespace password_manager { namespace password_manager {
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <string> #include <string>
#include "components/autofill/core/common/mojom/autofill_types.mojom.h" #include "components/autofill/core/common/mojom/autofill_types.mojom.h"
#include "components/autofill/core/common/password_form.h"
#include "components/autofill/core/common/password_generation_util.h" #include "components/autofill/core/common/password_generation_util.h"
#include "components/password_manager/core/common/credential_manager_types.h" #include "components/password_manager/core/common/credential_manager_types.h"
...@@ -434,6 +433,29 @@ enum class GenerationDialogChoice { ...@@ -434,6 +433,29 @@ enum class GenerationDialogChoice {
kMaxValue = kRejected kMaxValue = kRejected
}; };
// Represents the state of the user wrt. sign-in and account-scoped storage.
// Used for metrics.
enum class PasswordAccountStorageUserState {
// Signed-out user (and no account storage opt-in exists).
kSignedOutUser,
// Signed-out user, but an account storage opt-in exists.
kSignedOutAccountStoreUser,
// Signed-in user, not opted in to the account storage (but will save
// passwords to the account storage by default).
kSignedInUser,
// Signed-in user, not opted in to the account storage, and has explicitly
// chosen to save passwords only on the device.
kSignedInUserSavingLocally,
// Signed-in user, opted in to the account storage, and saving passwords to
// the account storage.
kSignedInAccountStoreUser,
// Signed-in user and opted in to the account storage, but has chosen to save
// passwords only on the device.
kSignedInAccountStoreUserSavingLocally,
// Syncing user.
kSyncUser,
};
// Log the |reason| a user dismissed the password manager UI except save/update // Log the |reason| a user dismissed the password manager UI except save/update
// bubbles. // bubbles.
void LogGeneralUIDismissalReason(UIDismissalReason reason); void LogGeneralUIDismissalReason(UIDismissalReason reason);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
using autofill::GaiaIdHash; using autofill::GaiaIdHash;
using autofill::PasswordForm; using autofill::PasswordForm;
using password_manager::metrics_util::PasswordAccountStorageUserState;
namespace password_manager_util { namespace password_manager_util {
namespace { namespace {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_client.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 "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -204,31 +205,10 @@ void SetDefaultPasswordStore(PrefService* pref_service, ...@@ -204,31 +205,10 @@ void SetDefaultPasswordStore(PrefService* pref_service,
// |pref_service| must not be null. // |pref_service| must not be null.
void ClearAccountStorageSettingsForAllUsers(PrefService* pref_service); void ClearAccountStorageSettingsForAllUsers(PrefService* pref_service);
// Represents the state of the user wrt. sign-in and account-scoped storage. // See definition of PasswordAccountStorageUserState.
// Used for metrics. password_manager::metrics_util::PasswordAccountStorageUserState
enum class PasswordAccountStorageUserState { ComputePasswordAccountStorageUserState(const PrefService* pref_service,
// Signed-out user (and no account storage opt-in exists). const syncer::SyncService* sync_service);
kSignedOutUser,
// Signed-out user, but an account storage opt-in exists.
kSignedOutAccountStoreUser,
// Signed-in user, not opted in to the account storage (but will save
// passwords to the account storage by default).
kSignedInUser,
// Signed-in user, not opted in to the account storage, and has explicitly
// chosen to save passwords only on the device.
kSignedInUserSavingLocally,
// Signed-in user, opted in to the account storage, and saving passwords to
// the account storage..
kSignedInAccountStoreUser,
// Signed-in user and opted in to the account storage, but has chosen to save
// passwords only on the device.
kSignedInAccountStoreUserSavingLocally,
// Syncing user.
kSyncUser,
};
PasswordAccountStorageUserState ComputePasswordAccountStorageUserState(
const PrefService* pref_service,
const syncer::SyncService* sync_service);
} // namespace password_manager_util } // namespace password_manager_util
......
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