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

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

Issue 2262693002: Initialize OSCrypt with a TaskRunner on the main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main_linux.cc ('k') | components/os_crypt/key_storage_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_ 5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_ 6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h"
12 14
13 // An API for retrieving OSCrypt's password from the system's password storage 15 // An API for retrieving OSCrypt's password from the system's password storage
14 // service. 16 // service.
15 class KeyStorageLinux { 17 class KeyStorageLinux {
16 public: 18 public:
17 KeyStorageLinux() = default; 19 KeyStorageLinux() = default;
18 virtual ~KeyStorageLinux() = default; 20 virtual ~KeyStorageLinux() = default;
19 21
20 // Force OSCrypt to use a specific linux password store. 22 // Force OSCrypt to use a specific linux password store.
21 static void SetStore(const std::string& store_type); 23 static void SetStore(const std::string& store_type);
22 24
23 // The product name to use for permission prompts. 25 // The product name to use for permission prompts.
24 static void SetProductName(const std::string& product_name); 26 static void SetProductName(const std::string& product_name);
25 27
28 // A runner on the main thread for gnome-keyring to be called from.
29 // TODO(crbug/466975): Libsecret and KWallet don't need this. We can remove
30 // this when we stop supporting keyring.
31 static void SetMainThreadRunner(
32 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner);
33
26 // Tries to load the appropriate key storage. Returns null if none succeed. 34 // Tries to load the appropriate key storage. Returns null if none succeed.
27 static std::unique_ptr<KeyStorageLinux> CreateService(); 35 static std::unique_ptr<KeyStorageLinux> CreateService();
28 36
29 // Gets the encryption key from the OS password-managing library. If a key is 37 // Gets the encryption key from the OS password-managing library. If a key is
30 // not found, a new key will be generated, stored and returned. 38 // not found, a new key will be generated, stored and returned.
31 virtual std::string GetKey() = 0; 39 virtual std::string GetKey() = 0;
32 40
33 protected: 41 protected:
34 // Loads the key storage. Returns false if the service is not available. 42 // Loads the key storage. Returns false if the service is not available.
35 virtual bool Init() = 0; 43 virtual bool Init() = 0;
36 44
37 // The name of the group, if any, containing the key. 45 // The name of the group, if any, containing the key.
38 static const char kFolderName[]; 46 static const char kFolderName[];
39 // The name of the entry with the encryption key. 47 // The name of the entry with the encryption key.
40 static const char kKey[]; 48 static const char kKey[];
41 49
42 private: 50 private:
43 DISALLOW_COPY_AND_ASSIGN(KeyStorageLinux); 51 DISALLOW_COPY_AND_ASSIGN(KeyStorageLinux);
44 }; 52 };
45 53
46 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_ 54 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_linux.cc ('k') | components/os_crypt/key_storage_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698