Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3749)

Unified Diff: chrome/browser/password_manager/native_backend_kwallet_x.h

Issue 2806002: Linux: refactor GNOME Keyring and KWallet integration to allow migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/native_backend_kwallet_x.h
===================================================================
--- chrome/browser/password_manager/native_backend_kwallet_x.h (revision 49824)
+++ chrome/browser/password_manager/native_backend_kwallet_x.h (working copy)
@@ -2,72 +2,75 @@
// 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_KWALLET_H_
-#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_KWALLET_H_
+#ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_
+#define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_
#include <dbus/dbus-glib.h>
#include <glib.h>
#include <string>
-#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/webdata/web_data_service.h"
+#include "base/basictypes.h"
+#include "base/time.h"
+#include "chrome/browser/password_manager/password_store_x.h"
#include "webkit/glue/password_form.h"
class Pickle;
-class Profile;
-class Task;
-class PasswordStoreKWallet : public PasswordStore {
+// NativeBackend implementation using KWallet.
+class NativeBackendKWallet : public PasswordStoreX::NativeBackend {
public:
- PasswordStoreKWallet(LoginDatabase* login_db,
- Profile* profile,
- WebDataService* web_data_service);
+ NativeBackendKWallet();
- bool Init();
+ virtual ~NativeBackendKWallet();
- private:
- typedef std::vector<webkit_glue::PasswordForm*> PasswordFormList;
+ virtual bool Init();
- virtual ~PasswordStoreKWallet();
+ // 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& delete_begin,
+ const base::Time& delete_end,
+ PasswordFormList* forms);
+ virtual bool GetAutofillableLogins(PasswordFormList* forms);
+ virtual bool GetBlacklistLogins(PasswordFormList* forms);
- // 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);
-
+ private:
// Initialization.
bool StartKWalletd();
bool InitWallet();
- // Reads a list of PasswordForms from the wallet that match the signon_realm.
- void GetLoginsList(PasswordFormList* forms,
+ // Reads PasswordForms from the wallet that match the given signon_realm.
+ bool GetLoginsList(PasswordFormList* forms,
const std::string& signon_realm,
int wallet_handle);
+ // Reads PasswordForms from the wallet with the given autofillability state.
+ bool GetLoginsList(PasswordFormList* forms,
+ bool autofillable,
+ int wallet_handle);
+
+ // Reads PasswordForms from the wallet created in the given time range.
+ bool GetLoginsList(PasswordFormList* forms,
+ const base::Time& begin,
+ const base::Time& end,
+ int wallet_handle);
+
+ // Helper for some of the above GetLoginsList() methods.
+ bool GetAllLogins(PasswordFormList* forms, int wallet_handle);
+
// Writes a list of PasswordForms to the wallet with the given signon_realm.
// Overwrites any existing list for this signon_realm. Removes the entry if
- // |forms| is empty.
- void SetLoginsList(const PasswordFormList& forms,
+ // |forms| is empty. Returns true on success.
+ bool SetLoginsList(const PasswordFormList& forms,
const std::string& signon_realm,
int wallet_handle);
- // Helper for FillAutofillableLogins() and FillBlacklistLogins().
- bool FillSomeLogins(bool autofillable, PasswordFormList* forms);
-
// Checks if the last DBus call returned an error. If it did, logs the error
// message, frees it and returns true.
// This must be called after every DBus call.
@@ -117,9 +120,6 @@
// Invalid handle returned by WalletHandle().
static const int kInvalidKWalletHandle = -1;
- // Controls all access to kwallet DBus calls.
- Lock kwallet_lock_;
-
// Error from the last DBus call. NULL when there's no error. Freed and
// cleared by CheckError().
GError* error_;
@@ -131,7 +131,7 @@
// The name of the wallet we've opened. Set during Init().
std::string wallet_name_;
- DISALLOW_COPY_AND_ASSIGN(PasswordStoreKWallet);
+ DISALLOW_COPY_AND_ASSIGN(NativeBackendKWallet);
};
-#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_KWALLET_H_
+#endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_
« no previous file with comments | « chrome/browser/password_manager/native_backend_gnome_x.cc ('k') | chrome/browser/password_manager/native_backend_kwallet_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698