| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 int change_count); | 56 int change_count); |
| 57 | 57 |
| 58 // Commit any changes from ApplyChangesFromSyncModel buffered in | 58 // Commit any changes from ApplyChangesFromSyncModel buffered in |
| 59 // autofill_changes_. | 59 // autofill_changes_. |
| 60 virtual void CommitChangesFromSyncModel(); | 60 virtual void CommitChangesFromSyncModel(); |
| 61 | 61 |
| 62 // Copy the properties of the given Autofill entry into the sync | 62 // Copy the properties of the given Autofill entry into the sync |
| 63 // node. | 63 // node. |
| 64 static void WriteAutofillEntry(const AutofillEntry& entry, | 64 static void WriteAutofillEntry(const AutofillEntry& entry, |
| 65 sync_api::WriteNode* node); | 65 sync_api::WriteNode* node); |
| 66 // As above, for autofill profiles. | |
| 67 static void WriteAutofillProfile(const AutoFillProfile& profile, | |
| 68 sync_api::WriteNode* node); | |
| 69 // TODO(georgey) : add the same processing for CC info (already in protocol | 66 // TODO(georgey) : add the same processing for CC info (already in protocol |
| 70 // buffers). | 67 // buffers). |
| 71 | 68 |
| 72 protected: | 69 protected: |
| 73 virtual void StartImpl(Profile* profile); | 70 virtual void StartImpl(Profile* profile); |
| 74 virtual void StopImpl(); | 71 virtual void StopImpl(); |
| 75 | 72 |
| 76 private: | 73 private: |
| 77 void StartObserving(); | 74 void StartObserving(); |
| 78 void StopObserving(); | 75 void StopObserving(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 105 void ApplySyncAutofillEntryDelete( | 102 void ApplySyncAutofillEntryDelete( |
| 106 const sync_pb::AutofillSpecifics& autofill); | 103 const sync_pb::AutofillSpecifics& autofill); |
| 107 void ApplySyncAutofillProfileDelete( | 104 void ApplySyncAutofillProfileDelete( |
| 108 int64 sync_id); | 105 int64 sync_id); |
| 109 | 106 |
| 110 // Helper to post a task to the UI loop to inform the PersonalDataManager | 107 // Helper to post a task to the UI loop to inform the PersonalDataManager |
| 111 // it needs to refresh itself. | 108 // it needs to refresh itself. |
| 112 void PostOptimisticRefreshTask(); | 109 void PostOptimisticRefreshTask(); |
| 113 | 110 |
| 114 // Called to see if we need to upgrade to the new autofill2 profile. | 111 // Called to see if we need to upgrade to the new autofill2 profile. |
| 115 bool HasNotMigratedYet(); | 112 bool HasNotMigratedYet(const sync_api::BaseTransaction* trans); |
| 116 | 113 |
| 117 // The two models should be associated according to this ModelAssociator. | 114 // The two models should be associated according to this ModelAssociator. |
| 118 AutofillModelAssociator* model_associator_; | 115 AutofillModelAssociator* model_associator_; |
| 119 | 116 |
| 120 // The model we are processing changes from. This is owned by the | 117 // The model we are processing changes from. This is owned by the |
| 121 // WebDataService which is kept alive by our data type controller | 118 // WebDataService which is kept alive by our data type controller |
| 122 // holding a reference. | 119 // holding a reference. |
| 123 WebDatabase* web_database_; | 120 WebDatabase* web_database_; |
| 124 | 121 |
| 125 // We periodically tell the PersonalDataManager to refresh as we make | 122 // We periodically tell the PersonalDataManager to refresh as we make |
| 126 // changes to the autofill data in the WebDatabase. | 123 // changes to the autofill data in the WebDatabase. |
| 127 PersonalDataManager* personal_data_; | 124 PersonalDataManager* personal_data_; |
| 128 | 125 |
| 129 NotificationRegistrar notification_registrar_; | 126 NotificationRegistrar notification_registrar_; |
| 130 | 127 |
| 131 bool observing_; | 128 bool observing_; |
| 132 | 129 |
| 133 // Record of changes from ApplyChangesFromSyncModel. These are then processed | 130 // Record of changes from ApplyChangesFromSyncModel. These are then processed |
| 134 // in CommitChangesFromSyncModel. | 131 // in CommitChangesFromSyncModel. |
| 135 struct AutofillChangeRecord; | 132 struct AutofillChangeRecord; |
| 136 std::vector<AutofillChangeRecord> autofill_changes_; | 133 std::vector<AutofillChangeRecord> autofill_changes_; |
| 137 | 134 |
| 138 DISALLOW_COPY_AND_ASSIGN(AutofillChangeProcessor); | 135 DISALLOW_COPY_AND_ASSIGN(AutofillChangeProcessor); |
| 139 }; | 136 }; |
| 140 | 137 |
| 141 } // namespace browser_sync | 138 } // namespace browser_sync |
| 142 | 139 |
| 143 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ | 140 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_CHANGE_PROCESSOR_H_ |
| OLD | NEW |