| 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 #include "components/os_crypt/libsecret_util_linux.h" | 5 #include "components/os_crypt/libsecret_util_linux.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 | 11 |
| 12 // | 12 // |
| 13 // LibsecretLoader | 13 // LibsecretLoader |
| 14 // | 14 // |
| 15 | 15 |
| 16 decltype( | 16 decltype( |
| 17 &::secret_password_store_sync) LibsecretLoader::secret_password_store_sync; | 17 &::secret_password_store_sync) LibsecretLoader::secret_password_store_sync = |
| 18 nullptr; |
| 18 decltype( | 19 decltype( |
| 19 &::secret_service_search_sync) LibsecretLoader::secret_service_search_sync; | 20 &::secret_service_search_sync) LibsecretLoader::secret_service_search_sync = |
| 21 nullptr; |
| 20 decltype( | 22 decltype( |
| 21 &::secret_password_clear_sync) LibsecretLoader::secret_password_clear_sync; | 23 &::secret_password_clear_sync) LibsecretLoader::secret_password_clear_sync = |
| 22 decltype(&::secret_item_get_secret) LibsecretLoader::secret_item_get_secret; | 24 nullptr; |
| 23 decltype(&::secret_value_get_text) LibsecretLoader::secret_value_get_text; | 25 decltype(&::secret_item_get_secret) LibsecretLoader::secret_item_get_secret = |
| 26 nullptr; |
| 27 decltype(&::secret_value_get_text) LibsecretLoader::secret_value_get_text = |
| 28 nullptr; |
| 24 decltype( | 29 decltype( |
| 25 &::secret_item_get_attributes) LibsecretLoader::secret_item_get_attributes; | 30 &::secret_item_get_attributes) LibsecretLoader::secret_item_get_attributes = |
| 31 nullptr; |
| 26 decltype(&::secret_item_load_secret_sync) | 32 decltype(&::secret_item_load_secret_sync) |
| 27 LibsecretLoader::secret_item_load_secret_sync; | 33 LibsecretLoader::secret_item_load_secret_sync = nullptr; |
| 28 decltype(&::secret_value_unref) LibsecretLoader::secret_value_unref; | 34 decltype(&::secret_value_unref) LibsecretLoader::secret_value_unref = nullptr; |
| 29 | 35 |
| 30 bool LibsecretLoader::libsecret_loaded_ = false; | 36 bool LibsecretLoader::libsecret_loaded_ = false; |
| 31 | 37 |
| 32 const LibsecretLoader::FunctionInfo LibsecretLoader::kFunctions[] = { | 38 const LibsecretLoader::FunctionInfo LibsecretLoader::kFunctions[] = { |
| 33 {"secret_item_get_secret", | 39 {"secret_item_get_secret", |
| 34 reinterpret_cast<void**>(&secret_item_get_secret)}, | 40 reinterpret_cast<void**>(&secret_item_get_secret)}, |
| 35 {"secret_item_get_attributes", | 41 {"secret_item_get_attributes", |
| 36 reinterpret_cast<void**>(&secret_item_get_attributes)}, | 42 reinterpret_cast<void**>(&secret_item_get_attributes)}, |
| 37 {"secret_item_load_secret_sync", | 43 {"secret_item_load_secret_sync", |
| 38 reinterpret_cast<void**>(&secret_item_load_secret_sync)}, | 44 reinterpret_cast<void**>(&secret_item_load_secret_sync)}, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 name_values_.push_back(value); | 141 name_values_.push_back(value); |
| 136 gpointer value_str = | 142 gpointer value_str = |
| 137 static_cast<gpointer>(const_cast<char*>(name_values_.back().c_str())); | 143 static_cast<gpointer>(const_cast<char*>(name_values_.back().c_str())); |
| 138 g_hash_table_insert(attrs_, name_str, value_str); | 144 g_hash_table_insert(attrs_, name_str, value_str); |
| 139 } | 145 } |
| 140 | 146 |
| 141 void LibsecretAttributesBuilder::Append(const std::string& name, | 147 void LibsecretAttributesBuilder::Append(const std::string& name, |
| 142 int64_t value) { | 148 int64_t value) { |
| 143 Append(name, base::Int64ToString(value)); | 149 Append(name, base::Int64ToString(value)); |
| 144 } | 150 } |
| OLD | NEW |