summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dbus/bus.h5
-rw-r--r--dbus/dbus.gyp6
-rw-r--r--dbus/dbus_export.h38
-rw-r--r--dbus/exported_object.h4
-rw-r--r--dbus/file_descriptor.h5
-rw-r--r--dbus/message.h17
-rw-r--r--dbus/object_path.h5
-rw-r--r--dbus/object_proxy.h4
-rw-r--r--dbus/property.h5
-rw-r--r--dbus/string_util.h4
-rw-r--r--dbus/values_util.h12
11 files changed, 83 insertions, 22 deletions
diff --git a/dbus/bus.h b/dbus/bus.h
index 6f31b37..75de9a3 100644
--- a/dbus/bus.h
+++ b/dbus/bus.h
@@ -16,6 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "base/tracked_objects.h"
+#include "dbus/dbus_export.h"
#include "dbus/object_path.h"
class MessageLoop;
@@ -130,7 +131,7 @@ class ObjectProxy;
// alive when callbacks referencing |this| are called. However, after the
// bus is shut down, |connection_| can be NULL. Hence, callbacks should
// not rely on that |connection_| is alive.
-class Bus : public base::RefCountedThreadSafe<Bus> {
+class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
public:
// Specifies the bus type. SESSION is used to communicate with per-user
// services like GNOME applications. SYSTEM is used to communicate with
@@ -157,7 +158,7 @@ class Bus : public base::RefCountedThreadSafe<Bus> {
};
// Options used to create a Bus object.
- struct Options {
+ struct CHROME_DBUS_EXPORT Options {
Options();
~Options();
diff --git a/dbus/dbus.gyp b/dbus/dbus.gyp
index 25317de..be5f686 100644
--- a/dbus/dbus.gyp
+++ b/dbus/dbus.gyp
@@ -9,7 +9,7 @@
'targets': [
{
'target_name': 'dbus',
- 'type': 'static_library',
+ 'type': '<(component)',
'dependencies': [
'../base/base.gyp:base',
'../build/linux/system.gyp:dbus',
@@ -18,9 +18,13 @@
'export_dependent_settings': [
'../base/base.gyp:base',
],
+ 'defines': [
+ 'DBUS_IMPLEMENTATION',
+ ],
'sources': [
'bus.cc',
'bus.h',
+ 'dbus_export.h',
'exported_object.cc',
'exported_object.h',
'file_descriptor.cc',
diff --git a/dbus/dbus_export.h b/dbus/dbus_export.h
new file mode 100644
index 0000000..0eda41a
--- /dev/null
+++ b/dbus/dbus_export.h
@@ -0,0 +1,38 @@
+// Copyright 2012 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 DBUS_DBUS_EXPORT_H_
+#define DBUS_DBUS_EXPORT_H_
+
+// Defines CHROME_DBUS_EXPORT so that functionality implemented by the dbus
+// library can be exported to consumers.
+// NOTE: We haven't used DBUS_EXPORT because it would conflict with the version
+// from /usr/include/dbus-1.0/dbus/dbus-macros.h.
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(DBUS_IMPLEMENTATION)
+#define CHROME_DBUS_EXPORT __declspec(dllexport)
+#else
+#define CHROME_DBUS_EXPORT __declspec(dllimport)
+#endif // defined(DBUS_IMPLEMENTATION)
+
+#else // !defined(WIN32)
+
+#if defined(DBUS_IMPLEMENTATION)
+#define CHROME_DBUS_EXPORT __attribute__((visibility("default")))
+#else
+#define CHROME_DBUS_EXPORT
+#endif
+
+#endif // defined(WIN32)
+
+#else // !defined(COMPONENT_BUILD)
+
+#define CHROME_DBUS_EXPORT
+
+#endif // defined(COMPONENT_BUILD)
+
+#endif // DBUS_DBUS_EXPORT_H_
diff --git a/dbus/exported_object.h b/dbus/exported_object.h
index c897ea6..9d3164f 100644
--- a/dbus/exported_object.h
+++ b/dbus/exported_object.h
@@ -16,6 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "base/time.h"
+#include "dbus/dbus_export.h"
#include "dbus/object_path.h"
namespace dbus {
@@ -30,7 +31,8 @@ class Signal;
//
// ExportedObject is a ref counted object, to ensure that |this| of the
// object is alive when callbacks referencing |this| are called.
-class ExportedObject : public base::RefCountedThreadSafe<ExportedObject> {
+class CHROME_DBUS_EXPORT ExportedObject
+ : public base::RefCountedThreadSafe<ExportedObject> {
public:
// Client code should use Bus::GetExportedObject() instead of this
// constructor.
diff --git a/dbus/file_descriptor.h b/dbus/file_descriptor.h
index 5b89f2f..19e0b1a 100644
--- a/dbus/file_descriptor.h
+++ b/dbus/file_descriptor.h
@@ -5,6 +5,9 @@
#ifndef DBUS_FILE_DESCRIPTOR_H_
#define DBUS_FILE_DESCRIPTOR_H_
+#include "base/basictypes.h"
+#include "dbus/dbus_export.h"
+
namespace dbus {
// FileDescriptor is a type used to encapsulate D-Bus file descriptors
@@ -28,7 +31,7 @@ namespace dbus {
// directory to reduce the security risks. Splitting out validation
// also allows the caller to do this work on the File thread to conform
// with i/o restrictions.
-class FileDescriptor {
+class CHROME_DBUS_EXPORT FileDescriptor {
public:
// Permits initialization without a value for passing to
// dbus::MessageReader::PopFileDescriptor to fill in and from int values.
diff --git a/dbus/message.h b/dbus/message.h
index 85d045c..42d6860 100644
--- a/dbus/message.h
+++ b/dbus/message.h
@@ -10,6 +10,7 @@
#include <dbus/dbus.h>
#include "base/basictypes.h"
+#include "dbus/dbus_export.h"
#include "dbus/file_descriptor.h"
#include "dbus/object_path.h"
@@ -35,7 +36,7 @@ class MessageReader;
// Returns true if Unix FD passing is supported in libdbus.
// The check is done runtime rather than compile time as the libdbus
// version used at runtime may be different from the one used at compile time.
-bool IsDBusTypeUnixFdSupported();
+CHROME_DBUS_EXPORT bool IsDBusTypeUnixFdSupported();
// Message is the base class of D-Bus message types. Client code must use
// sub classes such as MethodCall and Response instead.
@@ -44,7 +45,7 @@ bool IsDBusTypeUnixFdSupported();
// as the class is inside 'dbus' namespace. We chose to name this way, as
// libdbus defines lots of types starting with DBus, such as
// DBusMessage. We should avoid confusion and conflict with these types.
-class Message {
+class CHROME_DBUS_EXPORT Message {
public:
// The message type used in D-Bus. Redefined here so client code
// doesn't need to use raw D-Bus macros. DBUS_MESSAGE_TYPE_INVALID
@@ -137,7 +138,7 @@ class Message {
};
// MessageCall is a type of message used for calling a method via D-Bus.
-class MethodCall : public Message {
+class CHROME_DBUS_EXPORT MethodCall : public Message {
public:
// Creates a method call message for the specified interface name and
// the method name.
@@ -166,7 +167,7 @@ class MethodCall : public Message {
};
// Signal is a type of message used to send a signal.
-class Signal : public Message {
+class CHROME_DBUS_EXPORT Signal : public Message {
public:
// Creates a signal message for the specified interface name and the
// method name.
@@ -196,7 +197,7 @@ class Signal : public Message {
// Response is a type of message used for receiving a response from a
// method via D-Bus.
-class Response : public Message {
+class CHROME_DBUS_EXPORT Response : public Message {
public:
// Returns a newly created Response from the given raw message of the
// type DBUS_MESSAGE_TYPE_METHOD_RETURN. The caller must delete the
@@ -222,7 +223,7 @@ class Response : public Message {
// ErrorResponse is a type of message used to return an error to the
// caller of a method.
-class ErrorResponse: public Response {
+class CHROME_DBUS_EXPORT ErrorResponse: public Response {
public:
// Returns a newly created Response from the given raw message of the
// type DBUS_MESSAGE_TYPE_METHOD_RETURN. The caller must delete the
@@ -261,7 +262,7 @@ class ErrorResponse: public Response {
//
// writer.AppendString(str);
//
-class MessageWriter {
+class CHROME_DBUS_EXPORT MessageWriter {
public:
// Data added with Append* will be written to |message|, which may be NULL
// to create a sub-writer for passing to OpenArray, etc.
@@ -362,7 +363,7 @@ class MessageWriter {
//
// MessageReader manages an internal iterator to read data. All functions
// starting with Pop advance the iterator on success.
-class MessageReader {
+class CHROME_DBUS_EXPORT MessageReader {
public:
// The data will be read from the given |message|, which may be NULL to
// create a sub-reader for passing to PopArray, etc.
diff --git a/dbus/object_path.h b/dbus/object_path.h
index 9789b93..89c5287 100644
--- a/dbus/object_path.h
+++ b/dbus/object_path.h
@@ -7,13 +7,15 @@
#include <string>
+#include "dbus/dbus_export.h"
+
namespace dbus {
// ObjectPath is a type used to distinguish D-Bus object paths from simple
// strings, especially since normal practice is that these should be only
// initialized from static constants or obtained from remote objects and no
// assumptions about their value made.
-class ObjectPath {
+class CHROME_DBUS_EXPORT ObjectPath {
public:
// Permit initialization without a value for passing to
// dbus::MessageReader::PopObjectPath to fill in and from std::string
@@ -39,6 +41,7 @@ class ObjectPath {
// observers.
bool operator==(const ObjectPath&) const;
bool operator!=(const ObjectPath&) const;
+
private:
std::string value_;
};
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index 71ec0f1..bec0894 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/string_piece.h"
#include "base/time.h"
+#include "dbus/dbus_export.h"
#include "dbus/object_path.h"
namespace dbus {
@@ -32,7 +33,8 @@ class Signal;
// object is is alive when callbacks referencing |this| are called; the
// bus always holds at least one of those references so object proxies
// always last as long as the bus that created them.
-class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
+class CHROME_DBUS_EXPORT ObjectProxy
+ : public base::RefCountedThreadSafe<ObjectProxy> {
public:
// Client code should use Bus::GetObjectProxy() or
// Bus::GetObjectProxyWithOptions() instead of this constructor.
diff --git a/dbus/property.h b/dbus/property.h
index 87c9806..f2feb05 100644
--- a/dbus/property.h
+++ b/dbus/property.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
+#include "dbus/dbus_export.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
@@ -194,7 +195,7 @@ class PropertyBase {
//
// After creation, client code should call ConnectSignals() and most likely
// GetAll() to seed initial values and update as changes occur.
-class PropertySet {
+class CHROME_DBUS_EXPORT PropertySet {
public:
// Callback for changes to cached values of properties, either notified
// via signal, or as a result of calls to Get() and GetAll(). The |name|
@@ -349,7 +350,7 @@ class PropertySet {
// default value. Specializations for basic D-Bus types, strings, object
// paths and arrays are provided for you.
template <class T>
-class Property : public PropertyBase {
+class CHROME_DBUS_EXPORT Property : public PropertyBase {
public:
Property() {}
diff --git a/dbus/string_util.h b/dbus/string_util.h
index ff52290..60c02d1 100644
--- a/dbus/string_util.h
+++ b/dbus/string_util.h
@@ -7,10 +7,12 @@
#include <string>
+#include "dbus/dbus_export.h"
+
namespace dbus {
// Returns true if the specified string is a valid object path.
-bool IsValidObjectPath(const std::string& value);
+CHROME_DBUS_EXPORT bool IsValidObjectPath(const std::string& value);
} // namespace dbus
diff --git a/dbus/values_util.h b/dbus/values_util.h
index f710fa3..e34c7a0 100644
--- a/dbus/values_util.h
+++ b/dbus/values_util.h
@@ -5,6 +5,8 @@
#ifndef DBUS_VALUES_UTIL_H_
#define DBUS_VALUES_UTIL_H_
+#include "dbus/dbus_export.h"
+
namespace base {
class Value;
}
@@ -18,14 +20,16 @@ class MessageWriter;
// Returns NULL if an error occurs.
// Note: Integer values larger than int32 (including uint32) are converted to
// double. Non-string diciontary keys are converted to strings.
-base::Value* PopDataAsValue(MessageReader* reader);
+CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader);
// Appends a basic type value to |writer|.
-void AppendBasicTypeValueData(MessageWriter* writer, const base::Value& value);
+CHROME_DBUS_EXPORT void AppendBasicTypeValueData(MessageWriter* writer,
+ const base::Value& value);
// Appends a basic type value to |writer| as a variant.
-void AppendBasicTypeValueDataAsVariant(MessageWriter* writer,
- const base::Value& value);
+CHROME_DBUS_EXPORT void AppendBasicTypeValueDataAsVariant(
+ MessageWriter* writer,
+ const base::Value& value);
} // namespace dbus