Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / glue / autofill_profile_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_PROFILE_DATA_TYPE_CONTROLLER_H_
6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/scoped_observer.h"
11 #include "components/autofill/core/browser/personal_data_manager_observer.h"
12 #include "components/sync_driver/non_ui_data_type_controller.h"
13
14 class Profile;
15 class ProfileSyncComponentsFactory;
16
17 namespace autofill {
18 class PersonalDataManager;
19 }  // namespace autofill
20
21 namespace browser_sync {
22
23 class AutofillProfileDataTypeController
24     : public sync_driver::NonUIDataTypeController,
25       public autofill::PersonalDataManagerObserver {
26  public:
27   AutofillProfileDataTypeController(
28       ProfileSyncComponentsFactory* profile_sync_factory,
29       Profile* profile);
30
31   // NonUIDataTypeController implementation.
32   syncer::ModelType type() const override;
33   syncer::ModelSafeGroup model_safe_group() const override;
34
35   // PersonalDataManagerObserver implementation:
36   void OnPersonalDataChanged() override;
37
38  protected:
39   ~AutofillProfileDataTypeController() override;
40
41   // NonUIDataTypeController implementation.
42   bool PostTaskOnBackendThread(const tracked_objects::Location& from_here,
43                                const base::Closure& task) override;
44   bool StartModels() override;
45   void StopModels() override;
46
47  private:
48   // Callback to notify that WebDatabase has loaded.
49   void WebDatabaseLoaded();
50
51   Profile* const profile_;
52   autofill::PersonalDataManager* personal_data_;
53   bool callback_registered_;
54
55   DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController);
56 };
57
58 }  // namespace browser_sync
59
60 #endif  // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_