1 // Copyright 2018 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 
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_
7 
8 #include "base/callback_forward.h"
9 #include "base/macros.h"
10 #include "components/sync/driver/syncable_service_based_model_type_controller.h"
11 
12 class Profile;
13 
14 // A DataTypeController for supervised user sync datatypes, which enables or
15 // disables these types based on the profile's IsSupervised state. Runs in
16 // sync transport mode.
17 class SupervisedUserSyncModelTypeController
18     : public syncer::SyncableServiceBasedModelTypeController {
19  public:
20   // |sync_client| and |profile| must not be null and must outlive this object.
21   SupervisedUserSyncModelTypeController(
22       syncer::ModelType type,
23       const Profile* profile,
24       const base::RepeatingClosure& dump_stack,
25       syncer::OnceModelTypeStoreFactory store_factory,
26       base::WeakPtr<syncer::SyncableService> syncable_service);
27   ~SupervisedUserSyncModelTypeController() override;
28 
29   // DataTypeController override.
30   PreconditionState GetPreconditionState() const override;
31 
32  private:
33   const Profile* const profile_;
34 
35   DISALLOW_COPY_AND_ASSIGN(SupervisedUserSyncModelTypeController);
36 };
37 
38 #endif  // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SYNC_MODEL_TYPE_CONTROLLER_H_
39