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

Unified Diff: components/os_crypt/key_storage_util_linux.cc

Issue 2256633002: Add two more options for the --password-store switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 4 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
« no previous file with comments | « components/os_crypt/key_storage_util_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/os_crypt/key_storage_util_linux.cc
diff --git a/components/os_crypt/key_storage_util_linux.cc b/components/os_crypt/key_storage_util_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d73c31118a48de85cfa4e2aeadf6dc5f2db6cdbf
--- /dev/null
+++ b/components/os_crypt/key_storage_util_linux.cc
@@ -0,0 +1,47 @@
+// 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.
+
+#include "components/os_crypt/key_storage_util_linux.h"
+
+#include "base/logging.h"
+
+namespace os_crypt {
+
+SelectedLinuxBackend SelectBackend(const std::string& type,
+ base::nix::DesktopEnvironment desktop_env) {
+ if (type == "kwallet")
+ return SelectedLinuxBackend::KWALLET;
+ if (type == "kwallet5")
+ return SelectedLinuxBackend::KWALLET5;
+ if (type == "gnome")
+ return SelectedLinuxBackend::GNOME_ANY;
+ if (type == "gnome-keyring")
+ return SelectedLinuxBackend::GNOME_KEYRING;
+ if (type == "gnome-libsecret")
+ return SelectedLinuxBackend::GNOME_LIBSECRET;
+ if (type == "basic")
+ return SelectedLinuxBackend::BASIC_TEXT;
+
+ const char* name = base::nix::GetDesktopEnvironmentName(desktop_env);
+ VLOG(1) << "Password storage detected desktop environment: "
+ << (name ? name : "(unknown)");
+
+ // Detect the store to use automatically.
+ switch (desktop_env) {
+ case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ return SelectedLinuxBackend::KWALLET;
+ case base::nix::DESKTOP_ENVIRONMENT_KDE5:
+ return SelectedLinuxBackend::KWALLET5;
+ case base::nix::DESKTOP_ENVIRONMENT_GNOME:
+ case base::nix::DESKTOP_ENVIRONMENT_UNITY:
+ case base::nix::DESKTOP_ENVIRONMENT_XFCE:
+ return SelectedLinuxBackend::GNOME_ANY;
+ // KDE3 didn't use DBus, which our KWallet store uses.
+ case base::nix::DESKTOP_ENVIRONMENT_KDE3:
+ case base::nix::DESKTOP_ENVIRONMENT_OTHER:
+ return SelectedLinuxBackend::BASIC_TEXT;
+ }
+}
+
+} // namespace os_crypt
« no previous file with comments | « components/os_crypt/key_storage_util_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698