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

Unified Diff: components/os_crypt/key_storage_keyring.h

Issue 2297573002: Implement gnome-keyring for OSCrypt (Closed)
Patch Set: Fixed malloc - delete mismatch 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
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..916230fec18ac6c342e2117f65f078a5ca94893e
--- /dev/null
+++ b/components/os_crypt/key_storage_keyring.h
@@ -0,0 +1,46 @@
+// 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 "base/single_thread_task_runner.h"
+#include "base/synchronization/waitable_event.h"
Lei Zhang 2016/08/30 23:19:24 Forward declare instead? If I previously recommend
cfroussios 2016/08/31 12:18:41 Done.
+#include "components/os_crypt/key_storage_linux.h"
+
+// Specialisation of KeyStorageLinux that uses Libsecret.
+class KeyStorageKeyring : public KeyStorageLinux {
+ public:
+ KeyStorageKeyring(
Lei Zhang 2016/08/30 23:19:24 explicit
cfroussios 2016/08/31 12:18:41 Done.
+ 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.
+ static void GetKeyDelegate(std::string* password_ptr,
+ base::WaitableEvent* password_loaded_ptr);
+
+ // Generate a random string and store it as OScrypt's new password.
+ static 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_

Powered by Google App Engine
This is Rietveld 408576698