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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 pickle->WriteBool(form->blacklisted_by_user); | 724 pickle->WriteBool(form->blacklisted_by_user); |
725 pickle->WriteInt64(form->date_created.ToInternalValue()); | 725 pickle->WriteInt64(form->date_created.ToInternalValue()); |
726 pickle->WriteInt(form->type); | 726 pickle->WriteInt(form->type); |
727 pickle->WriteInt(form->times_used); | 727 pickle->WriteInt(form->times_used); |
728 autofill::SerializeFormData(form->form_data, pickle); | 728 autofill::SerializeFormData(form->form_data, pickle); |
729 pickle->WriteInt64(form->date_synced.ToInternalValue()); | 729 pickle->WriteInt64(form->date_synced.ToInternalValue()); |
730 pickle->WriteString16(form->display_name); | 730 pickle->WriteString16(form->display_name); |
731 pickle->WriteString(form->avatar_url.spec()); | 731 pickle->WriteString(form->avatar_url.spec()); |
732 pickle->WriteString(form->federation_url.spec()); | 732 pickle->WriteString(form->federation_url.spec()); |
733 pickle->WriteBool(form->skip_zero_click); | 733 pickle->WriteBool(form->skip_zero_click); |
| 734 pickle->WriteInt(form->generation_upload_status); |
734 } | 735 } |
735 } | 736 } |
736 | 737 |
737 // static | 738 // static |
738 bool NativeBackendKWallet::DeserializeValueSize( | 739 bool NativeBackendKWallet::DeserializeValueSize( |
739 const std::string& signon_realm, | 740 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, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } | 777 } |
777 | 778 |
778 forms->reserve(forms->size() + count); | 779 forms->reserve(forms->size() + count); |
779 for (size_t i = 0; i < count; ++i) { | 780 for (size_t i = 0; i < count; ++i) { |
780 scoped_ptr<PasswordForm> form(new PasswordForm()); | 781 scoped_ptr<PasswordForm> form(new PasswordForm()); |
781 form->signon_realm.assign(signon_realm); | 782 form->signon_realm.assign(signon_realm); |
782 | 783 |
783 int scheme = 0; | 784 int scheme = 0; |
784 int64 date_created = 0; | 785 int64 date_created = 0; |
785 int type = 0; | 786 int type = 0; |
| 787 int generation_upload_status = 0; |
786 // Note that these will be read back in the order listed due to | 788 // Note that these will be read back in the order listed due to |
787 // short-circuit evaluation. This is important. | 789 // short-circuit evaluation. This is important. |
788 if (!iter.ReadInt(&scheme) || | 790 if (!iter.ReadInt(&scheme) || |
789 !ReadGURL(&iter, warn_only, &form->origin) || | 791 !ReadGURL(&iter, warn_only, &form->origin) || |
790 !ReadGURL(&iter, warn_only, &form->action) || | 792 !ReadGURL(&iter, warn_only, &form->action) || |
791 !iter.ReadString16(&form->username_element) || | 793 !iter.ReadString16(&form->username_element) || |
792 !iter.ReadString16(&form->username_value) || | 794 !iter.ReadString16(&form->username_value) || |
793 !iter.ReadString16(&form->password_element) || | 795 !iter.ReadString16(&form->password_element) || |
794 !iter.ReadString16(&form->password_value) || | 796 !iter.ReadString16(&form->password_value) || |
795 !iter.ReadString16(&form->submit_element) || | 797 !iter.ReadString16(&form->submit_element) || |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 return false; | 832 return false; |
831 } | 833 } |
832 } | 834 } |
833 | 835 |
834 if (version > 4) { | 836 if (version > 4) { |
835 form->date_created = base::Time::FromInternalValue(date_created); | 837 form->date_created = base::Time::FromInternalValue(date_created); |
836 } else { | 838 } else { |
837 form->date_created = base::Time::FromTimeT(date_created); | 839 form->date_created = base::Time::FromTimeT(date_created); |
838 } | 840 } |
839 | 841 |
| 842 if (version > 5) { |
| 843 if (!iter.ReadInt(&generation_upload_status)) { |
| 844 LogDeserializationWarning(version, signon_realm, false); |
| 845 } |
| 846 form->generation_upload_status = |
| 847 static_cast<PasswordForm::GenerationUploadStatus>( |
| 848 generation_upload_status); |
| 849 } |
| 850 |
840 forms->push_back(form.release()); | 851 forms->push_back(form.release()); |
841 } | 852 } |
842 | 853 |
843 return true; | 854 return true; |
844 } | 855 } |
845 | 856 |
846 // static | 857 // static |
847 void NativeBackendKWallet::DeserializeValue( | 858 void NativeBackendKWallet::DeserializeValue( |
848 const std::string& signon_realm, | 859 const std::string& signon_realm, |
849 const Pickle& pickle, | 860 const Pickle& pickle, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 } | 970 } |
960 | 971 |
961 return handle; | 972 return handle; |
962 } | 973 } |
963 | 974 |
964 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { | 975 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { |
965 // Originally, the folder name was always just "Chrome Form Data". | 976 // Originally, the folder name was always just "Chrome Form Data". |
966 // Now we use it to distinguish passwords for different profiles. | 977 // Now we use it to distinguish passwords for different profiles. |
967 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); | 978 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); |
968 } | 979 } |
OLD | NEW |