OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_CONT
ROLLER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_CONT
ROLLER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_CONT
ROLLER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_CONT
ROLLER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" |
12 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 12 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
13 #include "components/sync/driver/non_ui_data_type_controller.h" | 13 #include "components/sync/driver/non_ui_data_type_controller.h" |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 class AutofillWebDataService; | 16 class AutofillWebDataService; |
17 class PersonalDataManager; | 17 class PersonalDataManager; |
18 } // namespace autofill | 18 } // namespace autofill |
19 | 19 |
20 namespace browser_sync { | 20 namespace browser_sync { |
21 | 21 |
22 // Controls syncing of the AUTOFILL_PROFILE data type. | 22 // Controls syncing of the AUTOFILL_PROFILE data type. |
23 class AutofillProfileDataTypeController | 23 class AutofillProfileDataTypeController |
24 : public syncer::NonUIDataTypeController, | 24 : public sync_driver::NonUIDataTypeController, |
25 public autofill::PersonalDataManagerObserver { | 25 public autofill::PersonalDataManagerObserver { |
26 public: | 26 public: |
27 // |dump_stack| is called when an unrecoverable error occurs. | 27 // |dump_stack| is called when an unrecoverable error occurs. |
28 AutofillProfileDataTypeController( | 28 AutofillProfileDataTypeController( |
29 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 29 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
30 const base::Closure& dump_stack, | 30 const base::Closure& dump_stack, |
31 syncer::SyncClient* sync_client, | 31 sync_driver::SyncClient* sync_client, |
32 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service); | 32 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service); |
33 ~AutofillProfileDataTypeController() override; | 33 ~AutofillProfileDataTypeController() override; |
34 | 34 |
35 // NonUIDataTypeController: | 35 // NonUIDataTypeController: |
36 syncer::ModelSafeGroup model_safe_group() const override; | 36 syncer::ModelSafeGroup model_safe_group() const override; |
37 | 37 |
38 // PersonalDataManagerObserver: | 38 // PersonalDataManagerObserver: |
39 void OnPersonalDataChanged() override; | 39 void OnPersonalDataChanged() override; |
40 | 40 |
41 protected: | 41 protected: |
42 // NonUIDataTypeController: | 42 // NonUIDataTypeController: |
43 bool PostTaskOnBackendThread(const tracked_objects::Location& from_here, | 43 bool PostTaskOnBackendThread(const tracked_objects::Location& from_here, |
44 const base::Closure& task) override; | 44 const base::Closure& task) override; |
45 bool StartModels() override; | 45 bool StartModels() override; |
46 void StopModels() override; | 46 void StopModels() override; |
47 | 47 |
48 private: | 48 private: |
49 // Callback to notify that WebDatabase has loaded. | 49 // Callback to notify that WebDatabase has loaded. |
50 void WebDatabaseLoaded(); | 50 void WebDatabaseLoaded(); |
51 | 51 |
52 // A reference to the DB thread's task runner. | 52 // A reference to the DB thread's task runner. |
53 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; | 53 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; |
54 | 54 |
55 // A pointer to the sync client. | 55 // A pointer to the sync client. |
56 syncer::SyncClient* const sync_client_; | 56 sync_driver::SyncClient* const sync_client_; |
57 | 57 |
58 // A reference to the AutofillWebDataService for this controller. | 58 // A reference to the AutofillWebDataService for this controller. |
59 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 59 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; |
60 | 60 |
61 // Whether the database loaded callback has been registered. | 61 // Whether the database loaded callback has been registered. |
62 bool callback_registered_; | 62 bool callback_registered_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController); | 64 DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace browser_sync | 67 } // namespace browser_sync |
68 | 68 |
69 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_C
ONTROLLER_H_ | 69 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_C
ONTROLLER_H_ |
OLD | NEW |