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

Unified Diff: components/os_crypt/key_storage_keyring.h

Issue 2297573002: Implement gnome-keyring for OSCrypt (Closed)
Patch Set: removed thread checker Created 4 years, 3 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/BUILD.gn ('k') | components/os_crypt/key_storage_keyring.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/os_crypt/key_storage_keyring.h
diff --git a/components/os_crypt/key_storage_keyring.h b/components/os_crypt/key_storage_keyring.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e9c32747e1b967ab5fa4f63b4a8aeea2f3307af
--- /dev/null
+++ b/components/os_crypt/key_storage_keyring.h
@@ -0,0 +1,49 @@
+// 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_KEYRING_H_
+#define COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/os_crypt/key_storage_linux.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+class WaitableEvent;
+} // namespace base
+
+// Specialisation of KeyStorageLinux that uses Libsecret.
+class KeyStorageKeyring : public KeyStorageLinux {
+ public:
+ explicit KeyStorageKeyring(
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner);
+ ~KeyStorageKeyring() override;
+
+ // KeyStorageLinux
+ std::string GetKey() override;
+
+ protected:
+ // KeyStorageLinux
+ bool Init() override;
+
+ private:
+ // Gnome keyring requires calls to originate from the main thread.
+ // This is the part of GetKey() that gets dispatched to the main thread.
+ // The password is stored in |password_ptr|. If |password_loaded_ptr| is not
+ // null, it will be signaled when |password_ptr| is safe to read.
+ void GetKeyDelegate(std::string* password_ptr,
+ base::WaitableEvent* password_loaded_ptr);
+
+ // Generate a random string and store it as OScrypt's new password.
+ std::string AddRandomPasswordInKeyring();
+
+ // Keyring calls need to originate from the main thread.
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(KeyStorageKeyring);
+};
+
+#endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
« no previous file with comments | « components/os_crypt/BUILD.gn ('k') | components/os_crypt/key_storage_keyring.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698