Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" | 5 #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/debug/dump_without_crashing.h" | |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "components/autofill/core/browser/proto/autofill_sync.pb.h" | 17 #include "components/autofill/core/browser/proto/autofill_sync.pb.h" |
| 17 #include "components/autofill/core/browser/webdata/autofill_metadata_change_list .h" | 18 #include "components/autofill/core/browser/webdata/autofill_metadata_change_list .h" |
| 18 #include "components/autofill/core/browser/webdata/autofill_table.h" | 19 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| 19 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" | 20 #include "components/autofill/core/browser/webdata/autofill_webdata_backend.h" |
| 20 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 21 #include "components/sync/model/entity_data.h" | 22 #include "components/sync/model/entity_data.h" |
| 22 #include "components/sync/model/model_type_change_processor.h" | 23 #include "components/sync/model/model_type_change_processor.h" |
| 23 #include "components/sync/model/mutable_data_batch.h" | 24 #include "components/sync/model/mutable_data_batch.h" |
| 24 #include "net/base/escape.h" | 25 #include "net/base/escape.h" |
| 25 | 26 |
| 26 using base::Optional; | 27 using base::Optional; |
| 27 using base::Time; | 28 using base::Time; |
| 29 using base::debug::DumpWithoutCrashing; | |
| 28 using sync_pb::AutofillSpecifics; | 30 using sync_pb::AutofillSpecifics; |
| 29 using syncer::EntityChange; | 31 using syncer::EntityChange; |
| 30 using syncer::EntityChangeList; | 32 using syncer::EntityChangeList; |
| 31 using syncer::EntityData; | 33 using syncer::EntityData; |
| 32 using syncer::EntityDataMap; | 34 using syncer::EntityDataMap; |
| 33 using syncer::MetadataChangeList; | 35 using syncer::MetadataChangeList; |
| 34 using syncer::ModelError; | 36 using syncer::ModelError; |
| 35 using syncer::ModelTypeChangeProcessor; | 37 using syncer::ModelTypeChangeProcessor; |
| 36 using syncer::MutableDataBatch; | 38 using syncer::MutableDataBatch; |
| 37 | 39 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 | 269 |
| 268 } // namespace | 270 } // namespace |
| 269 | 271 |
| 270 // static | 272 // static |
| 271 void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend( | 273 void AutocompleteSyncBridge::CreateForWebDataServiceAndBackend( |
| 272 AutofillWebDataService* web_data_service, | 274 AutofillWebDataService* web_data_service, |
| 273 AutofillWebDataBackend* web_data_backend) { | 275 AutofillWebDataBackend* web_data_backend) { |
| 274 web_data_service->GetDBUserData()->SetUserData( | 276 web_data_service->GetDBUserData()->SetUserData( |
| 275 UserDataKey(), | 277 UserDataKey(), |
| 276 new AutocompleteSyncBridge( | 278 new AutocompleteSyncBridge( |
| 277 web_data_backend, base::Bind(&ModelTypeChangeProcessor::Create))); | 279 web_data_backend, |
| 280 base::BindRepeating( | |
| 281 &ModelTypeChangeProcessor::Create, | |
| 282 base::BindRepeating(base::IgnoreResult(&DumpWithoutCrashing))))); | |
|
skym
2017/01/19 17:58:36
Can you plumb channel through to here and filter o
maxbogue
2017/01/20 20:39:47
Whoops, I never responded to this. I've prepared a
| |
| 278 } | 283 } |
| 279 | 284 |
| 280 // static | 285 // static |
| 281 AutocompleteSyncBridge* AutocompleteSyncBridge::FromWebDataService( | 286 AutocompleteSyncBridge* AutocompleteSyncBridge::FromWebDataService( |
| 282 AutofillWebDataService* web_data_service) { | 287 AutofillWebDataService* web_data_service) { |
| 283 return static_cast<AutocompleteSyncBridge*>( | 288 return static_cast<AutocompleteSyncBridge*>( |
| 284 web_data_service->GetDBUserData()->GetUserData(UserDataKey())); | 289 web_data_service->GetDBUserData()->GetUserData(UserDataKey())); |
| 285 } | 290 } |
| 286 | 291 |
| 287 AutocompleteSyncBridge::AutocompleteSyncBridge( | 292 AutocompleteSyncBridge::AutocompleteSyncBridge( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 void AutocompleteSyncBridge::AutofillEntriesChanged( | 416 void AutocompleteSyncBridge::AutofillEntriesChanged( |
| 412 const AutofillChangeList& changes) { | 417 const AutofillChangeList& changes) { |
| 413 DCHECK(thread_checker_.CalledOnValidThread()); | 418 DCHECK(thread_checker_.CalledOnValidThread()); |
| 414 } | 419 } |
| 415 | 420 |
| 416 AutofillTable* AutocompleteSyncBridge::GetAutofillTable() const { | 421 AutofillTable* AutocompleteSyncBridge::GetAutofillTable() const { |
| 417 return AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()); | 422 return AutofillTable::FromWebDatabase(web_data_backend_->GetDatabase()); |
| 418 } | 423 } |
| 419 | 424 |
| 420 } // namespace autofill | 425 } // namespace autofill |
| OLD | NEW |