Commit da4e6a83 authored by cfroussios's avatar cfroussios Committed by Commit bot

Deprecate DLOPEN_GNOME_KEYRING flag

GnomeKeyringLoader will be moved into a separate utility.
This change makes GnomeKeyringLoader simpler to build on and easier
to move.

Currently, GnomeKeyringLoader compiles different code, depending on
whether keyring is statically linked. Now it will only do dynamic
loading. The only place that requires static linking is tests, and they
don't need GnomeKeyringLoader to do it for them.

BUG=602624

Review-Url: https://codereview.chromium.org/2191873002
Cr-Commit-Position: refs/heads/master@{#408924}
parent 506f6a15
...@@ -1416,8 +1416,6 @@ ...@@ -1416,8 +1416,6 @@
# Default of 'use_allocator' is set to 'none' if OS=='android' later. # Default of 'use_allocator' is set to 'none' if OS=='android' later.
'use_allocator%': 'tcmalloc', 'use_allocator%': 'tcmalloc',
# Set to 1 to link against libgnome-keyring instead of using dlopen().
'linux_link_gnome_keyring%': 0,
# Set to 1 to link against gsettings APIs instead of using dlopen(). # Set to 1 to link against gsettings APIs instead of using dlopen().
'linux_link_gsettings%': 0, 'linux_link_gsettings%': 0,
......
...@@ -987,41 +987,14 @@ ...@@ -987,41 +987,14 @@
'defines': [ 'defines': [
'USE_GNOME_KEYRING', 'USE_GNOME_KEYRING',
], ],
'conditions': [
['linux_link_gnome_keyring==0', {
'defines': ['DLOPEN_GNOME_KEYRING'],
}],
],
}, },
'conditions': [
['linux_link_gnome_keyring!=0', {
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-L --libs-only-other gnome-keyring-1)',
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l gnome-keyring-1)',
],
},
}, {
'conditions': [
['OS=="linux"', {
'link_settings': {
'libraries': [
'-ldl',
],
},
}],
],
}],
],
}], }],
], ],
}, },
{ {
# The unit tests use a few convenience functions from the GNOME # The unit tests use a few convenience functions from the GNOME
# Keyring library directly. We ignore linux_link_gnome_keyring and # Keyring library directly. We link directly in this version of
# link directly in this version of the target to allow this. # the target to allow this.
# *** Do not use this target in the main binary! *** # *** Do not use this target in the main binary! ***
'target_name': 'gnome_keyring_direct', 'target_name': 'gnome_keyring_direct',
'type': 'none', 'type': 'none',
...@@ -1034,11 +1007,6 @@ ...@@ -1034,11 +1007,6 @@
'defines': [ 'defines': [
'USE_GNOME_KEYRING', 'USE_GNOME_KEYRING',
], ],
'conditions': [
['linux_link_gnome_keyring==0', {
'defines': ['DLOPEN_GNOME_KEYRING'],
}],
],
}, },
'link_settings': { 'link_settings': {
'ldflags': [ 'ldflags': [
......
...@@ -61,10 +61,7 @@ if (is_desktop_linux) { ...@@ -61,10 +61,7 @@ if (is_desktop_linux) {
# will set this up. # will set this up.
pkg_config("gnome_keyring") { pkg_config("gnome_keyring") {
packages = [ "gnome-keyring-1" ] packages = [ "gnome-keyring-1" ]
defines = [ defines = [ "USE_GNOME_KEYRING" ]
"USE_GNOME_KEYRING",
"DLOPEN_GNOME_KEYRING",
]
ignore_libs = true ignore_libs = true
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <limits>
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
...@@ -48,8 +49,6 @@ GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_DEFINE_POINTER) ...@@ -48,8 +49,6 @@ GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_DEFINE_POINTER)
bool GnomeKeyringLoader::keyring_loaded = false; bool GnomeKeyringLoader::keyring_loaded = false;
#if defined(DLOPEN_GNOME_KEYRING)
#define GNOME_KEYRING_FUNCTION_INFO(name) \ #define GNOME_KEYRING_FUNCTION_INFO(name) \
{"gnome_keyring_"#name, reinterpret_cast<void**>(&gnome_keyring_##name)}, {"gnome_keyring_"#name, reinterpret_cast<void**>(&gnome_keyring_##name)},
const GnomeKeyringLoader::FunctionInfo GnomeKeyringLoader::functions[] = { const GnomeKeyringLoader::FunctionInfo GnomeKeyringLoader::functions[] = {
...@@ -89,21 +88,6 @@ bool GnomeKeyringLoader::LoadGnomeKeyring() { ...@@ -89,21 +88,6 @@ bool GnomeKeyringLoader::LoadGnomeKeyring() {
return true; return true;
} }
#else // defined(DLOPEN_GNOME_KEYRING)
bool GnomeKeyringLoader::LoadGnomeKeyring() {
if (keyring_loaded)
return true;
#define GNOME_KEYRING_ASSIGN_POINTER(name) \
gnome_keyring_##name = &::gnome_keyring_##name;
GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_ASSIGN_POINTER)
#undef GNOME_KEYRING_ASSIGN_POINTER
keyring_loaded = true;
return true;
}
#endif // defined(DLOPEN_GNOME_KEYRING)
namespace { namespace {
const char kGnomeKeyringAppString[] = "chrome"; const char kGnomeKeyringAppString[] = "chrome";
......
...@@ -71,7 +71,6 @@ class GnomeKeyringLoader { ...@@ -71,7 +71,6 @@ class GnomeKeyringLoader {
static bool keyring_loaded; static bool keyring_loaded;
private: private:
#if defined(DLOPEN_GNOME_KEYRING)
struct FunctionInfo { struct FunctionInfo {
const char* name; const char* name;
void** pointer; void** pointer;
...@@ -79,7 +78,6 @@ class GnomeKeyringLoader { ...@@ -79,7 +78,6 @@ class GnomeKeyringLoader {
// Make it easy to initialize the function pointers in LoadGnomeKeyring(). // Make it easy to initialize the function pointers in LoadGnomeKeyring().
static const FunctionInfo functions[]; static const FunctionInfo functions[];
#endif // defined(DLOPEN_GNOME_KEYRING)
}; };
// NativeBackend implementation using GNOME Keyring. // NativeBackend implementation using GNOME Keyring.
......
...@@ -278,12 +278,16 @@ const gchar* mock_gnome_keyring_result_to_message(GnomeKeyringResult res) { ...@@ -278,12 +278,16 @@ const gchar* mock_gnome_keyring_result_to_message(GnomeKeyringResult res) {
class MockGnomeKeyringLoader : public GnomeKeyringLoader { class MockGnomeKeyringLoader : public GnomeKeyringLoader {
public: public:
static bool LoadMockGnomeKeyring() { static bool LoadMockGnomeKeyring() {
if (!LoadGnomeKeyring())
return false;
#define GNOME_KEYRING_ASSIGN_POINTER(name) \ #define GNOME_KEYRING_ASSIGN_POINTER(name) \
gnome_keyring_##name = &mock_gnome_keyring_##name; gnome_keyring_##name = &mock_gnome_keyring_##name;
GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER) GNOME_KEYRING_FOR_EACH_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER)
#undef GNOME_KEYRING_ASSIGN_POINTER #undef GNOME_KEYRING_ASSIGN_POINTER
#define GNOME_KEYRING_ASSIGN_POINTER(name) \
gnome_keyring_##name = &::gnome_keyring_##name;
GNOME_KEYRING_FOR_EACH_NON_MOCKED_FUNC(GNOME_KEYRING_ASSIGN_POINTER)
#undef GNOME_KEYRING_ASSIGN_POINTER
keyring_loaded = true; keyring_loaded = true;
// Reset the state of the mock library. // Reset the state of the mock library.
mock_keyring_items.clear(); mock_keyring_items.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment