Commit 03664c4c authored by David Roger's avatar David Roger Committed by Commit Bot

[Dice] Improve the Signin.DiceResponseHeader histogram

- Now records "EnableSync" responses
- Now records "SignoutPrimary" correctly during Dice migration

Bug: 736310
Change-Id: I5b4e8e60ecaab18cac2454986f5849565529976a
Reviewed-on: https://chromium-review.googlesource.com/891220Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532823}
parent 67c8f896
......@@ -49,6 +49,8 @@ enum DiceResponseHeader {
kSignoutPrimary = 1,
// Received a signout header for other account(s).
kSignoutSecondary = 2,
// Received a "EnableSync" header.
kEnableSync = 3,
kDiceResponseHeaderCount
};
......@@ -312,6 +314,7 @@ void DiceResponseHandler::ProcessEnableSyncHeader(
const std::string& email,
std::unique_ptr<ProcessDiceHeaderDelegate> delegate) {
VLOG(1) << "Start processing Dice enable sync response";
RecordDiceResponseHeader(kEnableSync);
for (auto it = token_fetchers_.begin(); it != token_fetchers_.end(); ++it) {
DiceTokenFetcher* fetcher = it->get();
if (fetcher->gaia_id() == gaia_id) {
......@@ -340,20 +343,21 @@ void DiceResponseHandler::ProcessDiceSignoutHeader(
// If one of the signed out accounts is the main Chrome account, then force a
// complete signout. Otherwise simply revoke the corresponding tokens.
std::string current_account = signin_manager_->GetAuthenticatedAccountId();
std::vector<std::string> signed_out_accounts;
std::string primary_account = signin_manager_->GetAuthenticatedAccountId();
std::vector<std::string> secondary_accounts;
for (const auto& account_info : account_infos) {
std::string signed_out_account =
account_tracker_service_->PickAccountIdForAccount(account_info.gaia_id,
account_info.email);
if (signed_out_account == current_account) {
if (signed_out_account == primary_account) {
RecordDiceResponseHeader(kSignoutPrimary);
// If Dice migration is not complete, the token for the main account must
// not be deleted when signing out of the web.
if (!signin::IsDiceEnabledForProfile(signin_client_->GetPrefs()))
continue;
VLOG(1) << "[Dice] Signing out all accounts.";
RecordDiceResponseHeader(kSignoutPrimary);
signin_manager_->SignOutAndRemoveAllAccounts(
signin_metrics::SERVER_FORCED_DISABLE,
signin_metrics::SignoutDelete::IGNORE_METRIC);
......@@ -361,12 +365,16 @@ void DiceResponseHandler::ProcessDiceSignoutHeader(
token_fetchers_.clear();
return;
} else {
signed_out_accounts.push_back(signed_out_account);
secondary_accounts.push_back(signed_out_account);
}
}
RecordDiceResponseHeader(kSignoutSecondary);
for (const auto& account : signed_out_accounts) {
if (signin::IsDiceEnabledForProfile(signin_client_->GetPrefs()) ||
secondary_accounts.size() == account_infos.size()) {
RecordDiceResponseHeader(kSignoutSecondary);
}
for (const auto& account : secondary_accounts) {
VLOG(1) << "[Dice]: Revoking token for account: " << account;
token_service_->RevokeCredentials(account);
// If a token fetch is in flight for the same account, cancel it.
......
......@@ -39408,6 +39408,7 @@ Called by update_net_trust_anchors.py.-->
Signout including the primary account.
</int>
<int value="2" label="SignoutSecondary">Signout only secondary accounts.</int>
<int value="3" label="EnableSync">Enable Sync after signin.</int>
</enum>
<enum name="SigninDiceTokenFetchResult">
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