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_LIBSECRET_UTIL_LINUX_H_ | 5 #ifndef COMPONENTS_OS_CRYPT_LIBSECRET_UTIL_LINUX_H_ |
6 #define COMPONENTS_OS_CRYPT_LIBSECRET_UTIL_LINUX_H_ | 6 #define COMPONENTS_OS_CRYPT_LIBSECRET_UTIL_LINUX_H_ |
7 | 7 |
8 #include <libsecret/secret.h> | 8 #include <libsecret/secret.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 | 14 |
15 // Utility for dynamically loading libsecret. | 15 // Utility for dynamically loading libsecret. |
16 class LibsecretLoader { | 16 class LibsecretLoader { |
17 public: | 17 public: |
18 static decltype(&::secret_item_get_attributes) secret_item_get_attributes; | 18 static decltype(&::secret_item_get_attributes) secret_item_get_attributes; |
19 static decltype(&::secret_item_get_secret) secret_item_get_secret; | 19 static decltype(&::secret_item_get_secret) secret_item_get_secret; |
20 static decltype(&::secret_item_load_secret_sync) secret_item_load_secret_sync; | 20 static decltype(&::secret_item_load_secret_sync) secret_item_load_secret_sync; |
21 static decltype(&::secret_password_clear_sync) secret_password_clear_sync; | 21 static decltype(&::secret_password_clear_sync) secret_password_clear_sync; |
22 static decltype(&::secret_password_store_sync) secret_password_store_sync; | 22 static decltype(&::secret_password_store_sync) secret_password_store_sync; |
23 static decltype(&::secret_service_lookup_sync) secret_service_lookup_sync; | |
24 static decltype(&::secret_service_search_sync) secret_service_search_sync; | 23 static decltype(&::secret_service_search_sync) secret_service_search_sync; |
25 static decltype(&::secret_value_get_text) secret_value_get_text; | 24 static decltype(&::secret_value_get_text) secret_value_get_text; |
26 static decltype(&::secret_value_unref) secret_value_unref; | 25 static decltype(&::secret_value_unref) secret_value_unref; |
27 | 26 |
28 // Loads the libsecret library and checks that it responds to queries. | 27 // Loads the libsecret library and checks that it responds to queries. |
29 // Returns false if either step fails. | 28 // Returns false if either step fails. |
30 // Repeated calls check the responsiveness every time, but do not load the | 29 // Repeated calls check the responsiveness every time, but do not load the |
31 // the library again if already successful. | 30 // the library again if already successful. |
32 static bool EnsureLibsecretLoaded(); | 31 static bool EnsureLibsecretLoaded(); |
33 | 32 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // the implementation details of containers. External objects keep references | 74 // the implementation details of containers. External objects keep references |
76 // to the objects stored in this container. Using a vector here will fail the | 75 // to the objects stored in this container. Using a vector here will fail the |
77 // ASan tests, because it may move the objects and break the references. | 76 // ASan tests, because it may move the objects and break the references. |
78 std::list<std::string> name_values_; | 77 std::list<std::string> name_values_; |
79 GHashTable* attrs_; | 78 GHashTable* attrs_; |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(LibsecretAttributesBuilder); | 80 DISALLOW_COPY_AND_ASSIGN(LibsecretAttributesBuilder); |
82 }; | 81 }; |
83 | 82 |
84 #endif // COMPONENTS_OS_CRYPT_LIBSECRET_UTIL_LINUX_H_ | 83 #endif // COMPONENTS_OS_CRYPT_LIBSECRET_UTIL_LINUX_H_ |
OLD | NEW |