Commit 92fc2d7b authored by Valeriya Sinevich's avatar Valeriya Sinevich Committed by Commit Bot

[Signin] Create Multilogin::Mode variable to prepare for logging.

Set mode to UPDATE for Mirror and log it. Needed for CL on logging which has a higher priority than the one where mode will actually be used. Use VLOG(1) to make variable and used somewhere.

Change-Id: I0eb3def674b510a5a5ca433f62540a027fa1cc25
Reviewed-on: https://chromium-review.googlesource.com/1255823
Commit-Queue: Valeriya Sinevich <valeriyas@google.com>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595829}
parent 49361034
...@@ -432,6 +432,12 @@ void AccountReconcilor::FinishReconcileWithMultiloginEndpoint( ...@@ -432,6 +432,12 @@ void AccountReconcilor::FinishReconcileWithMultiloginEndpoint(
std::vector<gaia::ListedAccount>&& gaia_accounts) { std::vector<gaia::ListedAccount>&& gaia_accounts) {
DCHECK(base::FeatureList::IsEnabled(kUseMultiloginEndpoint)); DCHECK(base::FeatureList::IsEnabled(kUseMultiloginEndpoint));
signin::MultiloginMode mode;
if (delegate_->ShouldUpdateAccountsOrderInCookies())
mode = signin::MultiloginMode::MULTILOGIN_UPDATE_COOKIE_ACCOUNTS_ORDER;
else
mode = signin::MultiloginMode::MULTILOGIN_PRESERVE_COOKIE_ACCOUNTS_ORDER;
std::vector<std::string> accounts_to_send; std::vector<std::string> accounts_to_send;
if (delegate_->ReorderChromeAccountsForReconcileIfNeeded( if (delegate_->ReorderChromeAccountsForReconcileIfNeeded(
chrome_accounts, primary_account, gaia_accounts, &accounts_to_send)) { chrome_accounts, primary_account, gaia_accounts, &accounts_to_send)) {
...@@ -439,7 +445,13 @@ void AccountReconcilor::FinishReconcileWithMultiloginEndpoint( ...@@ -439,7 +445,13 @@ void AccountReconcilor::FinishReconcileWithMultiloginEndpoint(
} else { } else {
OnSetAccountsInCookieCompleted(GoogleServiceAuthError::AuthErrorNone()); OnSetAccountsInCookieCompleted(GoogleServiceAuthError::AuthErrorNone());
} }
// TODO(valeriyas): Log operation here.
VLOG(1) << "AccountReconcilor::FinishReconcileWithMultiloginEndpoint "
<< "in mode: "
<< (mode == signin::MultiloginMode::
MULTILOGIN_UPDATE_COOKIE_ACCOUNTS_ORDER
? "UPDATE"
: "PRESERVE");
// TODO (valeriyas): Write correct first gaia account to cache for desktop. // TODO (valeriyas): Write correct first gaia account to cache for desktop.
if (!is_reconcile_started_) if (!is_reconcile_started_)
delegate_->OnReconcileFinished(primary_account, reconcile_is_noop_); delegate_->OnReconcileFinished(primary_account, reconcile_is_noop_);
......
...@@ -44,6 +44,10 @@ bool AccountReconcilorDelegate::ReorderChromeAccountsForReconcileIfNeeded( ...@@ -44,6 +44,10 @@ bool AccountReconcilorDelegate::ReorderChromeAccountsForReconcileIfNeeded(
return false; return false;
} }
bool AccountReconcilorDelegate::ShouldUpdateAccountsOrderInCookies() const {
return true;
}
AccountReconcilorDelegate::RevokeTokenOption AccountReconcilorDelegate::RevokeTokenOption
AccountReconcilorDelegate::ShouldRevokeSecondaryTokensBeforeReconcile( AccountReconcilorDelegate::ShouldRevokeSecondaryTokensBeforeReconcile(
const std::vector<gaia::ListedAccount>& gaia_accounts) { const std::vector<gaia::ListedAccount>& gaia_accounts) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "base/time/time.h" #include "base/time/time.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/google_service_auth_error.h"
...@@ -71,6 +72,10 @@ class AccountReconcilorDelegate { ...@@ -71,6 +72,10 @@ class AccountReconcilorDelegate {
const std::vector<gaia::ListedAccount>& gaia_accounts, const std::vector<gaia::ListedAccount>& gaia_accounts,
std::vector<std::string>* accounts_to_send) const; std::vector<std::string>* accounts_to_send) const;
// Returns true if it is allowed to change the order of the gaia accounts
// (e.g. on mobile or on stratup). Default is true.
virtual bool ShouldUpdateAccountsOrderInCookies() const;
// Returns whether secondary accounts should be revoked at the beginning of // Returns whether secondary accounts should be revoked at the beginning of
// the reconcile. // the reconcile.
virtual RevokeTokenOption ShouldRevokeSecondaryTokensBeforeReconcile( virtual RevokeTokenOption ShouldRevokeSecondaryTokensBeforeReconcile(
......
...@@ -33,6 +33,15 @@ ...@@ -33,6 +33,15 @@
class GaiaAuthFetcherTest; class GaiaAuthFetcherTest;
namespace signin {
// Mode determining whether Gaia can change the order of the accounts in
// cookies.
enum class MultiloginMode {
MULTILOGIN_UPDATE_COOKIE_ACCOUNTS_ORDER = 0,
MULTILOGIN_PRESERVE_COOKIE_ACCOUNTS_ORDER
};
} // namespace signin
namespace network { namespace network {
class SimpleURLLoader; class SimpleURLLoader;
class SharedURLLoaderFactory; class SharedURLLoaderFactory;
......
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