Index: components/os_crypt/kwallet_dbus.h |
diff --git a/components/os_crypt/kwallet_dbus.h b/components/os_crypt/kwallet_dbus.h |
index e0412c514b0089c634677aee9f04e60e4f74faab..e5366ecbf5a20dc5871adb0ba04789e80147409d 100644 |
--- a/components/os_crypt/kwallet_dbus.h |
+++ b/components/os_crypt/kwallet_dbus.h |
@@ -24,17 +24,17 @@ class KWalletDBus { |
enum Error { SUCCESS = 0, CANNOT_CONTACT, CANNOT_READ }; |
explicit KWalletDBus(base::nix::DesktopEnvironment desktop_env); |
- ~KWalletDBus(); |
+ virtual ~KWalletDBus(); |
// Set the bus that we will use. Required before any other operation. |
// The owner of KWalletDBus is responsible for killing the bus. |
- void SetSessionBus(scoped_refptr<dbus::Bus> session_bus); |
+ virtual void SetSessionBus(scoped_refptr<dbus::Bus> session_bus); |
// Expose the bus so that shutdown can be scheduled asynchronously. |
- dbus::Bus* GetSessionBus(); |
+ virtual dbus::Bus* GetSessionBus(); |
// Use KLauncher to start the KWallet service. Returns true if successful. |
- bool StartKWalletd() WARN_UNUSED_RESULT; |
+ virtual bool StartKWalletd() WARN_UNUSED_RESULT; |
// The functions below are wrappers for calling the eponymous KWallet dbus |
// methods. They take pointers to locations where the return values will be |
@@ -42,65 +42,89 @@ class KWalletDBus { |
// https://api.kde.org/4.12-api/kdelibs-apidocs/kdeui/html/classKWallet_1_1Wallet.html |
// Determine if the KDE wallet is enabled. |
- Error IsEnabled(bool* enabled) WARN_UNUSED_RESULT; |
+ virtual Error IsEnabled(bool* enabled) WARN_UNUSED_RESULT; |
// Get the name of the wallet used to store network passwords. |
- Error NetworkWallet(std::string* wallet_name_ptr) WARN_UNUSED_RESULT; |
+ virtual Error NetworkWallet(std::string* wallet_name_ptr) WARN_UNUSED_RESULT; |
// Open the |wallet_name| wallet for use. |
- Error Open(const std::string& wallet_name, |
- const std::string& app_name, |
- int* handle_ptr) WARN_UNUSED_RESULT; |
+ virtual Error Open(const std::string& wallet_name, |
+ const std::string& app_name, |
+ int* handle_ptr) WARN_UNUSED_RESULT; |
// Determine if the current folder has they entry key. |
- Error HasEntry(int wallet_handle, |
- const std::string& folder_name, |
- const std::string& signon_realm, |
- const std::string& app_name, |
- bool* has_entry_ptr) WARN_UNUSED_RESULT; |
+ virtual Error HasEntry(int wallet_handle, |
+ const std::string& folder_name, |
+ const std::string& signon_realm, |
+ const std::string& app_name, |
+ bool* has_entry_ptr) WARN_UNUSED_RESULT; |
// Read the entry key from the current folder. |
- Error ReadEntry(int wallet_handle, |
- const std::string& folder_name, |
- const std::string& signon_realm, |
- const std::string& app_name, |
- std::vector<uint8_t>* bytes_ptr) WARN_UNUSED_RESULT; |
+ virtual Error ReadEntry(int wallet_handle, |
+ const std::string& folder_name, |
+ const std::string& signon_realm, |
+ const std::string& app_name, |
+ std::vector<uint8_t>* bytes_ptr) WARN_UNUSED_RESULT; |
// Return the list of keys of all entries in this folder. |
- Error EntryList(int wallet_handle, |
- const std::string& folder_name, |
- const std::string& app_name, |
- std::vector<std::string>* entry_list_ptr) WARN_UNUSED_RESULT; |
+ virtual Error EntryList(int wallet_handle, |
+ const std::string& folder_name, |
+ const std::string& app_name, |
+ std::vector<std::string>* entry_list_ptr) |
+ WARN_UNUSED_RESULT; |
// Remove the entry key from the current folder. |
// |*return_code_ptr| is 0 on success. |
- Error RemoveEntry(int wallet_handle, |
- const std::string& folder_name, |
- const std::string& signon_realm, |
- const std::string& app_name, |
- int* return_code_ptr) WARN_UNUSED_RESULT; |
+ virtual Error RemoveEntry(int wallet_handle, |
+ const std::string& folder_name, |
+ const std::string& signon_realm, |
+ const std::string& app_name, |
+ int* return_code_ptr) WARN_UNUSED_RESULT; |
// Write a binary entry to the current folder. |
// |*return_code_ptr| is 0 on success. |
- Error WriteEntry(int wallet_handle, |
- const std::string& folder_name, |
- const std::string& signon_realm, |
- const std::string& app_name, |
- const uint8_t* data, |
- size_t length, |
- int* return_code_ptr) WARN_UNUSED_RESULT; |
+ virtual Error WriteEntry(int wallet_handle, |
+ const std::string& folder_name, |
+ const std::string& signon_realm, |
+ const std::string& app_name, |
+ const uint8_t* data, |
+ size_t length, |
+ int* return_code_ptr) WARN_UNUSED_RESULT; |
// Determine if the folder |folder_name| exists in the wallet. |
- Error HasFolder(int handle, |
- const std::string& folder_name, |
- const std::string& app_name, |
- bool* has_folder_ptr) WARN_UNUSED_RESULT; |
- |
- // Created the folder |folder_name|. |
- Error CreateFolder(int handle, |
- const std::string& folder_name, |
- const std::string& app_name, |
- bool* success_ptr) WARN_UNUSED_RESULT; |
+ virtual Error HasFolder(int handle, |
+ const std::string& folder_name, |
+ const std::string& app_name, |
+ bool* has_folder_ptr) WARN_UNUSED_RESULT; |
+ |
+ // Create the folder |folder_name|. |
+ virtual Error CreateFolder(int handle, |
+ const std::string& folder_name, |
+ const std::string& app_name, |
+ bool* success_ptr) WARN_UNUSED_RESULT; |
+ |
+ // Write a password to the current folder. |
+ virtual Error WritePassword(int handle, |
+ const std::string& folder_name, |
+ const std::string& key, |
+ const std::string& password, |
+ const std::string& app_name, |
+ bool* write_success_ptr) WARN_UNUSED_RESULT; |
+ |
+ // Read the password for |key| from |folder_name|. |
+ // Clear |password_ptr| if no such password exists. |
+ virtual Error ReadPassword(int handle, |
+ const std::string& folder_name, |
+ const std::string& key, |
+ const std::string& app_name, |
+ std::string* password_ptr) WARN_UNUSED_RESULT; |
+ |
+ // Close the wallet. The wallet will only be closed if it is open but not in |
+ // use (rare), or if it is forced closed. |
+ virtual Error Close(int handle, |
+ bool force, |
+ const std::string& app_name, |
+ bool* success_ptr) WARN_UNUSED_RESULT; |
private: |
// DBus handle for communication with klauncher and kwalletd. |