Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_ | |
| OLD | NEW |