| Index: chrome/browser/password_manager/native_backend_kwallet_x.h
|
| ===================================================================
|
| --- chrome/browser/password_manager/native_backend_kwallet_x.h (revision 99666)
|
| +++ chrome/browser/password_manager/native_backend_kwallet_x.h (working copy)
|
| @@ -6,12 +6,10 @@
|
| #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_
|
| #pragma once
|
|
|
| -#include <dbus/dbus-glib.h>
|
| -#include <glib.h>
|
| -
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/time.h"
|
| #include "chrome/browser/password_manager/password_store_x.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -23,6 +21,15 @@
|
| struct PasswordForm;
|
| }
|
|
|
| +namespace base {
|
| +class WaitableEvent;
|
| +}
|
| +
|
| +namespace dbus {
|
| +class Bus;
|
| +class ObjectProxy;
|
| +}
|
| +
|
| // NativeBackend implementation using KWallet.
|
| class NativeBackendKWallet : public PasswordStoreX::NativeBackend {
|
| public:
|
| @@ -46,8 +53,13 @@
|
| virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE;
|
| virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE;
|
|
|
| + protected:
|
| + // Internally used by Init(), but also for testing to provide a mock bus.
|
| + bool InitWithBus(dbus::Bus* bus);
|
| +
|
| private:
|
| // Initialization.
|
| + void InitOnDBThread(base::WaitableEvent* event, bool* success);
|
| bool StartKWalletd();
|
| bool InitWallet();
|
|
|
| @@ -77,11 +89,6 @@
|
| const std::string& signon_realm,
|
| int wallet_handle);
|
|
|
| - // 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.
|
| - bool CheckError();
|
| -
|
| // Opens the wallet and ensures that the "Chrome Form Data" folder exists.
|
| // Returns kInvalidWalletHandle on error.
|
| int WalletHandle();
|
| @@ -99,7 +106,8 @@
|
|
|
| // Checks a serialized list of PasswordForms for sanity. Returns true if OK.
|
| // Note that |realm| is only used for generating a useful warning message.
|
| - static bool CheckSerializedValue(const GArray* byte_array, const char* realm);
|
| + static bool CheckSerializedValue(const uint8_t* byte_array, size_t length,
|
| + const std::string& realm);
|
|
|
| // Deserializes a list of PasswordForms from the wallet.
|
| static void DeserializeValue(const std::string& signon_realm,
|
| @@ -117,7 +125,7 @@
|
| // Name of the folder to store passwords in.
|
| static const char kKWalletFolder[];
|
|
|
| - // DBus stuff.
|
| + // DBus service, path, and interface names for klauncher and kwalletd.
|
| static const char kKWalletServiceName[];
|
| static const char kKWalletPath[];
|
| static const char kKWalletInterface[];
|
| @@ -146,13 +154,10 @@
|
| // True once MigrateToProfileSpecificLogins() has been attempted.
|
| bool migrate_tried_;
|
|
|
| - // Error from the last DBus call. NULL when there's no error. Freed and
|
| - // cleared by CheckError().
|
| - GError* error_;
|
| - // Connection to the DBus session bus.
|
| - DBusGConnection* connection_;
|
| - // Proxy to the kwallet DBus service.
|
| - DBusGProxy* proxy_;
|
| + // DBus handle for communication with klauncher and kwalletd.
|
| + scoped_refptr<dbus::Bus> session_bus_;
|
| + // Object proxy for kwalletd. We do not own this.
|
| + dbus::ObjectProxy* kwallet_proxy_;
|
|
|
| // The name of the wallet we've opened. Set during Init().
|
| std::string wallet_name_;
|
|
|