1 // Copyright 2019 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 COMPONENTS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_MODEL_TYPE_CONTROLLER_H_
6 #define COMPONENTS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_MODEL_TYPE_CONTROLLER_H_
7 
8 #include "base/macros.h"
9 #include "components/sync/driver/model_type_controller.h"
10 #include "components/sync/driver/sync_service_observer.h"
11 
12 namespace syncer {
13 class SyncService;
14 }  // namespace syncer
15 
16 namespace send_tab_to_self {
17 
18 // Controls syncing of SEND_TAB_TO_SELF.
19 class SendTabToSelfModelTypeController : public syncer::ModelTypeController,
20                                          public syncer::SyncServiceObserver {
21  public:
22   // The |delegate_for_full_sync_mode| and |sync_service| must not be null.
23   // |delegate_for_transport_mode| can be null. |sync_service| must outlive this
24   // object.
25   SendTabToSelfModelTypeController(
26       syncer::SyncService* sync_service,
27       std::unique_ptr<syncer::ModelTypeControllerDelegate>
28           delegate_for_full_sync_mode,
29       std::unique_ptr<syncer::ModelTypeControllerDelegate>
30           delegate_for_transport_mode);
31   ~SendTabToSelfModelTypeController() override;
32 
33   // DataTypeController overrides.
34   void Stop(syncer::ShutdownReason shutdown_reason,
35             StopCallback callback) override;
36 
37   // DataTypeController overrides.
38   PreconditionState GetPreconditionState() const override;
39 
40   // syncer::SyncServiceObserver implementation.
41   void OnStateChanged(syncer::SyncService* sync) override;
42 
43  private:
44   syncer::SyncService* const sync_service_;
45 
46   DISALLOW_COPY_AND_ASSIGN(SendTabToSelfModelTypeController);
47 };
48 
49 }  // namespace send_tab_to_self
50 
51 #endif  // COMPONENTS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_MODEL_TYPE_CONTROLLER_H_
52