Commit 19e2f142 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

SyncService::CanSyncFeatureStart: Also check IsAuthenticatedAccountPrimary

Sync-the-feature requires a primary account, so this is more accurate.

Bug: 871221
Change-Id: Iadd226c28d0d82cc86640a3c210f95505a219465
Reviewed-on: https://chromium-review.googlesource.com/c/1339939
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608774}
parent bc260d96
......@@ -17,12 +17,12 @@ bool SyncService::IsSyncFeatureEnabled() const {
// Note: IsFirstSetupComplete() shouldn't usually be true if we don't have a
// primary account, but it could happen if the account changes from primary to
// secondary.
return GetDisableReasons() == DISABLE_REASON_NONE && IsFirstSetupComplete() &&
IsAuthenticatedAccountPrimary();
return CanSyncFeatureStart() && IsFirstSetupComplete();
}
bool SyncService::CanSyncFeatureStart() const {
return GetDisableReasons() == DISABLE_REASON_NONE;
return GetDisableReasons() == DISABLE_REASON_NONE &&
IsAuthenticatedAccountPrimary();
}
bool SyncService::IsEngineInitialized() const {
......
......@@ -188,8 +188,10 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService {
// Sync-the-feature is disabled by the user, by enterprise policy, etc.
bool IsEngineInitialized() const;
// Equivalent to having no disable reasons, i.e.
// "GetDisableReasons() == DISABLE_REASON_NONE".
// Returns whether Sync-the-feature can (attempt to) start. This means that
// there is a primary account and no disable reasons. It does *not* require
// first-time Sync setup to be complete, because that can only happen after
// the engine has started.
// Note: This refers to Sync-the-feature. Sync-the-transport may be running
// even if this is false.
bool CanSyncFeatureStart() const;
......
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