| 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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 pickle->WriteString(form->origin.spec()); | 715 pickle->WriteString(form->origin.spec()); |
| 716 pickle->WriteString(form->action.spec()); | 716 pickle->WriteString(form->action.spec()); |
| 717 pickle->WriteString16(form->username_element); | 717 pickle->WriteString16(form->username_element); |
| 718 pickle->WriteString16(form->username_value); | 718 pickle->WriteString16(form->username_value); |
| 719 pickle->WriteString16(form->password_element); | 719 pickle->WriteString16(form->password_element); |
| 720 pickle->WriteString16(form->password_value); | 720 pickle->WriteString16(form->password_value); |
| 721 pickle->WriteString16(form->submit_element); | 721 pickle->WriteString16(form->submit_element); |
| 722 pickle->WriteBool(form->ssl_valid); | 722 pickle->WriteBool(form->ssl_valid); |
| 723 pickle->WriteBool(form->preferred); | 723 pickle->WriteBool(form->preferred); |
| 724 pickle->WriteBool(form->blacklisted_by_user); | 724 pickle->WriteBool(form->blacklisted_by_user); |
| 725 pickle->WriteInt64(form->date_created.ToTimeT()); | 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 } | 734 } |
| 735 } | 735 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 !iter.ReadString16(&form->password_value) || | 794 !iter.ReadString16(&form->password_value) || |
| 795 !iter.ReadString16(&form->submit_element) || | 795 !iter.ReadString16(&form->submit_element) || |
| 796 !iter.ReadBool(&form->ssl_valid) || | 796 !iter.ReadBool(&form->ssl_valid) || |
| 797 !iter.ReadBool(&form->preferred) || | 797 !iter.ReadBool(&form->preferred) || |
| 798 !iter.ReadBool(&form->blacklisted_by_user) || | 798 !iter.ReadBool(&form->blacklisted_by_user) || |
| 799 !iter.ReadInt64(&date_created)) { | 799 !iter.ReadInt64(&date_created)) { |
| 800 LogDeserializationWarning(version, signon_realm, warn_only); | 800 LogDeserializationWarning(version, signon_realm, warn_only); |
| 801 return false; | 801 return false; |
| 802 } | 802 } |
| 803 form->scheme = static_cast<PasswordForm::Scheme>(scheme); | 803 form->scheme = static_cast<PasswordForm::Scheme>(scheme); |
| 804 form->date_created = base::Time::FromTimeT(date_created); | |
| 805 | 804 |
| 806 if (version > 1) { | 805 if (version > 1) { |
| 807 if (!iter.ReadInt(&type) || | 806 if (!iter.ReadInt(&type) || |
| 808 !iter.ReadInt(&form->times_used) || | 807 !iter.ReadInt(&form->times_used) || |
| 809 !autofill::DeserializeFormData(&iter, &form->form_data)) { | 808 !autofill::DeserializeFormData(&iter, &form->form_data)) { |
| 810 LogDeserializationWarning(version, signon_realm, false); | 809 LogDeserializationWarning(version, signon_realm, false); |
| 811 return false; | 810 return false; |
| 812 } | 811 } |
| 813 form->type = static_cast<PasswordForm::Type>(type); | 812 form->type = static_cast<PasswordForm::Type>(type); |
| 814 } | 813 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 825 if (version > 3) { | 824 if (version > 3) { |
| 826 if (!iter.ReadString16(&form->display_name) || | 825 if (!iter.ReadString16(&form->display_name) || |
| 827 !ReadGURL(&iter, warn_only, &form->avatar_url) || | 826 !ReadGURL(&iter, warn_only, &form->avatar_url) || |
| 828 !ReadGURL(&iter, warn_only, &form->federation_url) || | 827 !ReadGURL(&iter, warn_only, &form->federation_url) || |
| 829 !iter.ReadBool(&form->skip_zero_click)) { | 828 !iter.ReadBool(&form->skip_zero_click)) { |
| 830 LogDeserializationWarning(version, signon_realm, false); | 829 LogDeserializationWarning(version, signon_realm, false); |
| 831 return false; | 830 return false; |
| 832 } | 831 } |
| 833 } | 832 } |
| 834 | 833 |
| 834 if (version > 4) { |
| 835 form->date_created = base::Time::FromInternalValue(date_created); |
| 836 } else { |
| 837 form->date_created = base::Time::FromTimeT(date_created); |
| 838 } |
| 839 |
| 835 forms->push_back(form.release()); | 840 forms->push_back(form.release()); |
| 836 } | 841 } |
| 837 | 842 |
| 838 return true; | 843 return true; |
| 839 } | 844 } |
| 840 | 845 |
| 841 // static | 846 // static |
| 842 void NativeBackendKWallet::DeserializeValue( | 847 void NativeBackendKWallet::DeserializeValue( |
| 843 const std::string& signon_realm, | 848 const std::string& signon_realm, |
| 844 const Pickle& pickle, | 849 const Pickle& pickle, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 } | 959 } |
| 955 | 960 |
| 956 return handle; | 961 return handle; |
| 957 } | 962 } |
| 958 | 963 |
| 959 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { | 964 std::string NativeBackendKWallet::GetProfileSpecificFolderName() const { |
| 960 // Originally, the folder name was always just "Chrome Form Data". | 965 // Originally, the folder name was always just "Chrome Form Data". |
| 961 // Now we use it to distinguish passwords for different profiles. | 966 // Now we use it to distinguish passwords for different profiles. |
| 962 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); | 967 return base::StringPrintf("%s (%d)", kKWalletFolder, profile_id_); |
| 963 } | 968 } |
| OLD | NEW |