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_AUTOFILL_DATA_TYPE_CONTROLLER_H__
6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_DATA_TYPE_CONTROLLER_H__
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h"
13 #include "chrome/browser/sync/glue/non_ui_data_type_controller.h"
16 class AutofillWebDataService;
17 } // namespace autofill
19 namespace browser_sync {
21 // A class that manages the startup and shutdown of autofill sync.
22 class AutofillDataTypeController
23 : public NonUIDataTypeController {
25 AutofillDataTypeController(
26 ProfileSyncComponentsFactory* profile_sync_factory,
28 ProfileSyncService* sync_service);
30 // NonUIDataTypeController implementation.
31 virtual syncer::ModelType type() const OVERRIDE;
32 virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE;
34 // NonFrontendDatatypeController override, needed as stop-gap until bug
35 // 163431 is addressed / implemented.
36 virtual void StartAssociating(const StartCallback& start_callback) OVERRIDE;
39 virtual ~AutofillDataTypeController();
41 // NonUIDataTypeController implementation.
42 virtual bool PostTaskOnBackendThread(
43 const tracked_objects::Location& from_here,
44 const base::Closure& task) OVERRIDE;
45 virtual bool StartModels() OVERRIDE;
46 virtual void StopModels() OVERRIDE;
49 friend class AutofillDataTypeControllerTest;
50 FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSReady);
51 FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSNotReady);
53 // Self-invoked on the DB thread to call the AutocompleteSyncableService with
54 // an updated value of autofill culling settings.
55 void UpdateAutofillCullingSettings(bool cull_expired_entries,
56 scoped_refptr<autofill::AutofillWebDataService> web_data_service);
58 // Callback once WebDatabase has loaded.
59 void WebDatabaseLoaded();
61 DISALLOW_COPY_AND_ASSIGN(AutofillDataTypeController);
64 } // namespace browser_sync
66 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_DATA_TYPE_CONTROLLER_H__