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

Side by Side Diff: components/os_crypt/key_storage_keyring.h

Issue 2297573002: Implement gnome-keyring for OSCrypt (Closed)
Patch Set: fix rel compilation 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/threading/thread_checker.h"
12 #include "components/os_crypt/key_storage_linux.h"
13
14 namespace base {
15 class SingleThreadTaskRunner;
16 class WaitableEvent;
17 } // namespace base
18
19 // Specialisation of KeyStorageLinux that uses Libsecret.
20 class KeyStorageKeyring : public KeyStorageLinux {
21 public:
22 explicit KeyStorageKeyring(
23 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner);
24 ~KeyStorageKeyring() override;
25
26 // KeyStorageLinux
27 std::string GetKey() override;
28
29 protected:
30 // KeyStorageLinux
31 bool Init() override;
32
33 private:
34 // Gnome keyring requires calls to originate from the main thread.
35 // This is the part of GetKey() that gets dispatched to the main thread.
36 // The password is stored in |password_ptr|. If |password_loaded_ptr| is not
37 // null, it will be signaled when |password_ptr| is safe to read.
38 void GetKeyDelegate(std::string* password_ptr,
39 base::WaitableEvent* password_loaded_ptr);
40
41 // Generate a random string and store it as OScrypt's new password.
42 std::string AddRandomPasswordInKeyring();
43
44 // Keyring calls need to originate from the main thread.
45 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
46 base::ThreadChecker thread_checker_;
47
48 DISALLOW_COPY_AND_ASSIGN(KeyStorageKeyring);
49 };
50
51 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698