OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PROFILE_CHANGE_PROCESSOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_CHANGE_PROCESSOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_CHANGE_PROCESSOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_CHANGE_PROCESSOR_H_ |
7 #pragma once | 7 #pragma once |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 virtual void AddAutofillProfileSyncNode(sync_api::WriteTransaction* trans, | 74 virtual void AddAutofillProfileSyncNode(sync_api::WriteTransaction* trans, |
75 sync_api::BaseNode& autofill_profile_root, | 75 sync_api::BaseNode& autofill_profile_root, |
76 const AutofillProfile& profile); | 76 const AutofillProfile& profile); |
77 | 77 |
78 void ActOnChange(AutofillProfileChange* change, | 78 void ActOnChange(AutofillProfileChange* change, |
79 sync_api::WriteTransaction* trans, | 79 sync_api::WriteTransaction* trans, |
80 sync_api::ReadNode& autofill_root); | 80 sync_api::ReadNode& autofill_root); |
81 | 81 |
82 private: | 82 private: |
83 | 83 friend class ScopedStopObserving<AutofillProfileChangeProcessor>; |
84 // This ensures that startobsrving gets called after stopobserving even | |
85 // if there is an early return in the function. | |
86 // TODO(lipalani) - generalize this and add it to other change processors. | |
87 class ScopedStopObserving { | |
88 public: | |
89 explicit ScopedStopObserving(AutofillProfileChangeProcessor* processor); | |
90 ~ScopedStopObserving(); | |
91 | |
92 private: | |
93 ScopedStopObserving() {} | |
94 AutofillProfileChangeProcessor* processor_; | |
95 }; | |
96 | 84 |
97 void StartObserving(); | 85 void StartObserving(); |
98 void StopObserving(); | 86 void StopObserving(); |
99 | 87 |
100 void PostOptimisticRefreshTask(); | 88 void PostOptimisticRefreshTask(); |
101 | 89 |
102 void ApplyAutofillProfileChange( | 90 void ApplyAutofillProfileChange( |
103 sync_api::SyncManager::ChangeRecord::Action action, | 91 sync_api::SyncManager::ChangeRecord::Action action, |
104 const sync_pb::AutofillProfileSpecifics& profile, | 92 const sync_pb::AutofillProfileSpecifics& profile, |
105 int64 sync_id); | 93 int64 sync_id); |
106 | 94 |
107 void RemoveSyncNode( | 95 void RemoveSyncNode( |
108 const std::string& guid, sync_api::WriteTransaction *trans); | 96 const std::string& guid, sync_api::WriteTransaction *trans); |
109 | 97 |
110 AutofillProfileModelAssociator* model_associator_; | 98 AutofillProfileModelAssociator* model_associator_; |
111 bool observing_; | 99 bool observing_; |
112 | 100 |
113 WebDatabase* web_database_; | 101 WebDatabase* web_database_; |
114 PersonalDataManager* personal_data_; | 102 PersonalDataManager* personal_data_; |
115 NotificationRegistrar notification_registrar_; | 103 NotificationRegistrar notification_registrar_; |
116 }; | 104 }; |
117 | 105 |
118 } // namespace browser_sync | 106 } // namespace browser_sync |
119 | 107 |
120 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_CHANGE_PROCESSOR_H_ | 108 #endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_CHANGE_PROCESSOR_H_ |
121 | |
OLD | NEW |