| 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 <libsecret/secret.h> | 8 #include <libsecret/secret.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 enum TimestampToCompare { | 79 enum TimestampToCompare { |
| 80 CREATION_TIMESTAMP, | 80 CREATION_TIMESTAMP, |
| 81 SYNC_TIMESTAMP, | 81 SYNC_TIMESTAMP, |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 enum AddUpdateLoginSearchOptions { | 84 enum AddUpdateLoginSearchOptions { |
| 85 SEARCH_USE_SUBMIT, | 85 SEARCH_USE_SUBMIT, |
| 86 SEARCH_IGNORE_SUBMIT, | 86 SEARCH_IGNORE_SUBMIT, |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // Search that is used in AddLogin and UpdateLogin methods | 89 // Returns credentials matching |lookup_form| and |options|. |
| 90 void AddUpdateLoginSearch(const autofill::PasswordForm& lookup_form, | 90 ScopedVector<autofill::PasswordForm> AddUpdateLoginSearch( |
| 91 AddUpdateLoginSearchOptions options, | 91 const autofill::PasswordForm& lookup_form, |
| 92 ScopedVector<autofill::PasswordForm>* forms); | 92 AddUpdateLoginSearchOptions options); |
| 93 | 93 |
| 94 // Adds a login form without checking for one to replace first. | 94 // Adds a login form without checking for one to replace first. |
| 95 bool RawAddLogin(const autofill::PasswordForm& form); | 95 bool RawAddLogin(const autofill::PasswordForm& form); |
| 96 | 96 |
| 97 enum GetLoginsListOptions { | 97 enum GetLoginsListOptions { |
| 98 ALL_LOGINS, | 98 ALL_LOGINS, |
| 99 AUTOFILLABLE_LOGINS, | 99 AUTOFILLABLE_LOGINS, |
| 100 BLACKLISTED_LOGINS, | 100 BLACKLISTED_LOGINS, |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Reads PasswordForms from the keyring with the given autofillability state. | 103 // Overwrites |forms| with credentials matching |options| from the keyring. If |
| 104 // |lookup_form| is not NULL, only retrieves credentials PSL-matching it. In |
| 105 // case of failures returns false and erases |forms|. |
| 104 bool GetLoginsList(const autofill::PasswordForm* lookup_form, | 106 bool GetLoginsList(const autofill::PasswordForm* lookup_form, |
| 105 GetLoginsListOptions options, | 107 GetLoginsListOptions options, |
| 106 ScopedVector<autofill::PasswordForm>* forms); | 108 ScopedVector<autofill::PasswordForm>* forms); |
| 107 | 109 |
| 108 // Helper for GetLoginsCreatedBetween(). | |
| 109 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms); | |
| 110 | |
| 111 // Retrieves password created/synced in the time interval. Returns |true| if | 110 // Retrieves password created/synced in the time interval. Returns |true| if |
| 112 // the operation succeeded. | 111 // the operation succeeded. |
| 113 bool GetLoginsBetween(base::Time get_begin, | 112 bool GetLoginsBetween(base::Time get_begin, |
| 114 base::Time get_end, | 113 base::Time get_end, |
| 115 TimestampToCompare date_to_compare, | 114 TimestampToCompare date_to_compare, |
| 116 ScopedVector<autofill::PasswordForm>* forms); | 115 ScopedVector<autofill::PasswordForm>* forms); |
| 117 | 116 |
| 118 // Removes password created/synced in the time interval. Returns |true| if the | 117 // Removes password created/synced in the time interval. Returns |true| if the |
| 119 // operation succeeded. |changes| will contain the changes applied. | 118 // operation succeeded. |changes| will contain the changes applied. |
| 120 bool RemoveLoginsBetween(base::Time get_begin, | 119 bool RemoveLoginsBetween(base::Time get_begin, |
| 121 base::Time get_end, | 120 base::Time get_end, |
| 122 TimestampToCompare date_to_compare, | 121 TimestampToCompare date_to_compare, |
| 123 password_manager::PasswordStoreChangeList* changes); | 122 password_manager::PasswordStoreChangeList* changes); |
| 124 | 123 |
| 125 // convert data get from Libsecret to Passwordform | 124 // convert data get from Libsecret to Passwordform |
| 126 bool ConvertFormList(GList* found, | 125 ScopedVector<autofill::PasswordForm> ConvertFormList( |
| 127 const autofill::PasswordForm* lookup_form, | 126 GList* found, |
| 128 ScopedVector<autofill::PasswordForm>* forms); | 127 const autofill::PasswordForm* lookup_form); |
| 129 | 128 |
| 130 // Generates a profile-specific app string based on profile_id_. | 129 // Generates a profile-specific app string based on profile_id_. |
| 131 static std::string GetProfileSpecificAppString(LocalProfileId id); | 130 static std::string GetProfileSpecificAppString(LocalProfileId id); |
| 132 | 131 |
| 133 // The app string, possibly based on the local profile id. | 132 // The app string, possibly based on the local profile id. |
| 134 std::string app_string_; | 133 std::string app_string_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret); | 135 DISALLOW_COPY_AND_ASSIGN(NativeBackendLibsecret); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ | 138 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_LIBSECRET_H_ |
| OLD | NEW |