| 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |
| 7 | 7 |
| 8 // libgnome-keyring has been deprecated in favor of libsecret. | 8 // libgnome-keyring has been deprecated in favor of libsecret. |
| 9 // See: https://mail.gnome.org/archives/commits-list/2013-October/msg08876.html | 9 // See: https://mail.gnome.org/archives/commits-list/2013-October/msg08876.html |
| 10 // | 10 // |
| 11 // The define below turns off the deprecations, in order to avoid build | 11 // The define below turns off the deprecations, in order to avoid build |
| 12 // failures with Gnome 3.12. When we move to libsecret, the define can be | 12 // failures with Gnome 3.12. When we move to libsecret, the define can be |
| 13 // removed, together with the include below it. | 13 // removed, together with the include below it. |
| 14 // | 14 // |
| 15 // The porting is tracked in http://crbug.com/355223 | 15 // The porting is tracked in http://crbug.com/355223 |
| 16 #define GNOME_KEYRING_DEPRECATED | 16 #define GNOME_KEYRING_DEPRECATED |
| 17 #define GNOME_KEYRING_DEPRECATED_FOR(x) | 17 #define GNOME_KEYRING_DEPRECATED_FOR(x) |
| 18 #include <gnome-keyring.h> | 18 #include <gnome-keyring.h> |
| 19 | 19 |
| 20 #include <string> | 20 #include <string> |
| 21 | 21 |
| 22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "base/compiler_specific.h" |
| 23 #include "base/memory/scoped_vector.h" | 24 #include "base/memory/scoped_vector.h" |
| 24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 25 #include "chrome/browser/password_manager/password_store_factory.h" | 26 #include "chrome/browser/password_manager/password_store_factory.h" |
| 26 #include "chrome/browser/password_manager/password_store_x.h" | 27 #include "chrome/browser/password_manager/password_store_x.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 28 | 29 |
| 29 namespace autofill { | 30 namespace autofill { |
| 30 struct PasswordForm; | 31 struct PasswordForm; |
| 31 } | 32 } |
| 32 | 33 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 enum TimestampToCompare { | 116 enum TimestampToCompare { |
| 116 CREATION_TIMESTAMP, | 117 CREATION_TIMESTAMP, |
| 117 SYNC_TIMESTAMP, | 118 SYNC_TIMESTAMP, |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 // Adds a login form without checking for one to replace first. | 121 // Adds a login form without checking for one to replace first. |
| 121 bool RawAddLogin(const autofill::PasswordForm& form); | 122 bool RawAddLogin(const autofill::PasswordForm& form); |
| 122 | 123 |
| 123 // Reads PasswordForms from the keyring with the given autofillability state. | 124 // Retrieves all autofillable or all blacklisted credentials (depending on |
| 125 // |autofillable|) from the keyring into |forms|, overwriting the original |
| 126 // contents of |forms|. Returns true on success. |
| 124 bool GetLoginsList(bool autofillable, | 127 bool GetLoginsList(bool autofillable, |
| 125 ScopedVector<autofill::PasswordForm>* forms); | 128 ScopedVector<autofill::PasswordForm>* forms) |
| 129 WARN_UNUSED_RESULT; |
| 126 | 130 |
| 127 // Helper for GetLoginsCreatedBetween(). | 131 // Helper for GetLoginsCreatedBetween(). |
| 128 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms); | 132 bool GetAllLogins(ScopedVector<autofill::PasswordForm>* forms) |
| 133 WARN_UNUSED_RESULT; |
| 129 | 134 |
| 130 // Retrieves password created/synced in the time interval. Returns |true| if | 135 // Retrieves password created/synced in the time interval. Returns |true| if |
| 131 // the operation succeeded. | 136 // the operation succeeded. |
| 132 bool GetLoginsBetween(base::Time get_begin, | 137 bool GetLoginsBetween(base::Time get_begin, |
| 133 base::Time get_end, | 138 base::Time get_end, |
| 134 TimestampToCompare date_to_compare, | 139 TimestampToCompare date_to_compare, |
| 135 ScopedVector<autofill::PasswordForm>* forms); | 140 ScopedVector<autofill::PasswordForm>* forms) |
| 141 WARN_UNUSED_RESULT; |
| 136 | 142 |
| 137 // Removes password created/synced in the time interval. Returns |true| if the | 143 // Removes password created/synced in the time interval. Returns |true| if the |
| 138 // operation succeeded. |changes| will contain the changes applied. | 144 // operation succeeded. |changes| will contain the changes applied. |
| 139 bool RemoveLoginsBetween(base::Time get_begin, | 145 bool RemoveLoginsBetween(base::Time get_begin, |
| 140 base::Time get_end, | 146 base::Time get_end, |
| 141 TimestampToCompare date_to_compare, | 147 TimestampToCompare date_to_compare, |
| 142 password_manager::PasswordStoreChangeList* changes); | 148 password_manager::PasswordStoreChangeList* changes); |
| 143 | 149 |
| 144 // Generates a profile-specific app string based on profile_id_. | |
| 145 std::string GetProfileSpecificAppString() const; | |
| 146 | |
| 147 // The local profile id, used to generate the app string. | 150 // The local profile id, used to generate the app string. |
| 148 const LocalProfileId profile_id_; | 151 const LocalProfileId profile_id_; |
| 149 | 152 |
| 150 // The app string, possibly based on the local profile id. | 153 // The app string, possibly based on the local profile id. |
| 151 std::string app_string_; | 154 std::string app_string_; |
| 152 | 155 |
| 153 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome); | 156 DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome); |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ | 159 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |
| OLD | NEW |