| 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/async_directory_type_controller.h" |
| 14 | 14 |
| 15 namespace autofill { | 15 namespace autofill { |
| 16 class AutofillWebDataService; | 16 class AutofillWebDataService; |
| 17 } // namespace autofill | 17 } // namespace autofill |
| 18 | 18 |
| 19 namespace browser_sync { | 19 namespace browser_sync { |
| 20 | 20 |
| 21 // Controls syncing of the AUTOFILL_PROFILE data type. | 21 // Controls syncing of the AUTOFILL_PROFILE data type. |
| 22 class AutofillProfileDataTypeController | 22 class AutofillProfileDataTypeController |
| 23 : public syncer::NonUIDataTypeController, | 23 : public syncer::AsyncDirectoryTypeController, |
| 24 public autofill::PersonalDataManagerObserver { | 24 public autofill::PersonalDataManagerObserver { |
| 25 public: | 25 public: |
| 26 // |dump_stack| is called when an unrecoverable error occurs. | 26 // |dump_stack| is called when an unrecoverable error occurs. |
| 27 AutofillProfileDataTypeController( | 27 AutofillProfileDataTypeController( |
| 28 scoped_refptr<base::SingleThreadTaskRunner> db_thread, | 28 scoped_refptr<base::SingleThreadTaskRunner> db_thread, |
| 29 const base::Closure& dump_stack, | 29 const base::Closure& dump_stack, |
| 30 syncer::SyncClient* sync_client, | 30 syncer::SyncClient* sync_client, |
| 31 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service); | 31 const scoped_refptr<autofill::AutofillWebDataService>& web_data_service); |
| 32 ~AutofillProfileDataTypeController() override; | 32 ~AutofillProfileDataTypeController() override; |
| 33 | 33 |
| 34 // PersonalDataManagerObserver: | 34 // PersonalDataManagerObserver: |
| 35 void OnPersonalDataChanged() override; | 35 void OnPersonalDataChanged() override; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 // NonUIDataTypeController: | 38 // AsyncDirectoryTypeController: |
| 39 bool StartModels() override; | 39 bool StartModels() override; |
| 40 void StopModels() override; | 40 void StopModels() override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Callback to notify that WebDatabase has loaded. | 43 // Callback to notify that WebDatabase has loaded. |
| 44 void WebDatabaseLoaded(); | 44 void WebDatabaseLoaded(); |
| 45 | 45 |
| 46 // A pointer to the sync client. | 46 // A pointer to the sync client. |
| 47 syncer::SyncClient* const sync_client_; | 47 syncer::SyncClient* const sync_client_; |
| 48 | 48 |
| 49 // A reference to the AutofillWebDataService for this controller. | 49 // A reference to the AutofillWebDataService for this controller. |
| 50 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; | 50 scoped_refptr<autofill::AutofillWebDataService> web_data_service_; |
| 51 | 51 |
| 52 // Whether the database loaded callback has been registered. | 52 // Whether the database loaded callback has been registered. |
| 53 bool callback_registered_; | 53 bool callback_registered_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController); | 55 DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace browser_sync | 58 } // namespace browser_sync |
| 59 | 59 |
| 60 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_C
ONTROLLER_H_ | 60 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_PROFILE_DATA_TYPE_C
ONTROLLER_H_ |
| OLD | NEW |