summaryrefslogtreecommitdiff
path: root/chrome/browser/sync/glue/history_delete_directives_data_type_controller.h
blob: 7e2bf460e1e47a3c55617e122f87ca42c90cd572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_
#define CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_

#include "chrome/browser/sync/profile_sync_service_observer.h"
#include "components/sync_driver/local_device_info_provider.h"
#include "components/sync_driver/ui_data_type_controller.h"

class Profile;
class ProfileSyncService;

namespace browser_sync {

// A controller for delete directives, which cannot sync when full encryption
// is enabled.
class HistoryDeleteDirectivesDataTypeController
    : public sync_driver::UIDataTypeController,
      public ProfileSyncServiceObserver {
 public:
  HistoryDeleteDirectivesDataTypeController(
      sync_driver::SyncApiComponentFactory* factory,
      ProfileSyncService* sync_service);

  // UIDataTypeController override.
  virtual bool ReadyForStart() const OVERRIDE;
  virtual bool StartModels() OVERRIDE;
  virtual void StopModels() OVERRIDE;

  // ProfileSyncServiceBaseObserver implementation.
  virtual void OnStateChanged() OVERRIDE;

 private:
  // Refcounted.
  virtual ~HistoryDeleteDirectivesDataTypeController();

  // Triggers a SingleDataTypeUnrecoverable error and returns true if the
  // type is no longer ready, else does nothing and returns false.
  bool DisableTypeIfNecessary();

  ProfileSyncService* sync_service_;

  DISALLOW_COPY_AND_ASSIGN(HistoryDeleteDirectivesDataTypeController);
};

}  // namespace browser_sync

#endif  // CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_