Index: chrome/browser/password_manager/native_backend_gnome_x.h |
=================================================================== |
--- chrome/browser/password_manager/native_backend_gnome_x.h (revision 49824) |
+++ chrome/browser/password_manager/native_backend_gnome_x.h (working copy) |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
-#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
+#ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |
+#define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |
extern "C" { |
#include <gnome-keyring.h> |
@@ -11,59 +11,52 @@ |
#include <vector> |
-#include "base/lock.h" |
-#include "chrome/browser/password_manager/login_database.h" |
-#include "chrome/browser/password_manager/password_store.h" |
-#include "chrome/browser/profile.h" |
-#include "chrome/browser/webdata/web_data_service.h" |
+#include "base/basictypes.h" |
+#include "base/time.h" |
+#include "chrome/browser/password_manager/password_store_x.h" |
-class Profile; |
-class Task; |
+namespace webkit_glue { |
+struct PasswordForm; |
+} |
-// PasswordStore implementation using GNOME Keyring. |
-class PasswordStoreGnome : public PasswordStore { |
+// NativeBackend implementation using GNOME Keyring. |
+class NativeBackendGnome : public PasswordStoreX::NativeBackend { |
public: |
- PasswordStoreGnome(LoginDatabase* login_db, |
- Profile* profile, |
- WebDataService* web_data_service); |
+ NativeBackendGnome(); |
+ virtual ~NativeBackendGnome(); |
+ |
virtual bool Init(); |
+ // Implements NativeBackend interface. |
+ virtual bool AddLogin(const webkit_glue::PasswordForm& form); |
+ virtual bool UpdateLogin(const webkit_glue::PasswordForm& form); |
+ virtual bool RemoveLogin(const webkit_glue::PasswordForm& form); |
+ virtual bool RemoveLoginsCreatedBetween(const base::Time& delete_begin, |
+ const base::Time& delete_end); |
+ virtual bool GetLogins(const webkit_glue::PasswordForm& form, |
+ PasswordFormList* forms); |
+ virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, |
+ const base::Time& get_end, |
+ PasswordFormList* forms); |
+ virtual bool GetAutofillableLogins(PasswordFormList* forms); |
+ virtual bool GetBlacklistLogins(PasswordFormList* forms); |
+ |
private: |
- virtual ~PasswordStoreGnome(); |
+ // Reads PasswordForms from the keyring with the given autofillability state. |
+ bool GetLoginsList(PasswordFormList* forms, bool autofillable); |
- // Implements PasswordStore interface. |
- virtual void AddLoginImpl(const webkit_glue::PasswordForm& form); |
- virtual void UpdateLoginImpl(const webkit_glue::PasswordForm& form); |
- virtual void RemoveLoginImpl(const webkit_glue::PasswordForm& form); |
- virtual void RemoveLoginsCreatedBetweenImpl(const base::Time& delete_begin, |
- const base::Time& delete_end); |
- virtual void GetLoginsImpl(GetLoginsRequest* request, |
- const webkit_glue::PasswordForm& form); |
- virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request); |
- virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request); |
- virtual bool FillAutofillableLogins( |
- std::vector<webkit_glue::PasswordForm*>* forms); |
- virtual bool FillBlacklistLogins( |
- std::vector<webkit_glue::PasswordForm*>* forms); |
+ // Helper for GetLoginsCreatedBetween(). |
+ bool GetAllLogins(PasswordFormList* forms); |
- // Helper for AddLoginImpl() and UpdateLoginImpl() with a success status. |
- bool AddLoginHelper(const webkit_glue::PasswordForm& form, |
- const base::Time& date_created); |
+ // Parse all the results from the given GList into a PasswordFormList, and |
+ // free the GList. PasswordForms are allocated on the heap, and should be |
+ // deleted by the consumer. |
+ void ConvertFormList(GList* found, PasswordFormList* forms); |
- // Helper for FillAutofillableLogins() and FillBlacklistLogins(). |
- bool FillSomeLogins(bool autofillable, |
- std::vector<webkit_glue::PasswordForm*>* forms); |
- |
- // Parse all the results from the given GList into a |
- // vector<PasswordForm*>, and free the GList. PasswordForms are |
- // allocated on the heap, and should be deleted by the consumer. |
- void FillFormVector(GList* found, |
- std::vector<webkit_glue::PasswordForm*>* forms); |
- |
static const GnomeKeyringPasswordSchema kGnomeSchema; |
- DISALLOW_COPY_AND_ASSIGN(PasswordStoreGnome); |
+ DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome); |
}; |
-#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
+#endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_ |