| Index: chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader.h
|
| ===================================================================
|
| --- chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader.h (revision 0)
|
| +++ chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader.h (revision 0)
|
| @@ -0,0 +1,57 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_PASSWORD_MANAGER_KEYRING_PROXY_GNOME_KEYRING_LOADER_H_
|
| +#define CHROME_BROWSER_PASSWORD_MANAGER_KEYRING_PROXY_GNOME_KEYRING_LOADER_H_
|
| +#pragma once
|
| +
|
| +#include <gnome-keyring.h>
|
| +
|
| +#include <string>
|
| +
|
| +namespace keyring_proxy {
|
| +
|
| +// Many of the gnome_keyring_* functions use variable arguments, which makes
|
| +// them difficult if not impossible to truly wrap in C/C++. Therefore, we use
|
| +// appropriately-typed function pointers and scoping to make the fact that we
|
| +// might be dynamically loading the library almost invisible. Classes that
|
| +// inherit from GnomeKeyringLoader will use its versions of the gnome_keyring_*
|
| +// functions. Note that it has only static fields.
|
| +class GnomeKeyringLoader {
|
| + protected:
|
| + static bool LoadGnomeKeyring();
|
| +
|
| +// Call a given parameter with the name of each function we use from GNOME
|
| +// Keyring. Make sure to adjust the unit test if you change these.
|
| +#define GNOME_KEYRING_FOR_EACH_FUNC(F) \
|
| + F(is_available) \
|
| + F(store_password) \
|
| + F(delete_password) \
|
| + F(find_itemsv) \
|
| + F(result_to_message)
|
| +
|
| +// Declare the actual function pointers that we'll use in client code.
|
| +#define GNOME_KEYRING_DECLARE_POINTER(name) \
|
| + static typeof(&::gnome_keyring_##name) gnome_keyring_##name;
|
| + GNOME_KEYRING_FOR_EACH_FUNC(GNOME_KEYRING_DECLARE_POINTER)
|
| +#undef GNOME_KEYRING_DECLARE_POINTER
|
| +
|
| + // Set to true if LoadGnomeKeyring() has already succeeded.
|
| + static bool keyring_loaded;
|
| +
|
| + private:
|
| +#if defined(DLOPEN_GNOME_KEYRING)
|
| + struct FunctionInfo {
|
| + const char* name;
|
| + void** pointer;
|
| + };
|
| +
|
| + // Make it easy to initialize the function pointers in LoadGnomeKeyring().
|
| + static const FunctionInfo functions[];
|
| +#endif // defined(DLOPEN_GNOME_KEYRING)
|
| +};
|
| +
|
| +} // namespace keyring_proxy
|
| +
|
| +#endif // CHROME_BROWSER_PASSWORD_MANAGER_KEYRING_PROXY_GNOME_KEYRING_LOADER_H_
|
|
|
| Property changes on: chrome/browser/password_manager/keyring_proxy/gnome_keyring_loader.h
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|