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

Unified Diff: components/os_crypt/key_storage_kwallet.h

Issue 2150543002: OSCrypt supports encryption with KWallet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback 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_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..35edcf2fd1c327b1ba9a99b5079931ca0af31f0c
--- /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:
+ KeyStorageKWallet(base::nix::DesktopEnvironment desktop_env,
+ std::string app_name);
+ ~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,
+ };
+
+ // Check whether KWallet is enabled and set |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_

Powered by Google App Engine
This is Rietveld 408576698