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 = [ ...@@ -43,6 +43,7 @@ include_rules = [
"+components/account_id", "+components/account_id",
"+components/federated_learning", "+components/federated_learning",
"+components/arc", "+components/arc",
"+components/account_manager_core",
"+components/assist_ranker", "+components/assist_ranker",
"+components/autofill_assistant/browser", "+components/autofill_assistant/browser",
"+components/autofill/content/browser", "+components/autofill/content/browser",
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" #include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h" #include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chrome/common/webui_url_constants.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_browser_context_keyed_service_factory_base.h"
#include "components/arc/arc_features.h" #include "components/arc/arc_features.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
...@@ -510,7 +511,7 @@ void ArcAuthService::HandleAddAccountRequest() { ...@@ -510,7 +511,7 @@ void ArcAuthService::HandleAddAccountRequest() {
DCHECK(chromeos::IsAccountManagerAvailable(profile_)); DCHECK(chromeos::IsAccountManagerAvailable(profile_));
chromeos::InlineLoginDialogChromeOS::ShowDeprecated( chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
chromeos::InlineLoginDialogChromeOS::Source::kArc); ::account_manager::AccountManagerFacade::AccountAdditionSource::kArc);
} }
void ArcAuthService::HandleRemoveAccountRequest(const std::string& email) { void ArcAuthService::HandleRemoveAccountRequest(const std::string& email) {
...@@ -524,7 +525,8 @@ void ArcAuthService::HandleUpdateCredentialsRequest(const std::string& email) { ...@@ -524,7 +525,8 @@ void ArcAuthService::HandleUpdateCredentialsRequest(const std::string& email) {
DCHECK(chromeos::IsAccountManagerAvailable(profile_)); DCHECK(chromeos::IsAccountManagerAvailable(profile_));
chromeos::InlineLoginDialogChromeOS::ShowDeprecated( chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
email, chromeos::InlineLoginDialogChromeOS::Source::kArc); email,
::account_manager::AccountManagerFacade::AccountAdditionSource::kArc);
} }
void ArcAuthService::OnRefreshTokenUpdatedForAccount( void ArcAuthService::OnRefreshTokenUpdatedForAccount(
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/url_constants.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/account_reconcilor.h"
#include "components/signin/core/browser/cookie_reminter.h" #include "components/signin/core/browser/cookie_reminter.h"
#include "components/signin/public/base/account_consistency_method.h" #include "components/signin/public/base/account_consistency_method.h"
...@@ -283,8 +284,8 @@ void ProcessMirrorHeader( ...@@ -283,8 +284,8 @@ void ProcessMirrorHeader(
// Display a re-authentication dialog. // Display a re-authentication dialog.
chromeos::InlineLoginDialogChromeOS::ShowDeprecated( chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
manage_accounts_params.email, manage_accounts_params.email, ::account_manager::AccountManagerFacade::
chromeos::InlineLoginDialogChromeOS::Source::kContentArea); AccountAdditionSource::kContentArea);
return; return;
} }
......
...@@ -2759,6 +2759,7 @@ static_library("ui") { ...@@ -2759,6 +2759,7 @@ static_library("ui") {
"views/frame/browser_non_client_frame_view_chromeos.h", "views/frame/browser_non_client_frame_view_chromeos.h",
"views/frame/browser_non_client_frame_view_factory_chromeos.cc", "views/frame/browser_non_client_frame_view_factory_chromeos.cc",
] ]
deps += [ "//components/account_manager_core:account_manager_core" ]
} }
if (is_chromeos_lacros) { if (is_chromeos_lacros) {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "chrome/common/webui_url_constants.h" #include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_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_contents.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
...@@ -57,8 +58,9 @@ class MigrationMessageHandler : public content::WebUIMessageHandler { ...@@ -57,8 +58,9 @@ class MigrationMessageHandler : public content::WebUIMessageHandler {
const std::string& account_email = args->GetList()[0].GetString(); const std::string& account_email = args->GetList()[0].GetString();
InlineLoginDialogChromeOS::ShowDeprecated( InlineLoginDialogChromeOS::ShowDeprecated(
account_email, InlineLoginDialogChromeOS::Source:: account_email,
kAccountManagerMigrationWelcomeScreen); ::account_manager::AccountManagerFacade::AccountAdditionSource::
kAccountManagerMigrationWelcomeScreen);
HandleCloseDialog(args); HandleCloseDialog(args);
} }
......
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" #include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h"
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h" #include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "components/account_manager_core/account_manager_facade.h"
#endif #endif
using content::RenderFrameHost; using content::RenderFrameHost;
...@@ -716,7 +717,8 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* /*args*/) { ...@@ -716,7 +717,8 @@ void PrintPreviewHandler::HandleSignin(const base::ListValue* /*args*/) {
// account management flows will go through native UIs and not through a // account management flows will go through native UIs and not through a
// tabbed browser window. // tabbed browser window.
chromeos::InlineLoginDialogChromeOS::ShowDeprecated( chromeos::InlineLoginDialogChromeOS::ShowDeprecated(
chromeos::InlineLoginDialogChromeOS::Source::kPrintPreviewDialog); account_manager::AccountManagerFacade::AccountAdditionSource::
kPrintPreviewDialog);
return; return;
} }
#endif #endif
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h" #include "chrome/browser/ui/webui/signin/inline_login_dialog_chromeos.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/components/account_manager/account_manager_factory.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/signin/public/identity_manager/consent_level.h"
#include "components/user_manager/user.h" #include "components/user_manager/user.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
...@@ -344,7 +345,8 @@ base::ListValue AccountManagerUIHandler::GetSecondaryGaiaAccounts( ...@@ -344,7 +345,8 @@ base::ListValue AccountManagerUIHandler::GetSecondaryGaiaAccounts(
void AccountManagerUIHandler::HandleAddAccount(const base::ListValue* args) { void AccountManagerUIHandler::HandleAddAccount(const base::ListValue* args) {
AllowJavascript(); AllowJavascript();
InlineLoginDialogChromeOS::ShowDeprecated( InlineLoginDialogChromeOS::ShowDeprecated(
InlineLoginDialogChromeOS::Source::kSettingsAddAccountButton); ::account_manager::AccountManagerFacade::AccountAdditionSource::
kSettingsAddAccountButton);
} }
void AccountManagerUIHandler::HandleReauthenticateAccount( void AccountManagerUIHandler::HandleReauthenticateAccount(
...@@ -355,8 +357,8 @@ void AccountManagerUIHandler::HandleReauthenticateAccount( ...@@ -355,8 +357,8 @@ void AccountManagerUIHandler::HandleReauthenticateAccount(
const std::string& account_email = args->GetList()[0].GetString(); const std::string& account_email = args->GetList()[0].GetString();
InlineLoginDialogChromeOS::ShowDeprecated( InlineLoginDialogChromeOS::ShowDeprecated(
account_email, account_email, ::account_manager::AccountManagerFacade::
InlineLoginDialogChromeOS::Source::kSettingsReauthAccountButton); AccountAdditionSource::kSettingsReauthAccountButton);
} }
void AccountManagerUIHandler::HandleMigrateAccount( void AccountManagerUIHandler::HandleMigrateAccount(
......
...@@ -103,15 +103,21 @@ bool InlineLoginDialogChromeOS::IsShown() { ...@@ -103,15 +103,21 @@ bool InlineLoginDialogChromeOS::IsShown() {
} }
// static // static
void InlineLoginDialogChromeOS::ShowDeprecated(const std::string& email, void InlineLoginDialogChromeOS::ShowDeprecated(
const Source& source) { const std::string& email,
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source) {
base::UmaHistogramEnumeration(kAccountAdditionSource, 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); ShowInternal(email, is_arc_source);
} }
// static // static
void InlineLoginDialogChromeOS::ShowDeprecated(const Source& source) { void InlineLoginDialogChromeOS::ShowDeprecated(
const ::account_manager::AccountManagerFacade::AccountAdditionSource&
source) {
ShowDeprecated(/* email= */ std::string(), source); ShowDeprecated(/* email= */ std::string(), source);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h" #include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h"
#include "chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h" #include "chrome/browser/ui/webui/signin/inline_login_handler_modal_delegate.h"
#include "chromeos/components/account_manager/account_manager.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" #include "components/web_modal/web_contents_modal_dialog_host.h"
class GURL; class GURL;
...@@ -26,32 +27,6 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate, ...@@ -26,32 +27,6 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate,
public: public:
static const char kAccountAdditionSource[]; 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. // Represents the last reached step in the flow.
// Keep in sync with // Keep in sync with
// chrome/browser/resources/chromeos/edu_login/edu_login_util.js // chrome/browser/resources/chromeos/edu_login/edu_login_util.js
...@@ -74,13 +49,18 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate, ...@@ -74,13 +49,18 @@ class InlineLoginDialogChromeOS : public SystemWebDialogDelegate,
// the source UX surface used for launching the dialog. // the source UX surface used for launching the dialog.
// DEPRECATED: Use AccountManagerFacade instead (see // DEPRECATED: Use AccountManagerFacade instead (see
// https://crbug.com/1140469). // 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 // Displays the dialog for account addition. |source| specifies the source UX
// surface used for launching the dialog. // surface used for launching the dialog.
// DEPRECATED: Use AccountManagerFacade instead (see // DEPRECATED: Use AccountManagerFacade instead (see
// https://crbug.com/1140469). // 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 // 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. // users. Before the dialog will close, this value will be reported to UMA.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/supervised_user/supervised_user_features.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/aura/window.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -71,7 +72,8 @@ InlineLoginDialogChromeOSOnboarding* InlineLoginDialogChromeOSOnboarding::Show( ...@@ -71,7 +72,8 @@ InlineLoginDialogChromeOSOnboarding* InlineLoginDialogChromeOSOnboarding::Show(
base::UmaHistogramEnumeration( base::UmaHistogramEnumeration(
InlineLoginDialogChromeOS::kAccountAdditionSource, InlineLoginDialogChromeOS::kAccountAdditionSource,
InlineLoginDialogChromeOS::Source::kOnboarding); ::account_manager::AccountManagerFacade::AccountAdditionSource::
kOnboarding);
DCHECK(window); DCHECK(window);
......
...@@ -16,6 +16,32 @@ namespace account_manager { ...@@ -16,6 +16,32 @@ namespace account_manager {
// Use |GetAccountManagerFacade()| to get an instance of this class. // Use |GetAccountManagerFacade()| to get an instance of this class.
class COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) AccountManagerFacade { class COMPONENT_EXPORT(ACCOUNT_MANAGER_CORE) AccountManagerFacade {
public: 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();
AccountManagerFacade(const AccountManagerFacade&) = delete; AccountManagerFacade(const AccountManagerFacade&) = delete;
AccountManagerFacade& operator=(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