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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 header->payload_size > length - sizeof(*header)) { | 675 header->payload_size > length - sizeof(*header)) { |
676 LOG(WARNING) << "Invalid KWallet entry detected (realm: " << realm << ")"; | 676 LOG(WARNING) << "Invalid KWallet entry detected (realm: " << realm << ")"; |
677 return false; | 677 return false; |
678 } | 678 } |
679 return true; | 679 return true; |
680 } | 680 } |
681 | 681 |
682 void NativeBackendKWallet::DeserializeValue(const std::string& signon_realm, | 682 void NativeBackendKWallet::DeserializeValue(const std::string& signon_realm, |
683 const Pickle& pickle, | 683 const Pickle& pickle, |
684 PasswordFormList* forms) { | 684 PasswordFormList* forms) { |
685 void* iter = NULL; | 685 PickleIterator iter(pickle); |
686 | 686 |
687 int version = -1; | 687 int version = -1; |
688 if (!pickle.ReadInt(&iter, &version) || version != kPickleVersion) { | 688 if (!pickle.ReadInt(&iter, &version) || version != kPickleVersion) { |
689 // This is the only version so far, so anything else is an error. | 689 // This is the only version so far, so anything else is an error. |
690 LOG(ERROR) << "Failed to deserialize KWallet entry " | 690 LOG(ERROR) << "Failed to deserialize KWallet entry " |
691 << "(realm: " << signon_realm << ")"; | 691 << "(realm: " << signon_realm << ")"; |
692 return; | 692 return; |
693 } | 693 } |
694 | 694 |
695 size_t count = 0; | 695 size_t count = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 LOG(ERROR) << "Failed to deserialize KWallet entry " | 732 LOG(ERROR) << "Failed to deserialize KWallet entry " |
733 << "(realm: " << signon_realm << ")"; | 733 << "(realm: " << signon_realm << ")"; |
734 break; | 734 break; |
735 } | 735 } |
736 form->scheme = static_cast<PasswordForm::Scheme>(scheme); | 736 form->scheme = static_cast<PasswordForm::Scheme>(scheme); |
737 form->date_created = base::Time::FromTimeT(date_created); | 737 form->date_created = base::Time::FromTimeT(date_created); |
738 forms->push_back(form.release()); | 738 forms->push_back(form.release()); |
739 } | 739 } |
740 } | 740 } |
741 | 741 |
742 bool NativeBackendKWallet::ReadGURL(const Pickle& pickle, void** iter, | 742 bool NativeBackendKWallet::ReadGURL(const Pickle& pickle, PickleIterator* iter, |
743 GURL* url) { | 743 GURL* url) { |
744 std::string url_string; | 744 std::string url_string; |
745 if (!pickle.ReadString(iter, &url_string)) { | 745 if (!pickle.ReadString(iter, &url_string)) { |
746 LOG(ERROR) << "Failed to deserialize URL"; | 746 LOG(ERROR) << "Failed to deserialize URL"; |
747 *url = GURL(); | 747 *url = GURL(); |
748 return false; | 748 return false; |
749 } | 749 } |
750 *url = GURL(url_string); | 750 *url = GURL(url_string); |
751 return true; | 751 return true; |
752 } | 752 } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 // Each other profile must be able to migrate the shared data as well, | 893 // Each other profile must be able to migrate the shared data as well, |
894 // so we must leave it alone. After a few releases, we'll add code to | 894 // so we must leave it alone. After a few releases, we'll add code to |
895 // delete them, and eventually remove this migration code. | 895 // delete them, and eventually remove this migration code. |
896 // TODO(mdm): follow through with the plan above. | 896 // TODO(mdm): follow through with the plan above. |
897 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); | 897 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); |
898 } else { | 898 } else { |
899 // We failed to migrate for some reason. Use the old folder name. | 899 // We failed to migrate for some reason. Use the old folder name. |
900 folder_name_ = kKWalletFolder; | 900 folder_name_ = kKWalletFolder; |
901 } | 901 } |
902 } | 902 } |
OLD | NEW |