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 "chrome/browser/password_manager/native_backend_kwallet_x.h" | 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 pickle->WriteString16(form->password_element); | 725 pickle->WriteString16(form->password_element); |
726 pickle->WriteString16(form->password_value); | 726 pickle->WriteString16(form->password_value); |
727 pickle->WriteString16(form->submit_element); | 727 pickle->WriteString16(form->submit_element); |
728 pickle->WriteBool(form->ssl_valid); | 728 pickle->WriteBool(form->ssl_valid); |
729 pickle->WriteBool(form->preferred); | 729 pickle->WriteBool(form->preferred); |
730 pickle->WriteBool(form->blacklisted_by_user); | 730 pickle->WriteBool(form->blacklisted_by_user); |
731 pickle->WriteInt64(form->date_created.ToTimeT()); | 731 pickle->WriteInt64(form->date_created.ToTimeT()); |
732 pickle->WriteInt(form->type); | 732 pickle->WriteInt(form->type); |
733 pickle->WriteInt(form->times_used); | 733 pickle->WriteInt(form->times_used); |
734 autofill::SerializeFormData(form->form_data, pickle); | 734 autofill::SerializeFormData(form->form_data, pickle); |
| 735 pickle->WriteInt64(form->date_synced.ToInternalValue()); |
735 } | 736 } |
736 } | 737 } |
737 | 738 |
738 // static | 739 // static |
739 bool NativeBackendKWallet::DeserializeValueSize(const std::string& signon_realm, | 740 bool NativeBackendKWallet::DeserializeValueSize(const std::string& signon_realm, |
740 const PickleIterator& init_iter, | 741 const PickleIterator& init_iter, |
741 int version, | 742 int version, |
742 bool size_32, | 743 bool size_32, |
743 bool warn_only, | 744 bool warn_only, |
744 PasswordFormList* forms) { | 745 PasswordFormList* forms) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 if (version > 1) { | 807 if (version > 1) { |
807 if (!iter.ReadInt(&type) || | 808 if (!iter.ReadInt(&type) || |
808 !iter.ReadInt(&form->times_used) || | 809 !iter.ReadInt(&form->times_used) || |
809 !autofill::DeserializeFormData(&iter, &form->form_data)) { | 810 !autofill::DeserializeFormData(&iter, &form->form_data)) { |
810 LogDeserializationWarning(version, signon_realm, false); | 811 LogDeserializationWarning(version, signon_realm, false); |
811 return false; | 812 return false; |
812 } | 813 } |
813 form->type = static_cast<PasswordForm::Type>(type); | 814 form->type = static_cast<PasswordForm::Type>(type); |
814 } | 815 } |
815 | 816 |
| 817 if (version > 2) { |
| 818 int64 date_synced = 0; |
| 819 if (!iter.ReadInt64(&date_synced)) { |
| 820 LogDeserializationWarning(version, signon_realm, false); |
| 821 return false; |
| 822 } |
| 823 form->date_synced = base::Time::FromInternalValue(date_synced); |
| 824 } |
| 825 |
816 forms->push_back(form.release()); | 826 forms->push_back(form.release()); |
817 } | 827 } |
818 | 828 |
819 return true; | 829 return true; |
820 } | 830 } |
821 | 831 |
822 // static | 832 // static |
823 void NativeBackendKWallet::DeserializeValue(const std::string& signon_realm, | 833 void NativeBackendKWallet::DeserializeValue(const std::string& signon_realm, |
824 const Pickle& pickle, | 834 const Pickle& pickle, |
825 PasswordFormList* forms) { | 835 PasswordFormList* forms) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 } | 944 } |
935 | 945 |
936 return handle; | 946 return handle; |
937 } | 947 } |
938 | 948 |
939 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { | 949 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { |
940 // Originally, the folder name was always just "Chrome Form Data". | 950 // Originally, the folder name was always just "Chrome Form Data". |
941 // Now we use it to distinguish passwords for different profiles. | 951 // Now we use it to distinguish passwords for different profiles. |
942 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); | 952 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); |
943 } | 953 } |
OLD | NEW |