1 // Copyright 2014 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_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_ 7 8 #include "chrome/browser/sync/profile_sync_service_observer.h" 9 #include "components/sync_driver/local_device_info_provider.h" 10 #include "components/sync_driver/ui_data_type_controller.h" 11 12 class Profile; 13 class ProfileSyncService; 14 15 namespace browser_sync { 16 17 // A controller for delete directives, which cannot sync when full encryption 18 // is enabled. 19 class HistoryDeleteDirectivesDataTypeController 20 : public sync_driver::UIDataTypeController, 21 public ProfileSyncServiceObserver { 22 public: 23 HistoryDeleteDirectivesDataTypeController( 24 sync_driver::SyncApiComponentFactory* factory, 25 ProfileSyncService* sync_service); 26 27 // UIDataTypeController override. 28 virtual bool ReadyForStart() const OVERRIDE; 29 virtual bool StartModels() OVERRIDE; 30 virtual void StopModels() OVERRIDE; 31 32 // ProfileSyncServiceBaseObserver implementation. 33 virtual void OnStateChanged() OVERRIDE; 34 35 private: 36 // Refcounted. 37 virtual ~HistoryDeleteDirectivesDataTypeController(); 38 39 // Triggers a SingleDataTypeUnrecoverable error and returns true if the 40 // type is no longer ready, else does nothing and returns false. 41 bool DisableTypeIfNecessary(); 42 43 ProfileSyncService* sync_service_; 44 45 DISALLOW_COPY_AND_ASSIGN(HistoryDeleteDirectivesDataTypeController); 46 }; 47 48 } // namespace browser_sync 49 50 #endif // CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_ 51