Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: components/os_crypt/key_storage_linux.cc

Issue 2150543002: OSCrypt supports encryption with KWallet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/os_crypt/key_storage_linux.cc
diff --git a/components/os_crypt/key_storage_linux.cc b/components/os_crypt/key_storage_linux.cc
index e54bb9e6719f89d22e763eb8a0aa0b70afa4c2c4..029bf9cd8c9e482c01e1f52ae33d1c664a23ac2e 100644
--- a/components/os_crypt/key_storage_linux.cc
+++ b/components/os_crypt/key_storage_linux.cc
@@ -4,8 +4,6 @@
#include "components/os_crypt/key_storage_linux.h"
-#include <string.h>
-
#include "base/environment.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -15,7 +13,12 @@
#include "components/os_crypt/key_storage_libsecret.h"
#endif
+#if defined(USE_KWALLET)
+#include "components/os_crypt/key_storage_kwallet.h"
+#endif
+
base::LazyInstance<std::string> g_store_ = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<std::string> g_product_name_ = LAZY_INSTANCE_INITIALIZER;
Lei Zhang 2016/07/20 01:08:26 Sorry if I missed it earlier, but g_foo doesn't ne
cfroussios 2016/07/20 15:22:46 Done.
// static
void KeyStorageLinux::SetStore(const std::string& store_type) {
@@ -24,6 +27,11 @@ void KeyStorageLinux::SetStore(const std::string& store_type) {
}
// static
+void KeyStorageLinux::SetProductName(const std::string& product_name) {
+ g_product_name_.Get() = product_name;
+}
+
+// static
std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService() {
base::nix::DesktopEnvironment used_desktop_env;
if (g_store_.Get() == "kwallet") {
@@ -51,6 +59,17 @@ std::unique_ptr<KeyStorageLinux> KeyStorageLinux::CreateService() {
return key_storage;
}
#endif
+ } else if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+ used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
+#if defined(USE_KWALLET)
+ DCHECK(!g_product_name_.Get().empty());
+ key_storage.reset(
+ new KeyStorageKWallet(used_desktop_env, g_product_name_.Get()));
+ if (key_storage->Init()) {
+ VLOG(1) << "OSCrypt using KWallet as backend.";
+ return key_storage;
+ }
+#endif
}
// The appropriate store was not available.

Powered by Google App Engine
This is Rietveld 408576698