| OLD | NEW |
| 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_UTIL_LINUX_H_ | 5 #ifndef COMPONENTS_OS_CRYPT_KEY_STORAGE_UTIL_LINUX_H_ |
| 6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_UTIL_LINUX_H_ | 6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_UTIL_LINUX_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/nix/xdg_util.h" | 10 #include "base/nix/xdg_util.h" |
| 11 | 11 |
| 12 namespace base { |
| 13 class FilePath; |
| 14 } |
| 15 |
| 12 namespace os_crypt { | 16 namespace os_crypt { |
| 13 | 17 |
| 14 // The supported Linux backends for storing passwords. | 18 // The supported Linux backends for storing passwords. |
| 15 enum class SelectedLinuxBackend { | 19 enum class SelectedLinuxBackend { |
| 16 DEFER, // No selection | 20 DEFER, // No selection |
| 17 BASIC_TEXT, | 21 BASIC_TEXT, |
| 18 GNOME_ANY, // GNOME_KEYRING or GNOME_LIBSECRET, whichever is available. | 22 GNOME_ANY, // GNOME_KEYRING or GNOME_LIBSECRET, whichever is available. |
| 19 GNOME_KEYRING, | 23 GNOME_KEYRING, |
| 20 GNOME_LIBSECRET, | 24 GNOME_LIBSECRET, |
| 21 KWALLET, | 25 KWALLET, |
| 22 KWALLET5, | 26 KWALLET5, |
| 23 }; | 27 }; |
| 24 | 28 |
| 25 // Decide which backend to target. |type| is checked first. If it does not | 29 // Decide which backend to target. |type| is checked first. If it does not |
| 26 // match a supported backend, |desktop_env| will be used to decide. | 30 // match a supported backend and |use_backend| is true, |desktop_env| will be |
| 31 // used to decide. |
| 27 // TODO(crbug/571003): This is exposed as a utility only for password manager to | 32 // TODO(crbug/571003): This is exposed as a utility only for password manager to |
| 28 // use. It should be merged into key_storage_linux, once no longer needed in | 33 // use. It should be merged into key_storage_linux, once no longer needed in |
| 29 // password manager. | 34 // password manager. |
| 30 SelectedLinuxBackend SelectBackend(const std::string& type, | 35 SelectedLinuxBackend SelectBackend(const std::string& type, |
| 36 bool use_backend, |
| 31 base::nix::DesktopEnvironment desktop_env); | 37 base::nix::DesktopEnvironment desktop_env); |
| 32 | 38 |
| 39 // Set the setting that disables using OS-level encryption. If |use| is true, |
| 40 // a backend will be used. |
| 41 bool WriteBackendUse(const base::FilePath& user_data_dir, bool use); |
| 42 |
| 43 // Decide whether the backend should be used based on the setting. |
| 44 bool GetBackendUse(const base::FilePath& user_data_dir); |
| 45 |
| 33 } // namespace os_crypt | 46 } // namespace os_crypt |
| 34 | 47 |
| 35 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_UTIL_LINUX_H_ | 48 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_UTIL_LINUX_H_ |
| OLD | NEW |