Index: chrome/browser/password_manager/native_backend_libsecret.cc |
diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc |
index 21581c0c02ce431d548e9edc483965a489e98795..3e133619a58131a4036112ac93375640aa1e42f6 100644 |
--- a/chrome/browser/password_manager/native_backend_libsecret.cc |
+++ b/chrome/browser/password_manager/native_backend_libsecret.cc |
@@ -4,7 +4,6 @@ |
#include "chrome/browser/password_manager/native_backend_libsecret.h" |
-#include <dlfcn.h> |
#include <stddef.h> |
#include <stdint.h> |
@@ -14,6 +13,8 @@ |
#include <utility> |
#include <vector> |
+#include <libsecret/secret.h> |
+ |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
#include "base/strings/string_number_conversions.h" |
@@ -32,68 +33,6 @@ const char kEmptyString[] = ""; |
const int kMaxPossibleTimeTValue = std::numeric_limits<int>::max(); |
} // namespace |
-typeof(&::secret_password_store_sync) |
- LibsecretLoader::secret_password_store_sync; |
-typeof(&::secret_service_search_sync) |
- LibsecretLoader::secret_service_search_sync; |
-typeof(&::secret_password_clear_sync) |
- LibsecretLoader::secret_password_clear_sync; |
-typeof(&::secret_item_get_secret) LibsecretLoader::secret_item_get_secret; |
-typeof(&::secret_value_get_text) LibsecretLoader::secret_value_get_text; |
-typeof(&::secret_item_get_attributes) |
- LibsecretLoader::secret_item_get_attributes; |
-typeof(&::secret_item_load_secret_sync) |
- LibsecretLoader::secret_item_load_secret_sync; |
-typeof(&::secret_value_unref) LibsecretLoader::secret_value_unref; |
- |
-bool LibsecretLoader::libsecret_loaded = false; |
- |
-const LibsecretLoader::FunctionInfo LibsecretLoader::functions[] = { |
- {"secret_password_store_sync", |
- reinterpret_cast<void**>(&secret_password_store_sync)}, |
- {"secret_service_search_sync", |
- reinterpret_cast<void**>(&secret_service_search_sync)}, |
- {"secret_password_clear_sync", |
- reinterpret_cast<void**>(&secret_password_clear_sync)}, |
- {"secret_item_get_secret", |
- reinterpret_cast<void**>(&secret_item_get_secret)}, |
- {"secret_value_get_text", reinterpret_cast<void**>(&secret_value_get_text)}, |
- {"secret_item_get_attributes", |
- reinterpret_cast<void**>(&secret_item_get_attributes)}, |
- {"secret_item_load_secret_sync", |
- reinterpret_cast<void**>(&secret_item_load_secret_sync)}, |
- {"secret_value_unref", reinterpret_cast<void**>(&secret_value_unref)}, |
- {nullptr, nullptr}}; |
- |
-bool LibsecretLoader::LoadLibsecret() { |
- if (libsecret_loaded) |
- return true; |
- |
- void* handle = dlopen("libsecret-1.so.0", RTLD_NOW | RTLD_GLOBAL); |
- if (!handle) { |
- // We wanted to use libsecret, but we couldn't load it. Warn, because |
- // either the user asked for this, or we autodetected it incorrectly. (Or |
- // the system has broken libraries, which is also good to warn about.) |
- LOG(WARNING) << "Could not load libsecret-1.so.0: " << dlerror(); |
- return false; |
- } |
- |
- for (size_t i = 0; functions[i].name; ++i) { |
- dlerror(); |
- *functions[i].pointer = dlsym(handle, functions[i].name); |
- const char* error = dlerror(); |
- if (error) { |
- VLOG(1) << "Unable to load symbol " << functions[i].name << ": " << error; |
- dlclose(handle); |
- return false; |
- } |
- } |
- |
- libsecret_loaded = true; |
- // We leak the library handle. That's OK: this function is called only once. |
- return true; |
-} |
- |
namespace { |
const char kLibsecretAppString[] = "chrome"; |