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 virtual syncer::ModelType type() const OVERRIDE;
36 virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE;
37 virtual 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 virtual bool PostTaskOnBackendThread(
46 const tracked_objects::Location& from_here,
47 const base::Closure& task) OVERRIDE;
48 virtual ProfileSyncComponentsFactory::SyncComponents CreateSyncComponents()
50 virtual void DisconnectProcessor(
51 sync_driver::ChangeProcessor* processor) OVERRIDE;
54 virtual ~TypedUrlDataTypeController();
56 void OnSavingBrowserHistoryDisabledChanged();
58 history::HistoryBackend* backend_;
59 PrefChangeRegistrar pref_registrar_;
61 // Helper object to make sure we don't leave tasks running on the history
63 base::CancelableTaskTracker task_tracker_;
65 DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController);
68 } // namespace browser_sync
70 #endif // CHROME_BROWSER_SYNC_GLUE_TYPED_URL_DATA_TYPE_CONTROLLER_H__