OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 5 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 void AutocompleteSyncableService::InjectStartSyncFlare( | 96 void AutocompleteSyncableService::InjectStartSyncFlare( |
97 const syncer::SyncableService::StartSyncFlare& flare) { | 97 const syncer::SyncableService::StartSyncFlare& flare) { |
98 flare_ = flare; | 98 flare_ = flare; |
99 } | 99 } |
100 | 100 |
101 syncer::SyncMergeResult AutocompleteSyncableService::MergeDataAndStartSyncing( | 101 syncer::SyncMergeResult AutocompleteSyncableService::MergeDataAndStartSyncing( |
102 syncer::ModelType type, | 102 syncer::ModelType type, |
103 const syncer::SyncDataList& initial_sync_data, | 103 const syncer::SyncDataList& initial_sync_data, |
104 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 104 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, |
105 scoped_ptr<syncer::SyncErrorFactory> error_handler) { | 105 std::unique_ptr<syncer::SyncErrorFactory> error_handler) { |
106 DCHECK(CalledOnValidThread()); | 106 DCHECK(CalledOnValidThread()); |
107 DCHECK(!sync_processor_); | 107 DCHECK(!sync_processor_); |
108 DCHECK(sync_processor); | 108 DCHECK(sync_processor); |
109 DCHECK(error_handler); | 109 DCHECK(error_handler); |
110 | 110 |
111 syncer::SyncMergeResult merge_result(type); | 111 syncer::SyncMergeResult merge_result(type); |
112 error_handler_ = std::move(error_handler); | 112 error_handler_ = std::move(error_handler); |
113 std::vector<AutofillEntry> entries; | 113 std::vector<AutofillEntry> entries; |
114 if (!LoadAutofillData(&entries)) { | 114 if (!LoadAutofillData(&entries)) { |
115 merge_result.set_error(error_handler_->CreateAndUploadError( | 115 merge_result.set_error(error_handler_->CreateAndUploadError( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!sync_processor_) { | 196 if (!sync_processor_) { |
197 syncer::SyncError error(FROM_HERE, | 197 syncer::SyncError error(FROM_HERE, |
198 syncer::SyncError::DATATYPE_ERROR, | 198 syncer::SyncError::DATATYPE_ERROR, |
199 "Models not yet associated.", | 199 "Models not yet associated.", |
200 syncer::AUTOFILL); | 200 syncer::AUTOFILL); |
201 return error; | 201 return error; |
202 } | 202 } |
203 | 203 |
204 // Data is loaded only if we get new ADD/UPDATE change. | 204 // Data is loaded only if we get new ADD/UPDATE change. |
205 std::vector<AutofillEntry> entries; | 205 std::vector<AutofillEntry> entries; |
206 scoped_ptr<AutocompleteEntryMap> db_entries; | 206 std::unique_ptr<AutocompleteEntryMap> db_entries; |
207 std::vector<AutofillEntry> new_entries; | 207 std::vector<AutofillEntry> new_entries; |
208 | 208 |
209 syncer::SyncError list_processing_error; | 209 syncer::SyncError list_processing_error; |
210 | 210 |
211 for (const auto& i : change_list) { | 211 for (const auto& i : change_list) { |
212 DCHECK(i.IsValid()); | 212 DCHECK(i.IsValid()); |
213 switch (i.change_type()) { | 213 switch (i.change_type()) { |
214 case syncer::SyncChange::ACTION_ADD: | 214 case syncer::SyncChange::ACTION_ADD: |
215 case syncer::SyncChange::ACTION_UPDATE: | 215 case syncer::SyncChange::ACTION_UPDATE: |
216 if (!db_entries) { | 216 if (!db_entries) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 417 } |
418 | 418 |
419 // static | 419 // static |
420 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, | 420 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, |
421 const std::string& value) { | 421 const std::string& value) { |
422 std::string prefix(kAutofillEntryNamespaceTag); | 422 std::string prefix(kAutofillEntryNamespaceTag); |
423 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); | 423 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); |
424 } | 424 } |
425 | 425 |
426 } // namespace autofill | 426 } // namespace autofill |
OLD | NEW |