1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_SYNC_GLUE_TYPED_URL_DATA_TYPE_CONTROLLER_H__
6 #define CHROME_BROWSER_SYNC_GLUE_TYPED_URL_DATA_TYPE_CONTROLLER_H__
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/prefs/pref_change_registrar.h"
13 #include "base/task/cancelable_task_tracker.h"
14 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h"
22 namespace browser_sync {
26 // A class that manages the startup and shutdown of typed_url sync.
27 class TypedUrlDataTypeController : public NonFrontendDataTypeController {
29 TypedUrlDataTypeController(
30 ProfileSyncComponentsFactory* profile_sync_factory,
32 ProfileSyncService* sync_service);
34 // NonFrontendDataTypeController implementation
35 syncer::ModelType type() const override;
36 syncer::ModelSafeGroup model_safe_group() const override;
37 bool ReadyForStart() const override;
39 // Invoked on the history thread to set our history backend - must be called
40 // before CreateSyncComponents() is invoked.
41 void SetBackend(history::HistoryBackend* backend);
44 // NonFrontendDataTypeController interface.
45 bool PostTaskOnBackendThread(const tracked_objects::Location& from_here,
46 const base::Closure& task) override;
47 ProfileSyncComponentsFactory::SyncComponents CreateSyncComponents() override;
48 void DisconnectProcessor(sync_driver::ChangeProcessor* processor) override;
51 ~TypedUrlDataTypeController() override;
53 void OnSavingBrowserHistoryDisabledChanged();
55 history::HistoryBackend* backend_;
56 PrefChangeRegistrar pref_registrar_;
58 // Helper object to make sure we don't leave tasks running on the history
60 base::CancelableTaskTracker task_tracker_;
62 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController);
65 } // namespace browser_sync
67 #endif // CHROME_BROWSER_SYNC_GLUE_TYPED_URL_DATA_TYPE_CONTROLLER_H__