| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) OVERRIDE { | 62 virtual PasswordStoreChangeList AddLogin(const PasswordForm& form) OVERRIDE { |
| 63 return PasswordStoreChangeList(); | 63 return PasswordStoreChangeList(); |
| 64 } | 64 } |
| 65 virtual bool UpdateLogin(const PasswordForm& form, | 65 virtual bool UpdateLogin(const PasswordForm& form, |
| 66 PasswordStoreChangeList* changes) OVERRIDE { | 66 PasswordStoreChangeList* changes) OVERRIDE { |
| 67 return false; | 67 return false; |
| 68 } | 68 } |
| 69 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { return false; } | 69 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { return false; } |
| 70 | 70 |
| 71 virtual bool RemoveLoginsCreatedBetween( | 71 virtual bool RemoveLoginsCreatedBetween(base::Time delete_begin, |
| 72 const base::Time& delete_begin, | 72 base::Time delete_end) OVERRIDE { |
| 73 const base::Time& delete_end) OVERRIDE { | |
| 74 return false; | 73 return false; |
| 75 } | 74 } |
| 76 | 75 |
| 76 virtual bool RemoveLoginsSyncedBetween( |
| 77 base::Time delete_begin, |
| 78 base::Time delete_end, |
| 79 password_manager::PasswordStoreChangeList* changes) OVERRIDE { |
| 80 return false; |
| 81 } |
| 82 |
| 77 virtual bool GetLogins(const PasswordForm& form, | 83 virtual bool GetLogins(const PasswordForm& form, |
| 78 PasswordFormList* forms) OVERRIDE { | 84 PasswordFormList* forms) OVERRIDE { |
| 79 return false; | 85 return false; |
| 80 } | 86 } |
| 81 | 87 |
| 82 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, | 88 virtual bool GetLoginsCreatedBetween(base::Time get_begin, |
| 83 const base::Time& get_end, | 89 base::Time get_end, |
| 84 PasswordFormList* forms) OVERRIDE { | 90 PasswordFormList* forms) OVERRIDE { |
| 85 return false; | 91 return false; |
| 86 } | 92 } |
| 87 | 93 |
| 88 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { | 94 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { |
| 89 return false; | 95 return false; |
| 90 } | 96 } |
| 91 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE { | 97 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE { |
| 92 return false; | 98 return false; |
| 93 } | 99 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 114 return true; | 120 return true; |
| 115 } | 121 } |
| 116 | 122 |
| 117 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { | 123 virtual bool RemoveLogin(const PasswordForm& form) OVERRIDE { |
| 118 for (size_t i = 0; i < all_forms_.size(); ++i) | 124 for (size_t i = 0; i < all_forms_.size(); ++i) |
| 119 if (CompareForms(all_forms_[i], form, false)) | 125 if (CompareForms(all_forms_[i], form, false)) |
| 120 erase(i--); | 126 erase(i--); |
| 121 return true; | 127 return true; |
| 122 } | 128 } |
| 123 | 129 |
| 124 virtual bool RemoveLoginsCreatedBetween( | 130 virtual bool RemoveLoginsCreatedBetween(base::Time delete_begin, |
| 125 const base::Time& delete_begin, | 131 base::Time delete_end) OVERRIDE { |
| 126 const base::Time& delete_end) OVERRIDE { | |
| 127 for (size_t i = 0; i < all_forms_.size(); ++i) { | 132 for (size_t i = 0; i < all_forms_.size(); ++i) { |
| 128 if (delete_begin <= all_forms_[i].date_created && | 133 if (delete_begin <= all_forms_[i].date_created && |
| 129 (delete_end.is_null() || all_forms_[i].date_created < delete_end)) | 134 (delete_end.is_null() || all_forms_[i].date_created < delete_end)) |
| 130 erase(i--); | 135 erase(i--); |
| 131 } | 136 } |
| 132 return true; | 137 return true; |
| 133 } | 138 } |
| 134 | 139 |
| 140 virtual bool RemoveLoginsSyncedBetween( |
| 141 base::Time delete_begin, |
| 142 base::Time delete_end, |
| 143 password_manager::PasswordStoreChangeList* changes) OVERRIDE { |
| 144 DCHECK(changes); |
| 145 for (size_t i = 0; i < all_forms_.size(); ++i) { |
| 146 if (delete_begin <= all_forms_[i].date_synced && |
| 147 (delete_end.is_null() || all_forms_[i].date_synced < delete_end)) { |
| 148 changes->push_back(password_manager::PasswordStoreChange( |
| 149 password_manager::PasswordStoreChange::REMOVE, all_forms_[i])); |
| 150 erase(i--); |
| 151 } |
| 152 } |
| 153 return true; |
| 154 } |
| 155 |
| 135 virtual bool GetLogins(const PasswordForm& form, | 156 virtual bool GetLogins(const PasswordForm& form, |
| 136 PasswordFormList* forms) OVERRIDE { | 157 PasswordFormList* forms) OVERRIDE { |
| 137 for (size_t i = 0; i < all_forms_.size(); ++i) | 158 for (size_t i = 0; i < all_forms_.size(); ++i) |
| 138 if (all_forms_[i].signon_realm == form.signon_realm) | 159 if (all_forms_[i].signon_realm == form.signon_realm) |
| 139 forms->push_back(new PasswordForm(all_forms_[i])); | 160 forms->push_back(new PasswordForm(all_forms_[i])); |
| 140 return true; | 161 return true; |
| 141 } | 162 } |
| 142 | 163 |
| 143 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, | 164 virtual bool GetLoginsCreatedBetween(base::Time get_begin, |
| 144 const base::Time& get_end, | 165 base::Time get_end, |
| 145 PasswordFormList* forms) OVERRIDE { | 166 PasswordFormList* forms) OVERRIDE { |
| 146 for (size_t i = 0; i < all_forms_.size(); ++i) | 167 for (size_t i = 0; i < all_forms_.size(); ++i) |
| 147 if (get_begin <= all_forms_[i].date_created && | 168 if (get_begin <= all_forms_[i].date_created && |
| 148 (get_end.is_null() || all_forms_[i].date_created < get_end)) | 169 (get_end.is_null() || all_forms_[i].date_created < get_end)) |
| 149 forms->push_back(new PasswordForm(all_forms_[i])); | 170 forms->push_back(new PasswordForm(all_forms_[i])); |
| 150 return true; | 171 return true; |
| 151 } | 172 } |
| 152 | 173 |
| 153 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { | 174 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE { |
| 154 for (size_t i = 0; i < all_forms_.size(); ++i) | 175 for (size_t i = 0; i < all_forms_.size(); ++i) |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 475 |
| 455 INSTANTIATE_TEST_CASE_P(NoBackend, | 476 INSTANTIATE_TEST_CASE_P(NoBackend, |
| 456 PasswordStoreXTest, | 477 PasswordStoreXTest, |
| 457 testing::Values(NO_BACKEND)); | 478 testing::Values(NO_BACKEND)); |
| 458 INSTANTIATE_TEST_CASE_P(FailingBackend, | 479 INSTANTIATE_TEST_CASE_P(FailingBackend, |
| 459 PasswordStoreXTest, | 480 PasswordStoreXTest, |
| 460 testing::Values(FAILING_BACKEND)); | 481 testing::Values(FAILING_BACKEND)); |
| 461 INSTANTIATE_TEST_CASE_P(WorkingBackend, | 482 INSTANTIATE_TEST_CASE_P(WorkingBackend, |
| 462 PasswordStoreXTest, | 483 PasswordStoreXTest, |
| 463 testing::Values(WORKING_BACKEND)); | 484 testing::Values(WORKING_BACKEND)); |
| OLD | NEW |