Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: components/autofill/core/browser/webdata/autocomplete_syncable_service.cc

Issue 2646783002: Fixed synchronization autocomplete unrecoverable error. (Closed)
Patch Set: Added const for local variables. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 AutocompleteEntryMap* loaded_data, 302 AutocompleteEntryMap* loaded_data,
303 std::vector<AutofillEntry>* new_entries) { 303 std::vector<AutofillEntry>* new_entries) {
304 const sync_pb::EntitySpecifics& specifics = data.GetSpecifics(); 304 const sync_pb::EntitySpecifics& specifics = data.GetSpecifics();
305 const sync_pb::AutofillSpecifics& autofill_specifics(specifics.autofill()); 305 const sync_pb::AutofillSpecifics& autofill_specifics(specifics.autofill());
306 306
307 if (!autofill_specifics.has_value()) { 307 if (!autofill_specifics.has_value()) {
308 DVLOG(1) << "Add/Update for old-style autofill profile being dropped!"; 308 DVLOG(1) << "Add/Update for old-style autofill profile being dropped!";
309 return; 309 return;
310 } 310 }
311 311
312 AutofillKey key(autofill_specifics.name().c_str(), 312 AutofillKey key(autofill_specifics.name(), autofill_specifics.value());
313 autofill_specifics.value().c_str());
314 AutocompleteEntryMap::iterator it = loaded_data->find(key); 313 AutocompleteEntryMap::iterator it = loaded_data->find(key);
315 const google::protobuf::RepeatedField<int64_t>& timestamps = 314 const google::protobuf::RepeatedField<int64_t>& timestamps =
316 autofill_specifics.usage_timestamp(); 315 autofill_specifics.usage_timestamp();
317 if (it == loaded_data->end()) { 316 if (it == loaded_data->end()) {
318 // New entry. 317 // New entry.
319 base::Time date_created, date_last_used; 318 base::Time date_created, date_last_used;
320 if (!timestamps.empty()) { 319 if (!timestamps.empty()) {
321 date_created = base::Time::FromInternalValue(*timestamps.begin()); 320 date_created = base::Time::FromInternalValue(*timestamps.begin());
322 date_last_used = base::Time::FromInternalValue(*timestamps.rbegin()); 321 date_last_used = base::Time::FromInternalValue(*timestamps.rbegin());
323 } 322 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 419 }
421 420
422 // static 421 // static
423 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, 422 std::string AutocompleteSyncableService::KeyToTag(const std::string& name,
424 const std::string& value) { 423 const std::string& value) {
425 std::string prefix(kAutofillEntryNamespaceTag); 424 std::string prefix(kAutofillEntryNamespaceTag);
426 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); 425 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value);
427 } 426 }
428 427
429 } // namespace autofill 428 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/importer/in_process_importer_bridge.cc ('k') | components/autofill/core/browser/webdata/autofill_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698