Commit e172bdaf authored by Anastasiia N's avatar Anastasiia N Committed by Chromium LUCI CQ

Move InlineLoginDialogChromeOS::Source to AccountManagerFacade

Move `InlineLoginDialogChromeOS::Source` to
`account_manager::AccountManagerFacade::AccountAdditionSource`.

`AccountAdditionSource` is used for UMA stats, which will be sent by
`AccountManagerFacade`. Currently they are sent by
`InlineLoginDialogChromeOS::ShowDeprecated`, but these methods will be
removed.

Note: `InlineLoginDialogChromeOSOnboarding` will keep sending the UMA
stats because it is a different dialog.

Bug: 1140469
Change-Id: I652fb807b3285181e8b43ad0560983d1e3a8764e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2550668
Commit-Queue: Anastasiia N <anastasiian@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835661}
parent b7393b0b
......@@ -43,6 +43,7 @@ include_rules = [
"+components/account_id",
"+components/federated_learning",
"+components/arc",
"+components/account_manager_core",
"+components/assist_ranker",
"+components/autofill_assistant/browser",
"+components/autofill/content/browser",
......
......@@ -33,6 +33,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chrome/common/webui_url_constants.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_features.h"
#include "components/arc/arc_prefs.h"
......@@ -510,7 +511,7 @@ void ArcAuthService::HandleAddAccountRequest() {
DCHECK(chromeos::IsAccountManagerAvailable(profile_));
chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
chromeos::InlineLoginDialogChromeOS::Source::kArc);
::account_manager::AccountManagerFacade::AccountAdditionSource::kArc);
}
void ArcAuthService::HandleRemoveAccountRequest(const std::string& email) {
......@@ -524,7 +525,8 @@ void ArcAuthService::HandleUpdateCredentialsRequest(const std::string& email) {
DCHECK(chromeos::IsAccountManagerAvailable(profile_));
chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
email, chromeos::InlineLoginDialogChromeOS::Source::kArc);
email,
::account_manager::AccountManagerFacade::AccountAdditionSource::kArc);
}
void ArcAuthService::OnRefreshTokenUpdatedForAccount(
......
......@@ -36,6 +36,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/url_constants.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/cookie_reminter.h"
#include "components/signin/public/base/account_consistency_method.h"
......@@ -283,8 +284,8 @@ void ProcessMirrorHeader(
// Display a re-authentication dialog.
chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
manage_accounts_params.email,
chromeos::InlineLoginDialogChromeOS::Source::kContentArea);
manage_accounts_params.email, ::account_manager::AccountManagerFacade::
AccountAdditionSource::kContentArea);
return;
}
......
......@@ -2759,6 +2759,7 @@ static_library("ui") {
"views/frame/browser_non_client_frame_view_chromeos.h",
"views/frame/browser_non_client_frame_view_factory_chromeos.cc",
]
deps += [ "//components/account_manager_core:account_manager_core" ]
}
if (is_chromeos_lacros) {
......
......@@ -17,6 +17,7 @@
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/url_util.h"
......@@ -57,8 +58,9 @@ class MigrationMessageHandler : public content::WebUIMessageHandler {
const std::string& account_email = args->GetList()[0].GetString();
InlineLoginDialogChromeOS::ShowDeprecated(
account_email, InlineLoginDialogChromeOS::Source::
kAccountManagerMigrationWelcomeScreen);
account_email,
::account_manager::AccountManagerFacade::AccountAdditionSource::
kAccountManagerMigrationWelcomeScreen);
HandleCloseDialog(args);
}
......
......@@ -86,6 +86,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/account_manager_core/account_manager_facade.h"
#endif
using content::RenderFrameHost;
......@@ -716,7 +717,8 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* /*args*/) {
// account management flows will go through native UIs and not through a
// tabbed browser window.
chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog);
account_manager::AccountManagerFacade::AccountAdditionSource::
kPrintPreviewDialog);
return;
}
#endif
......
......@@ -23,6 +23,7 @@
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/components/account_manager/account_manager_factory.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "components/signin/public/identity_manager/consent_level.h"
#include "components/user_manager/user.h"
#include "google_apis/gaia/gaia_auth_util.h"
......@@ -344,7 +345,8 @@ base::ListValue AccountManagerUIHandler::GetSecondaryGaiaAccounts(
void AccountManagerUIHandler::HandleAddAccount(const base::ListValue* args) {
AllowJavascript();
InlineLoginDialogChromeOS::ShowDeprecated(
InlineLoginDialogChromeOS::Source::kSettingsAddAccountButton);
::account_manager::AccountManagerFacade::AccountAdditionSource::
kSettingsAddAccountButton);
}
void AccountManagerUIHandler::HandleReauthenticateAccount(
......@@ -355,8 +357,8 @@ void AccountManagerUIHandler::HandleReauthenticateAccount(
const std::string& account_email = args->GetList()[0].GetString();
InlineLoginDialogChromeOS::ShowDeprecated(
account_email,
InlineLoginDialogChromeOS::Source::kSettingsReauthAccountButton);
account_email, ::account_manager::AccountManagerFacade::
AccountAdditionSource::kSettingsReauthAccountButton);
}
void AccountManagerUIHandler::HandleMigrateAccount(
......
......@@ -103,15 +103,21 @@ bool InlineLoginDialogChromeOS::IsShown() {
}
// static
void InlineLoginDialogChromeOS::ShowDeprecated(const std::string& email,
const Source& source) {
void InlineLoginDialogChromeOS::ShowDeprecated(
const std::string& email,
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source) {
base::UmaHistogramEnumeration(kAccountAdditionSource, source);
const bool is_arc_source = source == InlineLoginDialogChromeOS::Source::kArc;
const bool is_arc_source =
source ==
::account_manager::AccountManagerFacade::AccountAdditionSource::kArc;
ShowInternal(email, is_arc_source);
}
// static
void InlineLoginDialogChromeOS::ShowDeprecated(const Source& source) {
void InlineLoginDialogChromeOS::ShowDeprecated(
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source) {
ShowDeprecated(/* email= */ std::string(), source);
}
......
......@@ -12,6 +12,7 @@
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h"
#include "chromeos/components/account_manager/account_manager.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
class GURL;
......@@ -26,32 +27,6 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate,
public:
static const char kAccountAdditionSource[];
// The source UX surface used for launching the account addition /
// re-authentication dialog. This should be as specific as possible.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Note: Please update |AccountManagerAccountAdditionSource| in enums.xml
// after adding new values.
enum class Source : int {
// Settings > Add account button.
kSettingsAddAccountButton = 0,
// Settings > Sign in again button.
kSettingsReauthAccountButton = 1,
// Launched from an ARC application.
kArc = 2,
// Launched automatically from Chrome content area. As of now, this is
// possible only when an account requires re-authentication.
kContentArea = 3,
// Print Preview dialog.
kPrintPreviewDialog = 4,
// Account Manager migration welcome screen.
kAccountManagerMigrationWelcomeScreen = 5,
// Onboarding.
kOnboarding = 6,
kMaxValue = kOnboarding
};
// Represents the last reached step in the flow.
// Keep in sync with
// chrome/browser/resources/chromeos/edu_login/edu_login_util.js
......@@ -74,13 +49,18 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate,
// the source UX surface used for launching the dialog.
// DEPRECATED: Use AccountManagerFacade instead (see
// https://crbug.com/1140469).
static void ShowDeprecated(const std::string& email, const Source& source);
static void ShowDeprecated(
const std::string& email,
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source);
// Displays the dialog for account addition. |source| specifies the source UX
// surface used for launching the dialog.
// DEPRECATED: Use AccountManagerFacade instead (see
// https://crbug.com/1140469).
static void ShowDeprecated(const Source& source);
static void ShowDeprecated(
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source);
// Updates the value of the last reached step in 'Add Account' flow for child
// users. Before the dialog will close, this value will be reported to UMA.
......
......@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/supervised_user/supervised_user_features.h"
#include "components/account_manager_core/account_manager_facade.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/widget/widget.h"
......@@ -71,7 +72,8 @@ InlineLoginDialogChromeOSOnboarding* InlineLoginDialogChromeOSOnboarding::Show(
base::UmaHistogramEnumeration(
InlineLoginDialogChromeOS::kAccountAdditionSource,
InlineLoginDialogChromeOS::Source::kOnboarding);
::account_manager::AccountManagerFacade::AccountAdditionSource::
kOnboarding);
DCHECK(window);
......
......@@ -16,6 +16,32 @@ namespace account_manager {
// Use |GetAccountManagerFacade()| to get an instance of this class.
class COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) AccountManagerFacade {
public:
// The source UI surface used for launching the account addition /
// re-authentication dialog. This should be as specific as possible.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Note: Please update |AccountManagerAccountAdditionSource| in enums.xml
// after adding new values.
enum class AccountAdditionSource : int {
// Settings > Add account button.
kSettingsAddAccountButton = 0,
// Settings > Sign in again button.
kSettingsReauthAccountButton = 1,
// Launched from an ARC application.
kArc = 2,
// Launched automatically from Chrome content area. As of now, this is
// possible only when an account requires re-authentication.
kContentArea = 3,
// Print Preview dialog.
kPrintPreviewDialog = 4,
// Account Manager migration welcome screen.
kAccountManagerMigrationWelcomeScreen = 5,
// Onboarding.
kOnboarding = 6,
kMaxValue = kOnboarding
};
AccountManagerFacade();
AccountManagerFacade(const AccountManagerFacade&) = delete;
AccountManagerFacade& operator=(const AccountManagerFacade&) = delete;
......
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