Chromium Code Reviews| Index: components/os_crypt/key_storage_kwallet.h |
| diff --git a/components/os_crypt/key_storage_kwallet.h b/components/os_crypt/key_storage_kwallet.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..73c2bfe89562755397431fb0cac5e38d327d3e9a |
| --- /dev/null |
| +++ b/components/os_crypt/key_storage_kwallet.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ |
| +#define COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ |
| + |
| +#include <memory> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "components/os_crypt/key_storage_linux.h" |
| +#include "components/os_crypt/kwallet_dbus.h" |
| + |
| +class KeyStorageKWallet : public KeyStorageLinux { |
| + public: |
| + explicit KeyStorageKWallet(base::nix::DesktopEnvironment desktop_env, |
|
Lei Zhang
2016/07/20 01:08:26
nit explicit
cfroussios
2016/07/20 15:22:46
Done.
|
| + std::string app_name); |
|
Lei Zhang
2016/07/20 01:08:26
Just pass by ref and set app_name_?
cfroussios
2016/07/20 15:22:46
For constructors, this is supposed to perform bett
Lei Zhang
2016/07/20 19:15:07
Well, this is definitely not hot code, and I think
cfroussios
2016/07/21 11:49:46
You don't need the "std::string&&" to take advanta
Lei Zhang
2016/07/21 21:25:31
+danakj to help provide guidance for the more acad
cfroussios
2016/07/22 11:25:25
Yes, I am only defending this pattern in general.
|
| + ~KeyStorageKWallet() override; |
| + |
| + // KeyStorageLinux |
| + std::string GetKey() override; |
| + |
| + // Initialize using an optional KWalletDBus mock. |
| + // A DBus session will not be created if a mock is provided. |
| + bool InitWithKWalletDBus( |
| + std::unique_ptr<KWalletDBus> optional_kwallet_dbus_ptr); |
| + |
| + protected: |
| + // KeyStorageLinux |
| + bool Init() override; |
| + |
| + private: |
| + enum class InitResult { |
| + SUCCESS, |
| + TEMPORARY_FAIL, |
| + PERMANENT_FAIL, |
| + }; |
| + |
| + // Checks whether KWallet is enabled and sets |wallet_name_| |
| + InitResult InitWallet(); |
| + |
| + // Create Chrome's folder in the wallet, if it doesn't exist. |
| + bool InitFolder(); |
| + |
| + const base::nix::DesktopEnvironment desktop_env_; |
| + int32_t handle_; |
| + std::string wallet_name_; |
| + const std::string app_name_; |
| + std::unique_ptr<KWalletDBus> kwallet_dbus_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(KeyStorageKWallet); |
| +}; |
| + |
| +#endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ |