OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ | |
6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 #include "components/os_crypt/key_storage_linux.h" | |
13 #include "components/os_crypt/kwallet_dbus.h" | |
14 | |
15 class KeyStorageKWallet : public KeyStorageLinux { | |
16 public: | |
17 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.
| |
18 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.
| |
19 ~KeyStorageKWallet() override; | |
20 | |
21 // KeyStorageLinux | |
22 std::string GetKey() override; | |
23 | |
24 // Initialize using an optional KWalletDBus mock. | |
25 // A DBus session will not be created if a mock is provided. | |
26 bool InitWithKWalletDBus( | |
27 std::unique_ptr<KWalletDBus> optional_kwallet_dbus_ptr); | |
28 | |
29 protected: | |
30 // KeyStorageLinux | |
31 bool Init() override; | |
32 | |
33 private: | |
34 enum class InitResult { | |
35 SUCCESS, | |
36 TEMPORARY_FAIL, | |
37 PERMANENT_FAIL, | |
38 }; | |
39 | |
40 // Checks whether KWallet is enabled and sets |wallet_name_| | |
41 InitResult InitWallet(); | |
42 | |
43 // Create Chrome's folder in the wallet, if it doesn't exist. | |
44 bool InitFolder(); | |
45 | |
46 const base::nix::DesktopEnvironment desktop_env_; | |
47 int32_t handle_; | |
48 std::string wallet_name_; | |
49 const std::string app_name_; | |
50 std::unique_ptr<KWalletDBus> kwallet_dbus_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(KeyStorageKWallet); | |
53 }; | |
54 | |
55 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_KWALLET_H_ | |
OLD | NEW |