Commit 24920cae authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

ProfileSyncService: Remove handling of IsSyncAllowedByFlag

If IsSyncAllowedByFlag is false, then the ProfileSyncService isn't even
instantiated (its factory checks for that). So no need to handle it in
the service.
This CL replaces corresponding "if"s with DCHECKs. It also updates the
comment for DISABLE_REASON_PLATFORM_OVERRIDE, which now doesn't include
the commandline flag anymore.

Bug: 839834
Change-Id: Ia8466bb1eddddc4b55ab8477e9d8a4a6a0017bf5
Reviewed-on: https://chromium-review.googlesource.com/1151200Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578274}
parent af04411a
......@@ -205,6 +205,10 @@ ProfileSyncService::ProfileSyncService(InitParams init_params)
DCHECK(signin_scoped_device_id_callback_);
DCHECK(sync_client_);
// If Sync is disabled via command line flag, then ProfileSyncService
// shouldn't be instantiated.
DCHECK(IsSyncAllowedByFlag());
ResetCryptoState();
std::string last_version = sync_prefs_.GetLastRunVersion();
......@@ -731,8 +735,12 @@ void ProfileSyncService::StopImpl(SyncStopDataFate data_fate) {
int ProfileSyncService::GetDisableReasons() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// If Sync is disabled via command line flag, then ProfileSyncService
// shouldn't even be instantiated.
DCHECK(IsSyncAllowedByFlag());
int result = DISABLE_REASON_NONE;
if (!IsSyncAllowedByFlag() || !IsSyncAllowedByPlatform()) {
if (!IsSyncAllowedByPlatform()) {
result = result | DISABLE_REASON_PLATFORM_OVERRIDE;
}
if (sync_prefs_.IsManaged() || sync_disabled_by_admin_) {
......
......@@ -61,8 +61,8 @@ class SyncService : public DataTypeEncryptionHandler, public KeyedService {
// bitmask.
enum DisableReason {
DISABLE_REASON_NONE = 0,
// Sync is disabled via command-line flag or platform-level override (e.g.
// Android's "MasterSync" toggle).
// Sync is disabled via platform-level override (e.g. Android's "MasterSync"
// toggle).
DISABLE_REASON_PLATFORM_OVERRIDE = 1 << 0,
// Sync is disabled by enterprise policy, either browser policy (through
// prefs) or account policy received from the Sync server.
......
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