blob: 5272ae724f6210b280d9c5b5810c5883b42188e1 [file] [log] [blame]
maxbogue93150a5d2015-08-31 21:08:321// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
maxbogue455a57e32016-08-14 00:08:325#include "components/sync/driver/sync_service.h"
maxbogue93150a5d2015-08-31 21:08:326
maxbogue7e006db2016-10-03 19:48:287namespace syncer {
maxbogue93150a5d2015-08-31 21:08:328
tommyclif3a1551e2016-06-21 18:11:239SyncSetupInProgressHandle::SyncSetupInProgressHandle(base::Closure on_destroy)
10 : on_destroy_(on_destroy) {}
11
12SyncSetupInProgressHandle::~SyncSetupInProgressHandle() {
13 on_destroy_.Run();
14}
15
Marc Treibdb1e1a0f2018-07-07 15:30:4816bool SyncService::CanSyncStart() const {
Marc Treib6a2be532018-07-16 18:30:1517 return GetDisableReasons() == DISABLE_REASON_NONE;
Marc Treibdb1e1a0f2018-07-07 15:30:4818}
19
20bool SyncService::IsSyncAllowed() const {
21 return !HasDisableReason(DISABLE_REASON_PLATFORM_OVERRIDE) &&
22 !HasDisableReason(DISABLE_REASON_ENTERPRISE_POLICY);
23}
24
Marc Treib94702442018-07-19 09:04:4325bool SyncService::IsSyncActive() const {
26 State state = GetState();
27 return state == State::CONFIGURING || state == State::ACTIVE;
28}
29
Marc Treib2eac56fd2018-07-20 13:29:3330bool SyncService::IsFirstSetupInProgress() const {
31 return !IsFirstSetupComplete() && IsSetupInProgress();
32}
33
Marc Treibdb1e1a0f2018-07-07 15:30:4834bool SyncService::HasUnrecoverableError() const {
35 return HasDisableReason(DISABLE_REASON_UNRECOVERABLE_ERROR);
36}
37
maxbogue7e006db2016-10-03 19:48:2838} // namespace syncer