| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 base::Time delete_begin, | 39 base::Time delete_begin, |
| 40 base::Time delete_end, | 40 base::Time delete_end, |
| 41 password_manager::PasswordStoreChangeList* changes) override; | 41 password_manager::PasswordStoreChangeList* changes) override; |
| 42 bool RemoveLoginsSyncedBetween( | 42 bool RemoveLoginsSyncedBetween( |
| 43 base::Time delete_begin, | 43 base::Time delete_begin, |
| 44 base::Time delete_end, | 44 base::Time delete_end, |
| 45 password_manager::PasswordStoreChangeList* changes) override; | 45 password_manager::PasswordStoreChangeList* changes) override; |
| 46 bool DisableAutoSignInForOrigins( | 46 bool DisableAutoSignInForOrigins( |
| 47 const base::Callback<bool(const GURL&)>& origin_filter, | 47 const base::Callback<bool(const GURL&)>& origin_filter, |
| 48 password_manager::PasswordStoreChangeList* changes) override; | 48 password_manager::PasswordStoreChangeList* changes) override; |
| 49 bool GetLogins(const autofill::PasswordForm& form, | 49 bool GetLogins(const password_manager::PasswordStore::FormDigest& form, |
| 50 ScopedVector<autofill::PasswordForm>* forms) override; | 50 ScopedVector<autofill::PasswordForm>* forms) override; |
| 51 bool GetAutofillableLogins( | 51 bool GetAutofillableLogins( |
| 52 ScopedVector<autofill::PasswordForm>* forms) override; | 52 ScopedVector<autofill::PasswordForm>* forms) override; |
| 53 bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) override; | 53 bool GetBlacklistLogins(ScopedVector<autofill::PasswordForm>* forms) override; |
| 54 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms) override; | 54 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms) override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 enum TimestampToCompare { | 57 enum TimestampToCompare { |
| 58 CREATION_TIMESTAMP, | 58 CREATION_TIMESTAMP, |
| 59 SYNC_TIMESTAMP, | 59 SYNC_TIMESTAMP, |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // Returns credentials matching |lookup_form| via |forms|. | 62 // Returns credentials matching |lookup_form| via |forms|. |
| 63 bool AddUpdateLoginSearch( | 63 bool AddUpdateLoginSearch( |
| 64 const autofill::PasswordForm& lookup_form, | 64 const autofill::PasswordForm& lookup_form, |
| 65 ScopedVector<autofill::PasswordForm>* forms); | 65 ScopedVector<autofill::PasswordForm>* forms); |
| 66 | 66 |
| 67 // Adds a login form without checking for one to replace first. | 67 // Adds a login form without checking for one to replace first. |
| 68 bool RawAddLogin(const autofill::PasswordForm& form); | 68 bool RawAddLogin(const autofill::PasswordForm& form); |
| 69 | 69 |
| 70 enum GetLoginsListOptions { | 70 enum GetLoginsListOptions { |
| 71 ALL_LOGINS, | 71 ALL_LOGINS, |
| 72 AUTOFILLABLE_LOGINS, | 72 AUTOFILLABLE_LOGINS, |
| 73 BLACKLISTED_LOGINS, | 73 BLACKLISTED_LOGINS, |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Retrieves credentials matching |options| from the keyring into |forms|, | 76 // Retrieves credentials matching |options| from the keyring into |forms|, |
| 77 // overwriting the original contents of |forms|. If |lookup_form| is not NULL, | 77 // overwriting the original contents of |forms|. If |lookup_form| is not NULL, |
| 78 // only retrieves credentials PSL-matching it. Returns true on success. | 78 // only retrieves credentials PSL-matching it. Returns true on success. |
| 79 bool GetLoginsList(const autofill::PasswordForm* lookup_form, | 79 bool GetLoginsList( |
| 80 GetLoginsListOptions options, | 80 const password_manager::PasswordStore::FormDigest* lookup_form, |
| 81 ScopedVector<autofill::PasswordForm>* forms) | 81 GetLoginsListOptions options, |
| 82 WARN_UNUSED_RESULT; | 82 ScopedVector<autofill::PasswordForm>* forms) WARN_UNUSED_RESULT; |
| 83 | 83 |
| 84 // Retrieves password created/synced in the time interval into |forms|, | 84 // Retrieves password created/synced in the time interval into |forms|, |
| 85 // overwriting the original contents of |forms|. Returns true on success. | 85 // overwriting the original contents of |forms|. Returns true on success. |
| 86 bool GetLoginsBetween(base::Time get_begin, | 86 bool GetLoginsBetween(base::Time get_begin, |
| 87 base::Time get_end, | 87 base::Time get_end, |
| 88 TimestampToCompare date_to_compare, | 88 TimestampToCompare date_to_compare, |
| 89 ScopedVector<autofill::PasswordForm>* forms) | 89 ScopedVector<autofill::PasswordForm>* forms) |
| 90 WARN_UNUSED_RESULT; | 90 WARN_UNUSED_RESULT; |
| 91 | 91 |
| 92 // Removes password created/synced in the time interval. Returns |true| if the | 92 // Removes password created/synced in the time interval. Returns |true| if the |
| 93 // operation succeeded. |changes| will contain the changes applied. | 93 // operation succeeded. |changes| will contain the changes applied. |
| 94 bool RemoveLoginsBetween(base::Time get_begin, | 94 bool RemoveLoginsBetween(base::Time get_begin, |
| 95 base::Time get_end, | 95 base::Time get_end, |
| 96 TimestampToCompare date_to_compare, | 96 TimestampToCompare date_to_compare, |
| 97 password_manager::PasswordStoreChangeList* changes); | 97 password_manager::PasswordStoreChangeList* changes); |
| 98 | 98 |
| 99 // convert data get from Libsecret to Passwordform | 99 // Convert data get from Libsecret to Passwordform. Uses |lookup_form| for |
| 100 // additional (PSL) matching, if present. |
| 100 ScopedVector<autofill::PasswordForm> ConvertFormList( | 101 ScopedVector<autofill::PasswordForm> ConvertFormList( |
| 101 GList* found, | 102 GList* found, |
| 102 const autofill::PasswordForm* lookup_form); | 103 const password_manager::PasswordStore::FormDigest* lookup_form); |
| 103 | 104 |
| 104 // The app string, possibly based on the local profile id. | 105 // The app string, possibly based on the local profile id. |
| 105 std::string app_string_; | 106 std::string app_string_; |
| 106 | 107 |
| 107 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret); | 108 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ | 111 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ |
| OLD | NEW |