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 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 5 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 return; | 51 return; |
52 | 52 |
53 DCHECK(running()); | 53 DCHECK(running()); |
54 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); | 54 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); |
55 if (!observing_) | 55 if (!observing_) |
56 return; | 56 return; |
57 | 57 |
58 sync_api::WriteTransaction trans(share_handle()); | 58 sync_api::WriteTransaction trans(share_handle()); |
59 sync_api::ReadNode autofill_root(&trans); | 59 sync_api::ReadNode autofill_root(&trans); |
60 if (!autofill_root.InitByTagLookup(kAutofillTag)) { | 60 if (!autofill_root.InitByTagLookup(kAutofillTag)) { |
61 error_handler()->OnUnrecoverableError(); | 61 error_handler()->OnUnrecoverableError(FROM_HERE, |
62 LOG(ERROR) << "Server did not create the top-level autofill node. " | 62 "Server did not create the top-level autofill node. " |
63 << "We might be running against an out-of-date server."; | 63 "We might be running against an out-of-date server."); |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 switch (type.value) { | 67 switch (type.value) { |
68 case NotificationType::AUTOFILL_ENTRIES_CHANGED: { | 68 case NotificationType::AUTOFILL_ENTRIES_CHANGED: { |
69 AutofillChangeList* changes = Details<AutofillChangeList>(details).ptr(); | 69 AutofillChangeList* changes = Details<AutofillChangeList>(details).ptr(); |
70 ObserveAutofillEntriesChanged(changes, &trans, autofill_root); | 70 ObserveAutofillEntriesChanged(changes, &trans, autofill_root); |
71 break; | 71 break; |
72 } | 72 } |
73 case NotificationType::AUTOFILL_PROFILE_CHANGED: { | 73 case NotificationType::AUTOFILL_PROFILE_CHANGED: { |
(...skipping 11 matching lines...) Expand all Loading... |
85 sync_api::BaseTransaction* trans, AutoFillProfile* profile, | 85 sync_api::BaseTransaction* trans, AutoFillProfile* profile, |
86 std::string* tag) { | 86 std::string* tag) { |
87 DCHECK_EQ(AutofillModelAssociator::ProfileLabelToTag(profile->Label()), | 87 DCHECK_EQ(AutofillModelAssociator::ProfileLabelToTag(profile->Label()), |
88 *tag); | 88 *tag); |
89 sync_api::ReadNode read_node(trans); | 89 sync_api::ReadNode read_node(trans); |
90 if (read_node.InitByClientTagLookup(syncable::AUTOFILL, *tag)) { | 90 if (read_node.InitByClientTagLookup(syncable::AUTOFILL, *tag)) { |
91 // Handle the edge case of duplicate labels. | 91 // Handle the edge case of duplicate labels. |
92 string16 label(AutofillModelAssociator::MakeUniqueLabel(profile->Label(), | 92 string16 label(AutofillModelAssociator::MakeUniqueLabel(profile->Label(), |
93 trans)); | 93 trans)); |
94 if (label.empty()) { | 94 if (label.empty()) { |
95 error_handler()->OnUnrecoverableError(); | 95 error_handler()->OnUnrecoverableError(FROM_HERE, |
| 96 "No unique label; can't move aside"); |
96 return; | 97 return; |
97 } | 98 } |
98 tag->assign(AutofillModelAssociator::ProfileLabelToTag(label)); | 99 tag->assign(AutofillModelAssociator::ProfileLabelToTag(label)); |
99 | 100 |
100 profile->set_label(label); | 101 profile->set_label(label); |
101 if (!web_database_->UpdateAutoFillProfile(*profile)) { | 102 if (!web_database_->UpdateAutoFillProfile(*profile)) { |
102 LOG(ERROR) << "Failed to overwrite label for node" << label; | 103 std::string err = "Failed to overwrite label for node "; |
103 error_handler()->OnUnrecoverableError(); | 104 err += UTF16ToUTF8(label); |
| 105 error_handler()->OnUnrecoverableError(FROM_HERE, err); |
104 return; | 106 return; |
105 } | 107 } |
106 | 108 |
107 // Notify the PersonalDataManager that it's out of date. | 109 // Notify the PersonalDataManager that it's out of date. |
108 PostOptimisticRefreshTask(); | 110 PostOptimisticRefreshTask(); |
109 } | 111 } |
110 } | 112 } |
111 | 113 |
112 void AutofillChangeProcessor::PostOptimisticRefreshTask() { | 114 void AutofillChangeProcessor::PostOptimisticRefreshTask() { |
113 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, | 115 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, |
114 new AutofillModelAssociator::DoOptimisticRefreshTask( | 116 new AutofillModelAssociator::DoOptimisticRefreshTask( |
115 personal_data_)); | 117 personal_data_)); |
116 } | 118 } |
117 | 119 |
118 void AutofillChangeProcessor::AddAutofillProfileSyncNode( | 120 void AutofillChangeProcessor::AddAutofillProfileSyncNode( |
119 sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill, | 121 sync_api::WriteTransaction* trans, const sync_api::BaseNode& autofill, |
120 const std::string& tag, const AutoFillProfile* profile) { | 122 const std::string& tag, const AutoFillProfile* profile) { |
121 sync_api::WriteNode sync_node(trans); | 123 sync_api::WriteNode sync_node(trans); |
122 if (!sync_node.InitUniqueByCreation(syncable::AUTOFILL, autofill, tag)) { | 124 if (!sync_node.InitUniqueByCreation(syncable::AUTOFILL, autofill, tag)) { |
123 LOG(ERROR) << "Failed to create autofill sync node."; | 125 error_handler()->OnUnrecoverableError(FROM_HERE, |
124 error_handler()->OnUnrecoverableError(); | 126 "Failed to create autofill sync node."); |
125 return; | 127 return; |
126 } | 128 } |
127 sync_node.SetTitle(UTF8ToWide(tag)); | 129 sync_node.SetTitle(UTF8ToWide(tag)); |
128 | 130 |
129 WriteAutofillProfile(*profile, &sync_node); | 131 WriteAutofillProfile(*profile, &sync_node); |
130 model_associator_->Associate(&tag, sync_node.GetId()); | 132 model_associator_->Associate(&tag, sync_node.GetId()); |
131 } | 133 } |
132 | 134 |
133 void AutofillChangeProcessor::ObserveAutofillProfileChanged( | 135 void AutofillChangeProcessor::ObserveAutofillProfileChanged( |
134 AutofillProfileChange* change, sync_api::WriteTransaction* trans, | 136 AutofillProfileChange* change, sync_api::WriteTransaction* trans, |
(...skipping 18 matching lines...) Expand all Loading... |
153 RemoveSyncNode(AutofillModelAssociator::ProfileLabelToTag( | 155 RemoveSyncNode(AutofillModelAssociator::ProfileLabelToTag( |
154 change->pre_update_label()), trans); | 156 change->pre_update_label()), trans); |
155 // Watch out! Could be relabelling to an existing label! | 157 // Watch out! Could be relabelling to an existing label! |
156 HandleMoveAsideIfNeeded(trans, clone.get(), &tag); | 158 HandleMoveAsideIfNeeded(trans, clone.get(), &tag); |
157 AddAutofillProfileSyncNode(trans, autofill_root, tag, | 159 AddAutofillProfileSyncNode(trans, autofill_root, tag, |
158 clone.get()); | 160 clone.get()); |
159 return; | 161 return; |
160 } | 162 } |
161 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); | 163 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); |
162 if (sync_api::kInvalidId == sync_id) { | 164 if (sync_api::kInvalidId == sync_id) { |
163 LOG(ERROR) << "Unexpected notification for: " << tag; | 165 std::string err = "Unexpected notification for: " + tag; |
164 error_handler()->OnUnrecoverableError(); | 166 error_handler()->OnUnrecoverableError(FROM_HERE, err); |
165 return; | 167 return; |
166 } else { | 168 } else { |
167 if (!sync_node.InitByIdLookup(sync_id)) { | 169 if (!sync_node.InitByIdLookup(sync_id)) { |
168 LOG(ERROR) << "Autofill node lookup failed."; | 170 error_handler()->OnUnrecoverableError(FROM_HERE, |
169 error_handler()->OnUnrecoverableError(); | 171 "Autofill node lookup failed."); |
170 return; | 172 return; |
171 } | 173 } |
172 WriteAutofillProfile(*change->profile(), &sync_node); | 174 WriteAutofillProfile(*change->profile(), &sync_node); |
173 } | 175 } |
174 break; | 176 break; |
175 } | 177 } |
176 case AutofillProfileChange::REMOVE: { | 178 case AutofillProfileChange::REMOVE: { |
177 RemoveSyncNode(tag, trans); | 179 RemoveSyncNode(tag, trans); |
178 break; | 180 break; |
179 } | 181 } |
180 } | 182 } |
181 } | 183 } |
182 | 184 |
183 void AutofillChangeProcessor::ObserveAutofillEntriesChanged( | 185 void AutofillChangeProcessor::ObserveAutofillEntriesChanged( |
184 AutofillChangeList* changes, sync_api::WriteTransaction* trans, | 186 AutofillChangeList* changes, sync_api::WriteTransaction* trans, |
185 const sync_api::ReadNode& autofill_root) { | 187 const sync_api::ReadNode& autofill_root) { |
186 for (AutofillChangeList::iterator change = changes->begin(); | 188 for (AutofillChangeList::iterator change = changes->begin(); |
187 change != changes->end(); ++change) { | 189 change != changes->end(); ++change) { |
188 switch (change->type()) { | 190 switch (change->type()) { |
189 case AutofillChange::ADD: | 191 case AutofillChange::ADD: |
190 { | 192 { |
191 sync_api::WriteNode sync_node(trans); | 193 sync_api::WriteNode sync_node(trans); |
192 std::string tag = | 194 std::string tag = |
193 AutofillModelAssociator::KeyToTag(change->key().name(), | 195 AutofillModelAssociator::KeyToTag(change->key().name(), |
194 change->key().value()); | 196 change->key().value()); |
195 if (!sync_node.InitUniqueByCreation(syncable::AUTOFILL, | 197 if (!sync_node.InitUniqueByCreation(syncable::AUTOFILL, |
196 autofill_root, tag)) { | 198 autofill_root, tag)) { |
197 LOG(ERROR) << "Failed to create autofill sync node."; | 199 error_handler()->OnUnrecoverableError(FROM_HERE, |
198 error_handler()->OnUnrecoverableError(); | 200 "Failed to create autofill sync node."); |
199 return; | 201 return; |
200 } | 202 } |
201 | 203 |
202 std::vector<base::Time> timestamps; | 204 std::vector<base::Time> timestamps; |
203 if (!web_database_->GetAutofillTimestamps( | 205 if (!web_database_->GetAutofillTimestamps( |
204 change->key().name(), | 206 change->key().name(), |
205 change->key().value(), | 207 change->key().value(), |
206 ×tamps)) { | 208 ×tamps)) { |
207 LOG(ERROR) << "Failed to get timestamps."; | 209 error_handler()->OnUnrecoverableError(FROM_HERE, |
208 error_handler()->OnUnrecoverableError(); | 210 "Failed to get timestamps."); |
209 return; | 211 return; |
210 } | 212 } |
211 | 213 |
212 sync_node.SetTitle(UTF16ToWide(change->key().name() + | 214 sync_node.SetTitle(UTF16ToWide(change->key().name() + |
213 change->key().value())); | 215 change->key().value())); |
214 | 216 |
215 WriteAutofillEntry(AutofillEntry(change->key(), timestamps), | 217 WriteAutofillEntry(AutofillEntry(change->key(), timestamps), |
216 &sync_node); | 218 &sync_node); |
217 model_associator_->Associate(&tag, sync_node.GetId()); | 219 model_associator_->Associate(&tag, sync_node.GetId()); |
218 } | 220 } |
219 break; | 221 break; |
220 | 222 |
221 case AutofillChange::UPDATE: | 223 case AutofillChange::UPDATE: |
222 { | 224 { |
223 sync_api::WriteNode sync_node(trans); | 225 sync_api::WriteNode sync_node(trans); |
224 std::string tag = AutofillModelAssociator::KeyToTag( | 226 std::string tag = AutofillModelAssociator::KeyToTag( |
225 change->key().name(), change->key().value()); | 227 change->key().name(), change->key().value()); |
226 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); | 228 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); |
227 if (sync_api::kInvalidId == sync_id) { | 229 if (sync_api::kInvalidId == sync_id) { |
228 LOG(ERROR) << "Unexpected notification for: " << | 230 std::string err = "Unexpected notification for: " + |
229 change->key().name(); | 231 UTF16ToUTF8(change->key().name()); |
230 error_handler()->OnUnrecoverableError(); | 232 error_handler()->OnUnrecoverableError(FROM_HERE, err); |
231 return; | 233 return; |
232 } else { | 234 } else { |
233 if (!sync_node.InitByIdLookup(sync_id)) { | 235 if (!sync_node.InitByIdLookup(sync_id)) { |
234 LOG(ERROR) << "Autofill node lookup failed."; | 236 error_handler()->OnUnrecoverableError(FROM_HERE, |
235 error_handler()->OnUnrecoverableError(); | 237 "Autofill node lookup failed."); |
236 return; | 238 return; |
237 } | 239 } |
238 } | 240 } |
239 | 241 |
240 std::vector<base::Time> timestamps; | 242 std::vector<base::Time> timestamps; |
241 if (!web_database_->GetAutofillTimestamps( | 243 if (!web_database_->GetAutofillTimestamps( |
242 change->key().name(), | 244 change->key().name(), |
243 change->key().value(), | 245 change->key().value(), |
244 ×tamps)) { | 246 ×tamps)) { |
245 LOG(ERROR) << "Failed to get timestamps."; | 247 error_handler()->OnUnrecoverableError(FROM_HERE, |
246 error_handler()->OnUnrecoverableError(); | 248 "Failed to get timestamps."); |
247 return; | 249 return; |
248 } | 250 } |
249 | 251 |
250 WriteAutofillEntry(AutofillEntry(change->key(), timestamps), | 252 WriteAutofillEntry(AutofillEntry(change->key(), timestamps), |
251 &sync_node); | 253 &sync_node); |
252 } | 254 } |
253 break; | 255 break; |
254 case AutofillChange::REMOVE: { | 256 case AutofillChange::REMOVE: { |
255 std::string tag = AutofillModelAssociator::KeyToTag( | 257 std::string tag = AutofillModelAssociator::KeyToTag( |
256 change->key().name(), change->key().value()); | 258 change->key().name(), change->key().value()); |
257 RemoveSyncNode(tag, trans); | 259 RemoveSyncNode(tag, trans); |
258 } | 260 } |
259 break; | 261 break; |
260 } | 262 } |
261 } | 263 } |
262 } | 264 } |
263 | 265 |
264 void AutofillChangeProcessor::RemoveSyncNode(const std::string& tag, | 266 void AutofillChangeProcessor::RemoveSyncNode(const std::string& tag, |
265 sync_api::WriteTransaction* trans) { | 267 sync_api::WriteTransaction* trans) { |
266 sync_api::WriteNode sync_node(trans); | 268 sync_api::WriteNode sync_node(trans); |
267 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); | 269 int64 sync_id = model_associator_->GetSyncIdFromChromeId(tag); |
268 if (sync_api::kInvalidId == sync_id) { | 270 if (sync_api::kInvalidId == sync_id) { |
269 LOG(ERROR) << "Unexpected notification"; | 271 std::string err = "Unexpected notification for: " + tag; |
270 error_handler()->OnUnrecoverableError(); | 272 error_handler()->OnUnrecoverableError(FROM_HERE, err); |
271 return; | 273 return; |
272 } else { | 274 } else { |
273 if (!sync_node.InitByIdLookup(sync_id)) { | 275 if (!sync_node.InitByIdLookup(sync_id)) { |
274 LOG(ERROR) << "Autofill node lookup failed."; | 276 error_handler()->OnUnrecoverableError(FROM_HERE, |
275 error_handler()->OnUnrecoverableError(); | 277 "Autofill node lookup failed."); |
276 return; | 278 return; |
277 } | 279 } |
278 model_associator_->Disassociate(sync_node.GetId()); | 280 model_associator_->Disassociate(sync_node.GetId()); |
279 sync_node.Remove(); | 281 sync_node.Remove(); |
280 } | 282 } |
281 } | 283 } |
282 | 284 |
283 void AutofillChangeProcessor::ApplyChangesFromSyncModel( | 285 void AutofillChangeProcessor::ApplyChangesFromSyncModel( |
284 const sync_api::BaseTransaction* trans, | 286 const sync_api::BaseTransaction* trans, |
285 const sync_api::SyncManager::ChangeRecord* changes, | 287 const sync_api::SyncManager::ChangeRecord* changes, |
286 int change_count) { | 288 int change_count) { |
287 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); | 289 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB)); |
288 if (!running()) | 290 if (!running()) |
289 return; | 291 return; |
290 StopObserving(); | 292 StopObserving(); |
291 | 293 |
292 sync_api::ReadNode autofill_root(trans); | 294 sync_api::ReadNode autofill_root(trans); |
293 if (!autofill_root.InitByTagLookup(kAutofillTag)) { | 295 if (!autofill_root.InitByTagLookup(kAutofillTag)) { |
294 LOG(ERROR) << "Autofill root node lookup failed."; | 296 error_handler()->OnUnrecoverableError(FROM_HERE, |
295 error_handler()->OnUnrecoverableError(); | 297 "Autofill root node lookup failed."); |
296 return; | 298 return; |
297 } | 299 } |
298 | 300 |
299 std::vector<AutofillEntry> new_entries; | 301 std::vector<AutofillEntry> new_entries; |
300 for (int i = 0; i < change_count; ++i) { | 302 for (int i = 0; i < change_count; ++i) { |
301 sync_api::SyncManager::ChangeRecord::Action action(changes[i].action); | 303 sync_api::SyncManager::ChangeRecord::Action action(changes[i].action); |
302 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == action) { | 304 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == action) { |
303 scoped_ptr<ExtraAutofillChangeRecordData> data( | 305 scoped_ptr<ExtraAutofillChangeRecordData> data( |
304 static_cast<ExtraAutofillChangeRecordData*>(changes[i].extra)); | 306 static_cast<ExtraAutofillChangeRecordData*>(changes[i].extra)); |
305 DCHECK(data.get()) << "Extra autofill change record data not present!"; | 307 DCHECK(data.get()) << "Extra autofill change record data not present!"; |
306 const sync_pb::AutofillSpecifics* autofill(data->pre_deletion_data); | 308 const sync_pb::AutofillSpecifics* autofill(data->pre_deletion_data); |
307 if (autofill->has_value()) | 309 if (autofill->has_value()) |
308 ApplySyncAutofillEntryDelete(*autofill); | 310 ApplySyncAutofillEntryDelete(*autofill); |
309 else if (autofill->has_profile()) | 311 else if (autofill->has_profile()) |
310 ApplySyncAutofillProfileDelete(autofill->profile(), changes[i].id); | 312 ApplySyncAutofillProfileDelete(autofill->profile(), changes[i].id); |
311 else | 313 else |
312 NOTREACHED() << "Autofill specifics has no data!"; | 314 NOTREACHED() << "Autofill specifics has no data!"; |
313 continue; | 315 continue; |
314 } | 316 } |
315 | 317 |
316 // Handle an update or add. | 318 // Handle an update or add. |
317 sync_api::ReadNode sync_node(trans); | 319 sync_api::ReadNode sync_node(trans); |
318 if (!sync_node.InitByIdLookup(changes[i].id)) { | 320 if (!sync_node.InitByIdLookup(changes[i].id)) { |
319 LOG(ERROR) << "Autofill node lookup failed."; | 321 error_handler()->OnUnrecoverableError(FROM_HERE, |
320 error_handler()->OnUnrecoverableError(); | 322 "Autofill node lookup failed."); |
321 return; | 323 return; |
322 } | 324 } |
323 | 325 |
324 // Check that the changed node is a child of the autofills folder. | 326 // Check that the changed node is a child of the autofills folder. |
325 DCHECK(autofill_root.GetId() == sync_node.GetParentId()); | 327 DCHECK(autofill_root.GetId() == sync_node.GetParentId()); |
326 DCHECK(syncable::AUTOFILL == sync_node.GetModelType()); | 328 DCHECK(syncable::AUTOFILL == sync_node.GetModelType()); |
327 | 329 |
328 const sync_pb::AutofillSpecifics& autofill( | 330 const sync_pb::AutofillSpecifics& autofill( |
329 sync_node.GetAutofillSpecifics()); | 331 sync_node.GetAutofillSpecifics()); |
330 int64 sync_id = sync_node.GetId(); | 332 int64 sync_id = sync_node.GetId(); |
331 if (autofill.has_value()) | 333 if (autofill.has_value()) |
332 ApplySyncAutofillEntryChange(action, autofill, &new_entries, sync_id); | 334 ApplySyncAutofillEntryChange(action, autofill, &new_entries, sync_id); |
333 else if (autofill.has_profile()) | 335 else if (autofill.has_profile()) |
334 ApplySyncAutofillProfileChange(action, autofill.profile(), sync_id); | 336 ApplySyncAutofillProfileChange(action, autofill.profile(), sync_id); |
335 else | 337 else |
336 NOTREACHED() << "Autofill specifics has no data!"; | 338 NOTREACHED() << "Autofill specifics has no data!"; |
337 } | 339 } |
338 | 340 |
339 if (!web_database_->UpdateAutofillEntries(new_entries)) { | 341 if (!web_database_->UpdateAutofillEntries(new_entries)) { |
340 LOG(ERROR) << "Could not update autofill entries."; | 342 error_handler()->OnUnrecoverableError(FROM_HERE, |
341 error_handler()->OnUnrecoverableError(); | 343 "Could not update autofill entries."); |
342 return; | 344 return; |
343 } | 345 } |
344 | 346 |
345 PostOptimisticRefreshTask(); | 347 PostOptimisticRefreshTask(); |
346 | 348 |
347 StartObserving(); | 349 StartObserving(); |
348 } | 350 } |
349 | 351 |
350 void AutofillChangeProcessor::ApplySyncAutofillEntryDelete( | 352 void AutofillChangeProcessor::ApplySyncAutofillEntryDelete( |
351 const sync_pb::AutofillSpecifics& autofill) { | 353 const sync_pb::AutofillSpecifics& autofill) { |
352 if (!web_database_->RemoveFormElement( | 354 if (!web_database_->RemoveFormElement( |
353 UTF8ToUTF16(autofill.name()), UTF8ToUTF16(autofill.value()))) { | 355 UTF8ToUTF16(autofill.name()), UTF8ToUTF16(autofill.value()))) { |
354 LOG(ERROR) << "Could not remove autofill node."; | 356 error_handler()->OnUnrecoverableError(FROM_HERE, |
355 error_handler()->OnUnrecoverableError(); | 357 "Could not remove autofill node."); |
356 return; | 358 return; |
357 } | 359 } |
358 } | 360 } |
359 | 361 |
360 void AutofillChangeProcessor::ApplySyncAutofillEntryChange( | 362 void AutofillChangeProcessor::ApplySyncAutofillEntryChange( |
361 sync_api::SyncManager::ChangeRecord::Action action, | 363 sync_api::SyncManager::ChangeRecord::Action action, |
362 const sync_pb::AutofillSpecifics& autofill, | 364 const sync_pb::AutofillSpecifics& autofill, |
363 std::vector<AutofillEntry>* new_entries, | 365 std::vector<AutofillEntry>* new_entries, |
364 int64 sync_id) { | 366 int64 sync_id) { |
365 DCHECK_NE(sync_api::SyncManager::ChangeRecord::ACTION_DELETE, action); | 367 DCHECK_NE(sync_api::SyncManager::ChangeRecord::ACTION_DELETE, action); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 s->set_company_name(UTF16ToUTF8(profile.GetFieldText( | 511 s->set_company_name(UTF16ToUTF8(profile.GetFieldText( |
510 AutoFillType(COMPANY_NAME)))); | 512 AutoFillType(COMPANY_NAME)))); |
511 s->set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( | 513 s->set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( |
512 AutoFillType(PHONE_FAX_WHOLE_NUMBER)))); | 514 AutoFillType(PHONE_FAX_WHOLE_NUMBER)))); |
513 s->set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( | 515 s->set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( |
514 AutoFillType(PHONE_HOME_WHOLE_NUMBER)))); | 516 AutoFillType(PHONE_HOME_WHOLE_NUMBER)))); |
515 node->SetAutofillSpecifics(autofill); | 517 node->SetAutofillSpecifics(autofill); |
516 } | 518 } |
517 | 519 |
518 } // namespace browser_sync | 520 } // namespace browser_sync |
OLD | NEW |