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

Side by Side 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, 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/single_thread_task_runner.h"
12 #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.
13 #include "components/os_crypt/key_storage_linux.h"
14
15 // Specialisation of KeyStorageLinux that uses Libsecret.
16 class KeyStorageKeyring : public KeyStorageLinux {
17 public:
18 KeyStorageKeyring(
Lei Zhang 2016/08/30 23:19:24 explicit
cfroussios 2016/08/31 12:18:41 Done.
19 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner);
20 ~KeyStorageKeyring() override;
21
22 // KeyStorageLinux
23 std::string GetKey() override;
24
25 protected:
26 // KeyStorageLinux
27 bool Init() override;
28
29 private:
30 // Gnome keyring requires calls to originate from the main thread.
31 // This is the part of GetKey() that gets dispatched to the main thread.
32 // The password is stored in |password_ptr|. If |password_loaded_ptr| is not
33 // null, it will be signaled when |password_ptr| is safe to read.
34 static void GetKeyDelegate(std::string* password_ptr,
35 base::WaitableEvent* password_loaded_ptr);
36
37 // Generate a random string and store it as OScrypt's new password.
38 static std::string AddRandomPasswordInKeyring();
39
40 // Keyring calls need to originate from the main thread.
41 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner_;
42
43 DISALLOW_COPY_AND_ASSIGN(KeyStorageKeyring);
44 };
45
46 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_KEYRING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698