Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / glue / autofill_data_type_controller.h
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.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_DATA_TYPE_CONTROLLER_H__
6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_DATA_TYPE_CONTROLLER_H__
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h"
13 #include "components/sync_driver/non_ui_data_type_controller.h"
14
15 class Profile;
16 class ProfileSyncComponentsFactory;
17
18 namespace autofill {
19 class AutofillWebDataService;
20 }  // namespace autofill
21
22 namespace browser_sync {
23
24 // A class that manages the startup and shutdown of autofill sync.
25 class AutofillDataTypeController
26     : public sync_driver::NonUIDataTypeController {
27  public:
28   AutofillDataTypeController(
29       ProfileSyncComponentsFactory* profile_sync_factory,
30       Profile* profile);
31
32   // NonUIDataTypeController implementation.
33   virtual syncer::ModelType type() const OVERRIDE;
34   virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE;
35
36   // NonFrontendDatatypeController override, needed as stop-gap until bug
37   // 163431 is addressed / implemented.
38   virtual void StartAssociating(const StartCallback& start_callback) OVERRIDE;
39
40  protected:
41   virtual ~AutofillDataTypeController();
42
43   // NonUIDataTypeController implementation.
44   virtual bool PostTaskOnBackendThread(
45       const tracked_objects::Location& from_here,
46       const base::Closure& task) OVERRIDE;
47   virtual bool StartModels() OVERRIDE;
48
49  private:
50   friend class AutofillDataTypeControllerTest;
51   FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSReady);
52   FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSNotReady);
53
54   // Callback once WebDatabase has loaded.
55   void WebDatabaseLoaded();
56
57   Profile* const profile_;
58
59   DISALLOW_COPY_AND_ASSIGN(AutofillDataTypeController);
60 };
61
62 }  // namespace browser_sync
63
64 #endif  // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_DATA_TYPE_CONTROLLER_H__