| Index: chrome/browser/password_manager/native_backend_gnome_x.h
|
| ===================================================================
|
| --- chrome/browser/password_manager/native_backend_gnome_x.h (revision 110784)
|
| +++ chrome/browser/password_manager/native_backend_gnome_x.h (working copy)
|
| @@ -6,8 +6,6 @@
|
| #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_GNOME_X_H_
|
| #pragma once
|
|
|
| -#include <gnome-keyring.h>
|
| -
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| @@ -17,55 +15,19 @@
|
|
|
| class PrefService;
|
|
|
| +namespace keyring_proxy {
|
| +class KeyringProxyClient;
|
| +}
|
| +
|
| namespace webkit_glue {
|
| struct PasswordForm;
|
| }
|
|
|
| -// Many of the gnome_keyring_* functions use variable arguments, which makes
|
| -// them difficult if not impossible to truly wrap in C. Therefore, we use
|
| -// appropriately-typed function pointers and scoping to make the fact that we
|
| -// might be dynamically loading the library almost invisible. As a bonus, we
|
| -// also get a simple way to mock the library for testing. Classes that inherit
|
| -// from GnomeKeyringLoader will use its versions of the gnome_keyring_*
|
| -// functions. Note that it has only static fields.
|
| -class GnomeKeyringLoader {
|
| - protected:
|
| - static bool LoadGnomeKeyring();
|
| -
|
| -// Call a given parameter with the name of each function we use from GNOME
|
| -// Keyring. Make sure to adjust the unit test if you change these.
|
| -#define GNOME_KEYRING_FOR_EACH_FUNC(F) \
|
| - F(is_available) \
|
| - F(store_password) \
|
| - F(delete_password) \
|
| - F(find_itemsv) \
|
| - F(result_to_message)
|
| -
|
| -// Declare the actual function pointers that we'll use in client code.
|
| -#define GNOME_KEYRING_DECLARE_POINTER(name) \
|
| - static typeof(&::gnome_keyring_##name) gnome_keyring_##name;
|
| - GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_DECLARE_POINTER)
|
| -#undef GNOME_KEYRING_DECLARE_POINTER
|
| -
|
| - // Set to true if LoadGnomeKeyring() has already succeeded.
|
| - static bool keyring_loaded;
|
| -
|
| - private:
|
| -#if defined(DLOPEN_GNOME_KEYRING)
|
| - struct FunctionInfo {
|
| - const char* name;
|
| - void** pointer;
|
| - };
|
| -
|
| - // Make it easy to initialize the function pointers in LoadGnomeKeyring().
|
| - static const FunctionInfo functions[];
|
| -#endif // defined(DLOPEN_GNOME_KEYRING)
|
| -};
|
| -
|
| // NativeBackend implementation using GNOME Keyring.
|
| -class NativeBackendGnome : public PasswordStoreX::NativeBackend,
|
| - public GnomeKeyringLoader {
|
| +class NativeBackendGnome : public PasswordStoreX::NativeBackend {
|
| public:
|
| + static const char kGnomeKeyringAppString[];
|
| +
|
| NativeBackendGnome(LocalProfileId id, PrefService* prefs);
|
|
|
| virtual ~NativeBackendGnome();
|
| @@ -86,6 +48,10 @@
|
| virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE;
|
| virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE;
|
|
|
| + protected:
|
| + // Takes ownership of |client|. Use for testing only.
|
| + void InitForTesting(keyring_proxy::KeyringProxyClient* client);
|
| +
|
| private:
|
| // Adds a login form without checking for one to replace first.
|
| bool RawAddLogin(const webkit_glue::PasswordForm& form);
|
| @@ -114,6 +80,11 @@
|
| // True once MigrateToProfileSpecificLogins() has been attempted.
|
| bool migrate_tried_;
|
|
|
| + // The keyring proxy client handles communicating with an out-of-process
|
| + // GNOME Keyring client, since to do it in-process we'd need to involve
|
| + // the UI thread which can lead to deadlocks with password sync.
|
| + scoped_ptr<keyring_proxy::KeyringProxyClient> proxy_client_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(NativeBackendGnome);
|
| };
|
|
|
|
|