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

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

Issue 2948783002: Create setting that disables password stores (Closed)
Patch Set: nits + tests Created 3 years, 5 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 | « components/os_crypt/BUILD.gn ('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" 12 #include "base/memory/ref_counted.h"
13 13
14 namespace base { 14 namespace base {
15 class FilePath;
15 class SingleThreadTaskRunner; 16 class SingleThreadTaskRunner;
16 } // namespace base 17 } // namespace base
17 18
18 // An API for retrieving OSCrypt's password from the system's password storage 19 // An API for retrieving OSCrypt's password from the system's password storage
19 // service. 20 // service.
20 class KeyStorageLinux { 21 class KeyStorageLinux {
21 public: 22 public:
22 KeyStorageLinux() = default; 23 KeyStorageLinux() = default;
23 virtual ~KeyStorageLinux() = default; 24 virtual ~KeyStorageLinux() = default;
24 25
25 // Force OSCrypt to use a specific linux password store. 26 // Force OSCrypt to use a specific linux password store.
26 static void SetStore(const std::string& store_type); 27 static void SetStore(const std::string& store_type);
27 28
28 // The product name to use for permission prompts. 29 // The product name to use for permission prompts.
29 static void SetProductName(const std::string& product_name); 30 static void SetProductName(const std::string& product_name);
30 31
31 // A runner on the main thread for gnome-keyring to be called from. 32 // A runner on the main thread for gnome-keyring to be called from.
32 // TODO(crbug/466975): Libsecret and KWallet don't need this. We can remove 33 // TODO(crbug/466975): Libsecret and KWallet don't need this. We can remove
33 // this when we stop supporting keyring. 34 // this when we stop supporting keyring.
34 static void SetMainThreadRunner( 35 static void SetMainThreadRunner(
35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner); 36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner);
36 37
38 // Controls whether preference on using or ignoring backends is used.
39 static void ShouldUsePreference(bool should_use_preference);
40
41 // Preferences are stored in a separate file in the user data directory.
42 static void SetUserDataPath(const base::FilePath& path);
43
37 // Tries to load the appropriate key storage. Returns null if none succeed. 44 // Tries to load the appropriate key storage. Returns null if none succeed.
38 static std::unique_ptr<KeyStorageLinux> CreateService(); 45 static std::unique_ptr<KeyStorageLinux> CreateService();
39 46
40 // Gets the encryption key from the OS password-managing library. If a key is 47 // Gets the encryption key from the OS password-managing library. If a key is
41 // not found, a new key will be generated, stored and returned. 48 // not found, a new key will be generated, stored and returned.
42 virtual std::string GetKey() = 0; 49 virtual std::string GetKey() = 0;
43 50
44 protected: 51 protected:
45 // Loads the key storage. Returns false if the service is not available. 52 // Loads the key storage. Returns false if the service is not available.
46 virtual bool Init() = 0; 53 virtual bool Init() = 0;
47 54
48 // The name of the group, if any, containing the key. 55 // The name of the group, if any, containing the key.
49 static const char kFolderName[]; 56 static const char kFolderName[];
50 // The name of the entry with the encryption key. 57 // The name of the entry with the encryption key.
51 static const char kKey[]; 58 static const char kKey[];
52 59
53 private: 60 private:
54 DISALLOW_COPY_AND_ASSIGN(KeyStorageLinux); 61 DISALLOW_COPY_AND_ASSIGN(KeyStorageLinux);
55 }; 62 };
56 63
57 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_ 64 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_LINUX_H_
OLDNEW
« no previous file with comments | « components/os_crypt/BUILD.gn ('k') | components/os_crypt/key_storage_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698