| 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 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 AutofillKey key(autofill_specifics.name().c_str(), | 312 AutofillKey key(autofill_specifics.name().c_str(), |
| 313 autofill_specifics.value().c_str()); | 313 autofill_specifics.value().c_str()); |
| 314 AutocompleteEntryMap::iterator it = loaded_data->find(key); | 314 AutocompleteEntryMap::iterator it = loaded_data->find(key); |
| 315 const google::protobuf::RepeatedField<int64_t>& timestamps = | 315 const google::protobuf::RepeatedField<int64_t>& timestamps = |
| 316 autofill_specifics.usage_timestamp(); | 316 autofill_specifics.usage_timestamp(); |
| 317 if (it == loaded_data->end()) { | 317 if (it == loaded_data->end()) { |
| 318 // New entry. | 318 // New entry. |
| 319 base::Time date_created, date_last_used; | 319 base::Time date_created, date_last_used; |
| 320 if (timestamps.size() > 0) { | 320 if (!timestamps.empty()) { |
| 321 date_created = base::Time::FromInternalValue(*timestamps.begin()); | 321 date_created = base::Time::FromInternalValue(*timestamps.begin()); |
| 322 date_last_used = base::Time::FromInternalValue(*timestamps.rbegin()); | 322 date_last_used = base::Time::FromInternalValue(*timestamps.rbegin()); |
| 323 } | 323 } |
| 324 new_entries->push_back(AutofillEntry(key, date_created, date_last_used)); | 324 new_entries->push_back(AutofillEntry(key, date_created, date_last_used)); |
| 325 } else { | 325 } else { |
| 326 // Entry already present - merge if necessary. | 326 // Entry already present - merge if necessary. |
| 327 base::Time date_created, date_last_used; | 327 base::Time date_created, date_last_used; |
| 328 bool different = MergeTimestamps(timestamps, *it->second.second, | 328 bool different = MergeTimestamps(timestamps, *it->second.second, |
| 329 &date_created, &date_last_used); | 329 &date_created, &date_last_used); |
| 330 if (different) { | 330 if (different) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 | 421 |
| 422 // static | 422 // static |
| 423 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, | 423 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, |
| 424 const std::string& value) { | 424 const std::string& value) { |
| 425 std::string prefix(kAutofillEntryNamespaceTag); | 425 std::string prefix(kAutofillEntryNamespaceTag); |
| 426 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); | 426 return prefix + net::EscapePath(name) + "|" + net::EscapePath(value); |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace autofill | 429 } // namespace autofill |
| OLD | NEW |