summaryrefslogtreecommitdiff
path: root/chromium/third_party/cros_dbus_cplusplus
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
committerZeno Albisser <zeno.albisser@digia.com>2013-08-15 21:46:11 +0200
commit679147eead574d186ebf3069647b4c23e8ccace6 (patch)
treefc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/third_party/cros_dbus_cplusplus
downloadqtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz
Initial import.
Diffstat (limited to 'chromium/third_party/cros_dbus_cplusplus')
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/OWNERS2
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/README.chromium9
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/cros_dbus_cplusplus.gyp66
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/AUTHORS2
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/COPYING504
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/ChangeLog0
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/INSTALL237
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/Makefile.am22
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/NEWS0
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/OWNERS4
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/README7
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/README.chromiumos2
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/SConscript85
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/TODO8
-rwxr-xr-xchromium/third_party/cros_dbus_cplusplus/source/autogen.sh3
-rwxr-xr-xchromium/third_party/cros_dbus_cplusplus/source/bootstrap75
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/config/acx_pthread.m4275
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/configure.ac211
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/data/Makefile.am4
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/data/org.freedesktop.DBus.xml90
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1-uninstalled.pc.in13
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1.pc.in11
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/dbus-c++.anjuta44
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/doc/Doxyfile.in291
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/doc/Makefile.am15
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/doc/html/Makefile.am4
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/.deps/server.Po1
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/Makefile.am5
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/Makefile.am36
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.cpp122
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.h26
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-introspect.xml27
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.cpp79
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.h25
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/Makefile.am49
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/README23
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client-mt.cpp91
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.cpp49
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.h19
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-introspect.xml30
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.cpp96
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.h29
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.cpp162
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.h31
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/Makefile.am30
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.cpp71
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.h31
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/glib/Makefile.am29
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.cpp139
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.h62
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/hal/Makefile.am9
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.cpp129
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.h44
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/Makefile.am33
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.cpp72
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.h22
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-introspect.xml14
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.cpp56
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.h21
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/api.h38
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/connection.h476
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dbus.h45
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/debug.h38
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dispatcher.h316
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/ecore-integration.h114
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/error.h284
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop-integration.h112
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop.h170
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/glib-integration.h123
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/interface.h231
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/introspection.h86
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/message.h331
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/object.h260
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/pendingcall.h149
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/property.h103
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/refptr_impl.h46
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/server.h74
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/types.h526
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/util.h273
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/inherit-review-settings-ok0
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/libdbus-c++.spec.in63
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/Makefile.am49
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/connection.cpp465
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/connection_p.h76
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/debug.cpp56
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher.cpp279
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher_p.h57
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/ecore-integration.cpp213
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/error.cpp88
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/eventloop-integration.cpp178
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/eventloop.cpp256
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/glib-integration.cpp314
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/interface.cpp207
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/internalerror.h77
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/introspection.cpp193
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/message.cpp705
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/message_p.h57
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/object.cpp492
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall.cpp144
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall_p.h54
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/property.cpp192
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/server.cpp129
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/server_p.h57
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/src/types.cpp105
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/Makefile.am32
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/adaptor-stubs.tpl148
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/ef-adaptor-stubs.tpl186
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.cpp355
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.h40
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.cpp196
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.h39
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.cpp79
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.h44
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/proxy-stubs.tpl232
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/xml.cpp315
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/xml.h142
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.cpp185
-rw-r--r--chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.h37
118 files changed, 13977 insertions, 0 deletions
diff --git a/chromium/third_party/cros_dbus_cplusplus/OWNERS b/chromium/third_party/cros_dbus_cplusplus/OWNERS
new file mode 100644
index 00000000000..146b5e4db4b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/OWNERS
@@ -0,0 +1,2 @@
+thestig@chromium.org
+satorux@chromium.org
diff --git a/chromium/third_party/cros_dbus_cplusplus/README.chromium b/chromium/third_party/cros_dbus_cplusplus/README.chromium
new file mode 100644
index 00000000000..0f3efb2f396
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/README.chromium
@@ -0,0 +1,9 @@
+Name: dbus-cplusplus
+URL: http://dbus-cplusplus.sourceforge.net/
+Version: Unknown
+License: LGPL 2.1
+License File: source/COPYING
+Security Critical: yes
+
+Description:
+ChromiumOS's fork of dbus-c++. See git log for list of modifications.
diff --git a/chromium/third_party/cros_dbus_cplusplus/cros_dbus_cplusplus.gyp b/chromium/third_party/cros_dbus_cplusplus/cros_dbus_cplusplus.gyp
new file mode 100644
index 00000000000..c9c54194de7
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/cros_dbus_cplusplus.gyp
@@ -0,0 +1,66 @@
+# Copyright (c) 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.
+
+# This is used to build parts of dbus-c++ in Chromium on Linux.
+# TODO(thestig) Add support for system dbus-c++ in the future if it becomes
+# compatible with the CrOS fork.
+{
+ 'targets': [
+ {
+ 'target_name': 'dbus_cplusplus',
+ 'type': 'shared_library',
+ 'dependencies': [
+ '../../build/linux/system.gyp:dbus',
+ '../../build/linux/system.gyp:glib',
+ ],
+ 'sources': [
+ 'source/src/connection.cpp',
+ 'source/src/connection_p.h',
+ 'source/src/debug.cpp',
+ 'source/src/dispatcher.cpp',
+ 'source/src/dispatcher_p.h',
+ 'source/src/error.cpp',
+ 'source/src/eventloop-integration.cpp',
+ 'source/src/eventloop.cpp',
+ 'source/src/glib-integration.cpp',
+ 'source/src/interface.cpp',
+ 'source/src/internalerror.h',
+ 'source/src/introspection.cpp',
+ 'source/src/message.cpp',
+ 'source/src/message_p.h',
+ 'source/src/object.cpp',
+ 'source/src/pendingcall.cpp',
+ 'source/src/pendingcall_p.h',
+ 'source/src/property.cpp',
+ 'source/src/server.cpp',
+ 'source/src/server_p.h',
+ 'source/src/types.cpp',
+ ],
+ 'cflags!': [
+ '-fno-exceptions',
+ ],
+ 'defines': [
+ 'DBUS_HAS_RECURSIVE_MUTEX',
+ 'DBUS_HAS_THREADS_INIT_DEFAULT',
+ 'GCC_HASCLASSVISIBILITY',
+ ],
+ 'direct_dependent_settings': {
+ 'cflags!': [
+ '-fno-exceptions',
+ ],
+ 'defines': [
+ 'DBUS_HAS_RECURSIVE_MUTEX',
+ 'DBUS_HAS_THREADS_INIT_DEFAULT',
+ 'GCC_HASCLASSVISIBILITY',
+ ],
+ 'include_dirs': [
+ 'source/include',
+ ],
+ },
+ 'include_dirs': [
+ 'source/include',
+ ],
+ },
+ ],
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/AUTHORS b/chromium/third_party/cros_dbus_cplusplus/source/AUTHORS
new file mode 100644
index 00000000000..87435a48c67
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/AUTHORS
@@ -0,0 +1,2 @@
+Paolo Durante <shackan@gmail.com>
+Andreas Volz <andreas.volz@tux-style.com>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/COPYING b/chromium/third_party/cros_dbus_cplusplus/source/COPYING
new file mode 100644
index 00000000000..5ab7695ab8c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/COPYING
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/ChangeLog b/chromium/third_party/cros_dbus_cplusplus/source/ChangeLog
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/ChangeLog
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/INSTALL b/chromium/third_party/cros_dbus_cplusplus/source/INSTALL
new file mode 100644
index 00000000000..d3c5b40a940
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/INSTALL
@@ -0,0 +1,237 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/Makefile.am
new file mode 100644
index 00000000000..29bb7c9bb72
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/Makefile.am
@@ -0,0 +1,22 @@
+SUBDIRS = src tools data doc examples
+
+EXTRA_DIST = autogen.sh libdbus-c++.spec libdbus-c++.spec.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = dbus-c++-1.pc
+
+MAINTAINERCLEANFILES = \
+ configure \
+ Makefile.in \
+ aclocal.m4 \
+ compile \
+ config.guess \
+ config.sub \
+ depcomp \
+ install-sh \
+ ltmain.sh \
+ mdate-sh \
+ missing \
+ mkinstalldirs \
+ libdbus-c++.spec
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/NEWS b/chromium/third_party/cros_dbus_cplusplus/source/NEWS
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/NEWS
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/OWNERS b/chromium/third_party/cros_dbus_cplusplus/source/OWNERS
new file mode 100644
index 00000000000..a0993fd0cc2
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/OWNERS
@@ -0,0 +1,4 @@
+ellyjones@chromium.org
+ers@chromium.org
+petkov@chromium.org
+quiche@chromium.org
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/README b/chromium/third_party/cros_dbus_cplusplus/source/README
new file mode 100644
index 00000000000..6977af1436a
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/README
@@ -0,0 +1,7 @@
+Debugging
+---------
+To compile debugging code configure the project with the --enable-debug option. Then at runtime you may set the environment variable "DBUSXX_VERBOSE=1" to activate debugging and to '0' to deactivate debugging.
+
+
+BUGS:
+-----
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/README.chromiumos b/chromium/third_party/cros_dbus_cplusplus/source/README.chromiumos
new file mode 100644
index 00000000000..dbaf1e139e5
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/README.chromiumos
@@ -0,0 +1,2 @@
+This is the DBus-C++ project, modified to not require exceptions
+Upstream is not especially interested in these changes.
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/SConscript b/chromium/third_party/cros_dbus_cplusplus/source/SConscript
new file mode 100644
index 00000000000..d7b23589895
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/SConscript
@@ -0,0 +1,85 @@
+#
+# library
+#
+
+env = WengoGetEnvironment()
+
+env.ParseConfig('pkg-config --cflags --libs dbus-1')
+
+libs = [
+ 'expat'
+]
+lib_path = []
+include_path = [
+ 'include'
+]
+defines = {
+ 'DBUS_API_SUBJECT_TO_CHANGE':1,
+ 'DEBUG':1
+}
+headers = []
+sources = [
+ 'src/connection.cpp',
+ 'src/debug.cpp',
+ 'src/dispatcher.cpp',
+ 'src/error.cpp',
+ 'src/eventloop.cpp',
+ 'src/interface.cpp',
+ 'src/introspection.cpp',
+ 'src/property.cpp',
+ 'src/message.cpp',
+ 'src/object.cpp',
+ 'src/pendingcall.cpp',
+ 'src/server.cpp',
+ 'src/types.cpp',
+ 'src/xml.cpp'
+]
+
+env.WengoAddDefines(defines)
+env.WengoAddIncludePath(include_path)
+env.WengoUseLibraries(libs)
+env.WengoStaticLibrary('dbus-c++', sources)
+
+#
+# tools
+#
+
+tools_env = WengoGetEnvironment()
+
+tools_libs = [
+ 'dbus-c++'
+]
+tools_defines = {
+ 'DBUS_API_SUBJECT_TO_CHANGE':1,
+}
+introspect_sources = [
+ 'tools/introspect.cpp',
+]
+
+xml2cpp_sources = [
+ 'tools/xml2cpp.cpp'
+]
+
+#tools_env.Append(LINKFLAGS = '-z origin')
+#tools_env.Append(RPATH = env.Literal('\\$$ORIGIN\.'))
+
+tools_env.WengoAddDefines(tools_defines)
+tools_env.WengoAddIncludePath(include_path)
+tools_env.WengoUseLibraries(tools_libs)
+
+dbusxx_introspect = tools_env.WengoProgram('dbusxx-introspect', introspect_sources)
+dbusxx_xml2cpp = tools_env.WengoProgram('dbusxx-xml2cpp', xml2cpp_sources)
+
+#
+# xml translator
+#
+
+def dbusxx_xml2cpp_emitter(target, source, env):
+ env.Depends(target, dbusxx_xml2cpp)
+ return (target, source)
+
+dbusxx_xml2cpp_builder = Builder(action = dbusxx_xml2cpp[0].abspath + ' $SOURCE --adaptor=$TARGET',
+ emitter = dbusxx_xml2cpp_emitter,
+ suffix = '.h', src_suffix = '.xml')
+
+Export('dbusxx_xml2cpp_builder')
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/TODO b/chromium/third_party/cros_dbus_cplusplus/source/TODO
new file mode 100644
index 00000000000..f975a80a452
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/TODO
@@ -0,0 +1,8 @@
+* Implement asynchronous method calls (hint: start from DBus::PendingCall)
+* ...and patch the codegen to generate stubs for them
+* Implement continuations in a saner way
+* Find time for some hardcore valgrinding
+* Make DBus::Server free an incoming connection when it's disconnected, not when freeing the server
+* More examples
+* Inline (Doxygen-style) documentation
+* Native protocol implementation (as an alternative to libdbus)
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/autogen.sh b/chromium/third_party/cros_dbus_cplusplus/source/autogen.sh
new file mode 100755
index 00000000000..677a76a774a
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/autogen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+./bootstrap && ./configure $@
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/bootstrap b/chromium/third_party/cros_dbus_cplusplus/source/bootstrap
new file mode 100755
index 00000000000..292c9811ff5
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/bootstrap
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Run this to bootstrap the files
+
+PACKAGE=dbus-c++
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+# check if configure.ac is there
+(test -f $srcdir/configure.ac) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level package directory"
+ exit 1
+}
+
+# check for autoconf
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+# check for libtool
+(libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+# check for automake
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed."
+ echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+echo "Running libtoolize..."
+libtoolize --force --copy
+
+aclocalinclude="$ACLOCAL_FLAGS -I config"
+echo "Running aclocal $aclocalinclude ..."
+aclocal $aclocalinclude
+
+echo "Running autoheader..."
+autoheader
+
+echo "Running automake..."
+automake --add-missing --foreign $am_opt
+
+echo "Running autoconf ..."
+autoconf
+
+echo "You could now exec ./configure --help to see available options"
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/config/acx_pthread.m4 b/chromium/third_party/cros_dbus_cplusplus/source/config/acx_pthread.m4
new file mode 100644
index 00000000000..eb09f5acc3d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/config/acx_pthread.m4
@@ -0,0 +1,275 @@
+# ===========================================================================
+# http://autoconf-archive.cryp.to/acx_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+# This macro figures out how to build C programs using POSIX threads. It
+# sets the PTHREAD_LIBS output variable to the threads library and linker
+# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+# flags that are needed. (The user can also force certain compiler
+# flags/libs to be tested by setting these environment variables.)
+#
+# Also sets PTHREAD_CC to any special C compiler that is needed for
+# multi-threaded programs (defaults to the value of CC otherwise). (This
+# is necessary on AIX to use the special cc_r compiler alias.)
+#
+# NOTE: You are assumed to not only compile your program with these flags,
+# but also link it with them as well. e.g. you should link with
+# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+# If you are only building threads programs, you may wish to use these
+# variables in your default LIBS, CFLAGS, and CC:
+#
+# LIBS="$PTHREAD_LIBS $LIBS"
+# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+# CC="$PTHREAD_CC"
+#
+# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+# ACTION-IF-FOUND is a list of shell commands to run if a threads library
+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+# is not found. If ACTION-IF-FOUND is not specified, the default action
+# will define HAVE_PTHREAD.
+#
+# Please let the authors know if this macro fails on any platform, or if
+# you have any other suggestions or comments. This macro was based on work
+# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+# Alejandro Forero Cuervo to the autoconf macro repository. We are also
+# grateful for the helpful feedback of numerous users.
+#
+# LAST MODIFICATION
+#
+# 2008-04-12
+#
+# COPYLEFT
+#
+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Macro Archive. When you make and
+# distribute a modified version of the Autoconf Macro, you may extend this
+# special exception to the GPL to apply to your modified version as well.
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+ AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test x"$acx_pthread_ok" = xno; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+ *solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (We need to link with -pthreads/-mt/
+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+ # a function called by this macro, so we could check for that, but
+ # who knows whether they'll stub that too in a future libc.) So,
+ # we'll just look for -pthreads and -lpthread first:
+
+ acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
+ ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+ case $flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $flag])
+ PTHREAD_CFLAGS="$flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+ if test x"$acx_pthread_config" = xno; then continue; fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$flag])
+ PTHREAD_LIBS="-l$flag"
+ ;;
+ esac
+
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+ AC_TRY_LINK([#include <pthread.h>],
+ [pthread_t th; pthread_join(th, 0);
+ pthread_attr_init(0); pthread_cleanup_push(0, 0);
+ pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+ [acx_pthread_ok=yes])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ AC_MSG_RESULT($acx_pthread_ok)
+ if test "x$acx_pthread_ok" = xyes; then
+ break;
+ fi
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_MSG_CHECKING([for joinable pthread attribute])
+ attr_name=unknown
+ for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+ [attr_name=$attr; break])
+ done
+ AC_MSG_RESULT($attr_name)
+ if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ fi
+
+ AC_MSG_CHECKING([if more special flags are required for pthreads])
+ flag=no
+ case "${host_cpu}-${host_os}" in
+ *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+ *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ esac
+ AC_MSG_RESULT(${flag})
+ if test "x$flag" != xno; then
+ PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+ fi
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
+else
+ PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+ :
+else
+ acx_pthread_ok=no
+ $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/configure.ac b/chromium/third_party/cros_dbus_cplusplus/source/configure.ac
new file mode 100644
index 00000000000..54ed0b2c9ed
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/configure.ac
@@ -0,0 +1,211 @@
+# Autojunk script for libdbus-c++
+
+AC_PREREQ(2.59)
+AC_INIT([libdbus-c++], 0.5.0, [shackan@gmail.com])
+
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_CONFIG_HEADER([config.h])
+
+AC_CANONICAL_HOST
+
+AC_SUBST(PACKAGE_VERSION)
+
+
+# Set configuration options
+
+AC_ARG_ENABLE(debug,
+ AS_HELP_STRING([--enable-debug],
+ [enable debugging support]),
+ [enable_debug=$enableval],
+ [enable_debug=no]
+)
+
+AC_ARG_ENABLE(ecore,
+ AS_HELP_STRING([--enable-ecore],
+ [enable ecore integration]),
+ [enable_ecore=$enableval],
+ [enable_ecore=no]
+)
+
+AC_ARG_ENABLE(glib,
+ AS_HELP_STRING([--enable-glib],
+ [enable glib integration]),
+ [enable_glib=$enableval],
+ [enable_glib=no]
+)
+
+AC_ARG_ENABLE(doxygen-docs,
+ AS_HELP_STRING([--enable-doxygen-docs],
+ [build DOXYGEN documentation (requires Doxygen)]),
+ [enable_doxygen_docs=$enableval],
+ [enable_doxygen_docs=no]
+)
+
+# Check for programs
+
+AC_LANG_CPLUSPLUS
+
+AC_PROG_CC
+AC_PROG_CXX
+
+CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}}
+AC_SUBST(CXX_FOR_BUILD)
+
+AM_PROG_LIBTOOL
+
+PKG_PROG_PKG_CONFIG
+
+
+AC_MSG_CHECKING([whether $CXX supports symbol visibility])
+
+vtest=`$CXX --help --verbose 2>&1 | grep fvisibility`
+
+if test -n "$vtest"; then
+ AC_MSG_RESULT(yes)
+
+ AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
+ CXXFLAGS="-fvisibility=hidden"
+else
+ AC_MSG_RESULT(no)
+fi
+
+
+# Check for dependencies
+
+DBUS_REQUIRED_VERSION=0.60
+PKG_CHECK_MODULES(dbus, [dbus-1 >= $DBUS_REQUIRED_VERSION],,
+ AC_MSG_ERROR([You need the DBus libraries (version 0.6 or better)]
+ [http://www.freedesktop.org/wiki/Software_2fdbus])
+)
+AC_SUBST(dbus_CFLAGS)
+AC_SUBST(dbus_LIBS)
+
+DBUS_API_STABLE_VERSION=1.0.0
+PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION],
+ [AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])]
+)
+
+DBUS_THREADS_INIT_DEFAULT_VERSION=0.93
+PKG_CHECK_EXISTS([dbus-1 >= $DBUS_THREADS_INIT_DEFAULT_VERSION],
+ [AC_DEFINE(DBUS_HAS_THREADS_INIT_DEFAULT, , [dbus_threads_init_default (needs DBus >= 0.93)])]
+)
+
+DBUS_RECURSIVE_MUTEX_VERSION=0.95
+PKG_CHECK_EXISTS([dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION],
+ [AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])]
+)
+
+
+if test "$enable_glib" = "yes" ; then
+PKG_CHECK_MODULES([glib], glib-2.0)
+AC_SUBST(glib_CFLAGS)
+AC_SUBST(glib_LIBS)
+AM_CONDITIONAL(ENABLE_GLIB, test 1 = 1)
+PKG_CHECK_MODULES([gtkmm], gtkmm-2.4,
+ AM_CONDITIONAL(HAVE_GTKMM, test 1 = 1),
+ AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
+)
+AC_SUBST(gtkmm_CFLAGS)
+AC_SUBST(gtkmm_LIBS)
+else
+AM_CONDITIONAL(ENABLE_GLIB, test 0 = 1)
+AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
+fi
+
+if test "$enable_ecore" = "yes" ; then
+PKG_CHECK_MODULES([ecore], ecore)
+AC_SUBST(ecore_CFLAGS)
+AC_SUBST(ecore_LIBS)
+AM_CONDITIONAL(ENABLE_ECORE, test 1 = 1)
+else
+AM_CONDITIONAL(ENABLE_ECORE, test 0 = 1)
+fi
+
+AC_CHECK_LIB([expat], XML_ParserCreate_MM,
+ [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
+ have_expat=false)
+
+if ! $have_expat; then
+ AC_MSG_ERROR([You need the eXpat xml parser]
+ [http://expat.sourceforge.net/])
+fi
+
+xml_CFLAGS=
+xml_LIBS=-lexpat
+
+AC_SUBST(xml_CFLAGS)
+AC_SUBST(xml_LIBS)
+
+ACX_PTHREAD
+if test x"$acx_pthread_ok" = xyes; then
+ AC_DEFINE(HAVE_PTHREAD_H, 1, [Define to enable pthread support])
+ AM_CONDITIONAL(HAVE_PTHREAD, test x"$acx_pthread_ok" = xyes)
+fi
+
+if test "$enable_debug" = "yes" ; then
+ CXXFLAGS="$CXXFLAGS -Wall -ggdb -O0"
+ AC_DEFINE(DEBUG, 1, [Define to enable debug build])
+else
+ CXXFLAGS="$CXXFLAGS -Wall -O3"
+fi
+
+# Doxygen Documentation
+
+AC_PATH_PROG(DOXYGEN, doxygen, no)
+
+AC_MSG_CHECKING([whether to build Doxygen documentation])
+
+if test "$DOXYGEN" = "no" ; then
+ have_doxygen=no
+else
+ have_doxygen=yes
+fi
+
+if test "$enable_doxygen_docs" = "auto" ; then
+ enable_doxygen_docs=no
+
+ AC_MSG_RESULT(no)
+fi
+
+if test "$enable_doxygen_docs" = "yes" ; then
+ if test "$have_doxygen" = "no"; then
+ AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
+ fi
+
+ AC_MSG_RESULT(yes)
+fi
+
+AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
+
+# For the tools/, we need libdbus-c++ for the "build" architecture as well
+
+AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
+
+AC_ARG_WITH(build-libdbus-cxx,
+ AS_HELP_STRING([--with-build-libdbus-cxx],
+ [For cross compilation: path to libdbus-cxx which was compiled for the 'build' system.]),
+ [ BUILD_LIBDBUS_CXX_DIR=${withval} ],
+ [ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ]
+)
+AC_SUBST(BUILD_LIBDBUS_CXX_DIR)
+
+# Save processed files
+
+AC_OUTPUT(
+ Makefile
+ src/Makefile
+ tools/Makefile
+ data/Makefile
+ doc/Makefile
+ doc/Doxyfile
+ examples/Makefile
+ examples/properties/Makefile
+ examples/async/Makefile
+ examples/echo/Makefile
+ examples/ecore/Makefile
+ examples/hal/Makefile
+ examples/glib/Makefile
+ dbus-c++-1.pc
+ dbus-c++-1-uninstalled.pc
+ libdbus-c++.spec
+)
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/data/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/data/Makefile.am
new file mode 100644
index 00000000000..23df86ec8db
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/data/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST = org.freedesktop.DBus.xml
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/data/org.freedesktop.DBus.xml b/chromium/third_party/cros_dbus_cplusplus/source/data/org.freedesktop.DBus.xml
new file mode 100644
index 00000000000..cbb38abfff5
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/data/org.freedesktop.DBus.xml
@@ -0,0 +1,90 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.DBus.Introspectable">
+ <method name="Introspect">
+ <arg name="data" direction="out" type="s"/>
+ </method>
+ </interface>
+ <interface name="org.freedesktop.DBus.Properties">
+ <method name="Get">
+ <arg name="interface_name" direction="in" type="s"/>
+ <arg name="property_name" direction="in" type="s"/>
+ <arg name="value" direction="out" type="v"/>
+ </method>
+ <method name="Set">
+ <arg name="interface_name" direction="in" type="s"/>
+ <arg name="property_name" direction="in" type="s"/>
+ <arg name="value" direction="in" type="v"/>
+ </method>
+ <method name="GetAll">
+ <arg name="interface_name" direction="in" type="s"/>
+ <arg name="props" direction="out" type="a{sv}"/>
+ </method>
+ </interface>
+ <interface name="org.freedesktop.DBus">
+ <method name="RequestName">
+ <arg direction="in" type="s"/>
+ <arg direction="in" type="u"/>
+ <arg direction="out" type="u"/>
+ </method>
+ <method name="ReleaseName">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="u"/>
+ </method>
+ <method name="StartServiceByName">
+ <arg direction="in" type="s"/>
+ <arg direction="in" type="u"/>
+ <arg direction="out" type="u"/>
+ </method>
+ <method name="Hello">
+ <arg direction="out" type="s"/>
+ </method>
+ <method name="NameHasOwner">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="b"/>
+ </method>
+ <method name="ListNames">
+ <arg direction="out" type="as"/>
+ </method>
+ <method name="AddMatch">
+ <arg direction="in" type="s"/>
+ </method>
+ <method name="RemoveMatch">
+ <arg direction="in" type="s"/>
+ </method>
+ <method name="GetNameOwner">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="s"/>
+ </method>
+ <method name="ListQueuedOwners">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="as"/>
+ </method>
+ <method name="GetConnectionUnixUser">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="u"/>
+ </method>
+ <method name="GetConnectionUnixProcessID">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="u"/>
+ </method>
+ <method name="GetConnectionSELinuxSecurityContext">
+ <arg direction="in" type="s"/>
+ <arg direction="out" type="ay"/>
+ </method>
+ <method name="ReloadConfig">
+ </method>
+ <signal name="NameOwnerChanged">
+ <arg type="s"/>
+ <arg type="s"/>
+ <arg type="s"/>
+ </signal>
+ <signal name="NameLost">
+ <arg type="s"/>
+ </signal>
+ <signal name="NameAcquired">
+ <arg type="s"/>
+ </signal>
+ </interface>
+</node>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1-uninstalled.pc.in b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1-uninstalled.pc.in
new file mode 100644
index 00000000000..839fa86ab63
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1-uninstalled.pc.in
@@ -0,0 +1,13 @@
+prefix=
+exec_prefix=
+libdir=src
+includedir=include
+
+Name: @PACKAGE@
+Description: Native C++ bindings for D-Bus, Not Installed
+Version: @VERSION@
+Requires:
+Conflicts:
+Libs: ${pcfiledir}/${libdir}/libdbus-c++-1.la
+Cflags: -I${pcfiledir}/${includedir}
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1.pc.in b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1.pc.in
new file mode 100644
index 00000000000..bc5860a9559
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++-1.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: dbus-c++
+Description: Native C++ bindings for D-Bus.
+Requires: dbus-1
+Version: @VERSION@
+Libs: -L${libdir} -ldbus-c++-1
+Cflags: -I${includedir}/dbus-c++-1 -DDBUS_API_SUBJECT_TO_CHANGE
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++.anjuta b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++.anjuta
new file mode 100644
index 00000000000..51ddd65d385
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/dbus-c++.anjuta
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<anjuta>
+ <plugin name="GBF Project Manager"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaProjectManager"/>
+ <require group="Project"
+ attribute="Supported-Project-Types"
+ value="automake"/>
+ </plugin>
+ <plugin name="Symbol Browser"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaSymbolManager"/>
+ </plugin>
+ <plugin name="Make Build System"
+ url="http://anjuta.org/plugins/"
+ mandatory="yes">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaBuildable"/>
+ <require group="Build"
+ attribute="Supported-Build-Types"
+ value="make"/>
+ </plugin>
+ <plugin name="Task Manager"
+ url="http://anjuta.org/plugins/"
+ mandatory="no">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaTodo"/>
+ </plugin>
+ <plugin name="Debug Manager"
+ url="http://anjuta.org/plugins/"
+ mandatory="no">
+ <require group="Anjuta Plugin"
+ attribute="Interfaces"
+ value="IAnjutaDebuggerManager"/>
+ </plugin>
+</anjuta>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/doc/Doxyfile.in b/chromium/third_party/cros_dbus_cplusplus/source/doc/Doxyfile.in
new file mode 100644
index 00000000000..cdd193bfa6c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/doc/Doxyfile.in
@@ -0,0 +1,291 @@
+# Doxyfile 1.6.3
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = @PACKAGE@
+PROJECT_NUMBER = @VERSION@
+OUTPUT_DIRECTORY = @top_srcdir@/doc/
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 4
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+BUILTIN_STL_SUPPORT = YES
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+TYPEDEF_HIDES_STRUCT = NO
+SYMBOL_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = YES
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = NO
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = YES
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT =
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = @top_srcdir@/src/ \
+ @top_srcdir@/include/
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.cpp \
+ *.h
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS = Makefile.* \
+ ChangeLog \
+ CHANGES \
+ CHANGES.* \
+ README \
+ README.* \
+ *.png \
+ AUTHORS \
+ DESIGN \
+ DESIGN.* \
+ *.desktop \
+ DESKTOP* \
+ COMMENTS \
+ HOWTO \
+ magic \
+ NOTES \
+ TODO \
+ THANKS
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = YES
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT =
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_TIMESTAMP = YES
+HTML_ALIGN_MEMBERS = YES
+HTML_DYNAMIC_SECTIONS = NO
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+USE_INLINE_TREES = NO
+TREEVIEW_WIDTH = 250
+FORMULA_FONTSIZE = 10
+SEARCHENGINE = NO
+SERVER_BASED_SEARCH = NO
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT =
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT =
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = NO
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH =
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+DOT_FONTNAME = FreeSans
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/doc/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/doc/Makefile.am
new file mode 100644
index 00000000000..39fd9b9deb1
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/doc/Makefile.am
@@ -0,0 +1,15 @@
+if DBUS_DOXYGEN_DOCS_ENABLED
+
+EXTRA_DIST = Doxyfile.in
+
+noinst_PROGRAMS = index.html
+
+index_html_SOURCES = Doxyfile
+
+index.html: Doxyfile
+ doxygen Doxyfile
+
+endif
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/doc/html/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/doc/html/Makefile.am
new file mode 100644
index 00000000000..8eb67f86574
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/doc/html/Makefile.am
@@ -0,0 +1,4 @@
+CLEANFILES = *.html *.css *.png *.gif
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/.deps/server.Po b/chromium/third_party/cros_dbus_cplusplus/source/examples/.deps/server.Po
new file mode 100644
index 00000000000..9ce06a81ea4
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/.deps/server.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/Makefile.am
new file mode 100644
index 00000000000..a16c37d4a3b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = async properties echo hal glib ecore
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/Makefile.am
new file mode 100644
index 00000000000..d51945346eb
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/Makefile.am
@@ -0,0 +1,36 @@
+EXTRA_DIST = README async-introspect.xml
+
+if CROSS_COMPILING
+dbusxx_xml2cpp = dbusxx-xml2cpp
+else
+dbusxx_xml2cpp = $(top_builddir)/tools/dbusxx-xml2cpp
+DBUSXX_FLAGS = --templatedir=$(top_builddir)/tools
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(glib_CFLAGS)
+
+noinst_PROGRAMS = async-server
+
+async_server_SOURCES = async-server-glue.h async-server.h async-server.cpp
+async_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+async-server-glue.h: async-introspect.xml
+ $(dbusxx_xml2cpp) $^ --adaptor=$@ $(DBUSXX_FLAGS)
+
+noinst_PROGRAMS += async-client
+
+async_client_SOURCES = async-client-glue.h async-client.h async-client.cpp
+async_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@ $(glib_LIBS)
+async_client_CXXFLAGS = @PTHREAD_CFLAGS@
+
+async-client-glue.h: async-introspect.xml
+ $(dbusxx_xml2cpp) $^ --async --nosync --proxy=$@ $(DBUSXX_FLAGS)
+
+BUILT_SOURCES = async-server-glue.h async-client-glue.h
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.cpp
new file mode 100644
index 00000000000..74b8e6db67a
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.cpp
@@ -0,0 +1,122 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "async-client.h"
+#include <cstdio>
+#include <vector>
+#include <iostream>
+#include <pthread.h>
+#include <signal.h>
+
+using namespace std;
+
+static const char *ASYNC_SERVER_NAME = "org.freedesktop.DBus.Examples.Async";
+static const char *ASYNC_SERVER_PATH = "/org/freedesktop/DBus/Examples/Async";
+static AsyncClient *client;
+
+AsyncClient::AsyncClient(DBus::Connection &connection,
+ const char *path, const char *name)
+: DBus::ObjectProxy(connection, path, name)
+{
+}
+
+void AsyncClient::HelloCallback(const std::string& greeting,
+ const ::DBus::Error& e, void*)
+{
+ cout << "reply from Hello: " << greeting << endl;
+ cout << "Hello path=" << object()->path() << endl;
+ cout << "Hello service=" << object()->service() << endl;
+}
+
+void AsyncClient::SumCallback(const int32_t& sum, const ::DBus::Error& e, void*)
+{
+ cout << "reply from Sum: " << sum << endl;
+}
+
+void AsyncClient::SplitStringCallback(const std::string& string1,
+ const std::string& string2,
+ const ::DBus::Error& e, void* data)
+{
+ if (e.is_set())
+ cout << "error from SplitString: " << e.name()
+ << ": " << e.message() << endl;
+ else
+ cout << "reply from SplitString: \"" << string1 << "\" \""
+ << string2 << "\"" << endl;
+ cout << " data = " << data << endl;
+}
+
+DBus::BusDispatcher dispatcher;
+
+void AsyncClient::Timed_WaitCallback(const ::DBus::Error& e, void *data)
+{
+ cout << "reply from Timed_Wait" << endl;
+ dispatcher.leave();
+}
+
+void AsyncClient::Change_Sig(const std::string& newval)
+{
+ cout << "Change_Sig signal with newval=" << newval << endl;
+}
+
+void *do_method_calls(void *arg)
+{
+ AsyncClient *client = reinterpret_cast<AsyncClient *>(arg);
+
+ client->Hello("Obi-Wan", NULL);
+ cout << "Called Hello method" << endl;
+
+ int32_t nums[] = {3, 1, -5, 7, 23};
+
+ std::vector<int32_t> numvec(&nums[0], &nums[5]);
+
+ client->Sum(numvec, NULL);
+ cout << "Called Sum method" << endl;
+
+ string out1, out2;
+ // TODO(ers) using a timeout results in a deadlock if the timeout
+ // expires
+ client->SplitString("first part,second part", (void *)98/*, 1000*/);
+ cout << "Called SplitString method" << endl;
+
+ client->SplitString("", NULL);
+ cout << "Called SplitString method with empty string" << endl;
+
+ client->Timed_Wait(4, NULL);
+ cout << "Called Timed_Wait" << endl;
+
+ cout << "done " << endl;
+
+ return NULL;
+}
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::_init_threading();
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ client = new AsyncClient(conn, ASYNC_SERVER_PATH, ASYNC_SERVER_NAME);
+
+ pthread_t thread;
+ pthread_create(&thread, NULL, do_method_calls, client);
+
+ dispatcher.enter();
+
+ cout << "terminating" << endl;
+
+ delete client;
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.h
new file mode 100644
index 00000000000..b9b42f82f0f
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-client.h
@@ -0,0 +1,26 @@
+#ifndef __DEMO_ASYNC_CLIENT_H
+#define __DEMO_ASYNC_CLIENT_H
+
+#include <dbus-c++/dbus.h>
+#include "async-client-glue.h"
+
+class AsyncClient
+: public org::freedesktop::DBus::AsyncDemo_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ AsyncClient(DBus::Connection &connection, const char *path, const char *name);
+
+ void Echoed(const DBus::Variant &value);
+
+ virtual void HelloCallback(const std::string& greeting, const ::DBus::Error& e, void* data);
+ virtual void SumCallback(const int32_t& sum, const ::DBus::Error& e, void* data);
+ virtual void SplitStringCallback(const std::string& out_string1, const std::string& out_string2, const ::DBus::Error& e, void* data);
+ virtual void Timed_WaitCallback(const ::DBus::Error& e, void* data);
+
+ virtual void Change_Sig(const std::string& newval);
+};
+
+#endif//__DEMO_ASYNC_CLIENT_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-introspect.xml b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-introspect.xml
new file mode 100644
index 00000000000..6871e34811a
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-introspect.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<node name="/org/freedesktop/DBus/Examples/Async">
+ <interface name="org.freedesktop.DBus.AsyncDemo">
+ <method name="Hello">
+ <arg type="s" name="name" direction="in"/>
+ <arg type="s" name="greeting" direction="out"/>
+ </method>
+ <method name="Sum">
+ <arg type="ai" name="ints" direction="in"/>
+ <arg type="i" name="sum" direction="out"/>
+ </method>
+ <method name="SplitString">
+ <arg type="s" name="wi" direction="in"/>
+ <arg type="s" name="out-string1" direction="out"/>
+ <arg type="s" name="out-string2" direction="out"/>
+ </method>
+ <method name="Timed.Wait">
+ <arg type="i" name="seconds" direction="in"/>
+ </method>
+ <signal name="Change.Sig">
+ <arg name="newval" type="s"/>
+ </signal>
+ <property name="xprop" type="a{sv}" access="read"/>
+ <property name="yprop" type="a{sv}" access="write"/>
+ <property name="zprop" type="a{sv}" access="readwrite"/>
+ </interface>
+</node>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.cpp
new file mode 100644
index 00000000000..c120adb92a6
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.cpp
@@ -0,0 +1,79 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "async-server.h"
+#include "dbus-c++/error.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdio.h>
+#include <limits.h>
+
+static const char *ASYNC_SERVER_NAME = "org.freedesktop.DBus.Examples.Async";
+static const char *ASYNC_SERVER_PATH = "/org/freedesktop/DBus/Examples/Async";
+
+AsyncServer::AsyncServer(DBus::Connection &connection)
+: DBus::ObjectAdaptor(connection, ASYNC_SERVER_PATH)
+{
+}
+
+std::string AsyncServer::Hello(const std::string &name, DBus::Error &error)
+{
+ return "Hello " + name + "!";
+}
+
+int32_t AsyncServer::Sum(const std::vector<int32_t>& ints, DBus::Error &error)
+{
+ int32_t sum = 0;
+
+ for (size_t i = 0; i < ints.size(); ++i) sum += ints[i];
+
+ return sum;
+}
+
+void AsyncServer::SplitString(const std::string& input, std::string &string1, std::string &string2, DBus::Error &error)
+{
+ if (input.size() == 0) {
+ error.set("org.freedesktop.DBus.Error.InvalidArgs", "input string must not be empty");
+ return;
+ }
+ size_t cpos = input.find(',');
+ if (cpos == std::string::npos) {
+ string1 = input;
+ string2 = "";
+ } else {
+ string1 = input.substr(0, cpos);
+ string2 = input.substr(cpos+1);
+ }
+}
+
+void AsyncServer::Timed_Wait(const int32_t &seconds, DBus::Error &error)
+{
+ if (seconds)
+ sleep(seconds);
+}
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+ conn.request_name(ASYNC_SERVER_NAME);
+
+ AsyncServer server(conn);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.h
new file mode 100644
index 00000000000..21483ed2030
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/async/async-server.h
@@ -0,0 +1,25 @@
+#ifndef __DEMO_ASYNC_SERVER_H
+#define __DEMO_ASYNC_SERVER_H
+
+#include <dbus-c++/dbus.h>
+#include "async-server-glue.h"
+
+class AsyncServer
+: public org::freedesktop::DBus::AsyncDemo_adaptor,
+ public DBus::IntrospectableAdaptor,
+ public DBus::ObjectAdaptor
+{
+public:
+
+ AsyncServer(DBus::Connection &connection);
+
+ virtual std::string Hello(const std::string &name, DBus::Error &error);
+
+ virtual int32_t Sum(const std::vector<int32_t> & ints, DBus::Error &error);
+
+ virtual void SplitString(const std::string& input, std::string &string1, std::string &string2, DBus::Error &error);
+
+ virtual void Timed_Wait(const int32_t &seconds, DBus::Error &error);
+};
+
+#endif//__DEMO_ASYNC_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/Makefile.am
new file mode 100644
index 00000000000..02004d088d1
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/Makefile.am
@@ -0,0 +1,49 @@
+EXTRA_DIST = README echo-introspect.xml
+
+if CROSS_COMPILING
+dbusxx_xml2cpp = dbusxx-xml2cpp
+else
+dbusxx_xml2cpp = $(top_builddir)/tools/dbusxx-xml2cpp
+DBUSXX_FLAGS = --templatedir=$(top_builddir)/tools
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+
+noinst_PROGRAMS = echo-server
+
+echo_server_SOURCES = echo-server-glue.h echo-server.h echo-server.cpp
+echo_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+echo-server-glue.h: echo-introspect.xml
+ $(dbusxx_xml2cpp) $^ --adaptor=$@ $(DBUSXX_FLAGS)
+
+noinst_PROGRAMS += ef-echo-server
+
+ef_echo_server_SOURCES = ef-echo-server-glue.h ef-echo-server.h ef-echo-server.cpp
+ef_echo_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+ef-echo-server-glue.h: echo-introspect.xml
+ $(dbusxx_xml2cpp) $^ --adaptor=$@ --adaptor-template=ef-adaptor-stubs.tpl $(DBUSXX_FLAGS)
+
+noinst_PROGRAMS += echo-client
+
+echo_client_SOURCES = echo-client-glue.h echo-client.h echo-client.cpp
+echo_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+noinst_PROGRAMS += echo-client-mt
+
+echo_client_mt_SOURCES = echo-client-glue.h echo-client.h echo-client-mt.cpp
+echo_client_mt_LDADD = $(top_builddir)/src/libdbus-c++-1.la @PTHREAD_LIBS@
+echo_client_mt_CXXFLAGS = @PTHREAD_CFLAGS@
+
+echo-client-glue.h: echo-introspect.xml
+ $(dbusxx_xml2cpp) $^ --proxy=$@ $(DBUSXX_FLAGS)
+
+BUILT_SOURCES = echo-server-glue.h echo-client-glue.h ef-echo-server-glue.h
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/README b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/README
new file mode 100644
index 00000000000..74e1d6d16c5
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/README
@@ -0,0 +1,23 @@
+This is probably the most simple D-Bus program you could conceive
+
+To test, run `DBUSXX_VERBOSE=1 ./echo-server` and try the following commands:
+
+dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Random
+
+dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Hello string:"world"
+
+dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Sum array:int32:10,100,250
+
+dbus-send --dest=org.freedesktop.DBus.Examples.Echo --type=method_call --print-reply /org/freedesktop/DBus/Examples/Echo org.freedesktop.DBus.EchoDemo.Info
+
+or, using python instead
+
+$ python
+import dbus
+bus = dbus.SessionBus()
+object = bus.get_object('org.freedesktop.DBus.Examples.Echo','/org/freedesktop/DBus/Examples/Echo')
+echo = dbus.Interface(object, dbus_interface='org.freedesktop.DBus.EchoDemo')
+echo.Random()
+echo.Hello("world")
+echo.Sum([123, 234, 95, 520])
+echo.Info()
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client-mt.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client-mt.cpp
new file mode 100644
index 00000000000..fed6583cbad
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client-mt.cpp
@@ -0,0 +1,91 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "echo-client.h"
+#include <cstdio>
+#include <iostream>
+#include <pthread.h>
+#include <signal.h>
+
+using namespace std;
+
+static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+EchoClient::EchoClient(DBus::Connection &connection, const char *path, const char *name)
+: DBus::ObjectProxy(connection, path, name)
+{
+}
+
+void EchoClient::Echoed(const DBus::Variant &value)
+{
+ cout << "!";
+}
+
+/*
+ * For some strange reason, libdbus frequently dies with an OOM
+ */
+
+static const int THREADS = 3;
+
+static bool spin = true;
+
+void *greeter_thread(void *arg)
+{
+ DBus::Connection *conn = reinterpret_cast<DBus::Connection *>(arg);
+
+ EchoClient client(*conn, ECHO_SERVER_PATH, ECHO_SERVER_NAME);
+
+ char idstr[16];
+
+ snprintf(idstr, sizeof(idstr), "%lu", pthread_self());
+
+ for (int i = 0; i < 30 && spin; ++i)
+ {
+ cout << client.Hello(idstr) << endl;
+ }
+
+ cout << idstr << " done " << endl;
+
+ return NULL;
+}
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ spin = false;
+
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::_init_threading();
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ pthread_t threads[THREADS];
+
+ for (int i = 0; i < THREADS; ++i)
+ {
+ pthread_create(threads+i, NULL, greeter_thread, &conn);
+ }
+
+ dispatcher.enter();
+
+ cout << "terminating" << endl;
+
+ for (int i = 0; i < THREADS; ++i)
+ {
+ pthread_join(threads[i], NULL);
+ }
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.cpp
new file mode 100644
index 00000000000..501032c54cb
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.cpp
@@ -0,0 +1,49 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "echo-client.h"
+#include <cstdio>
+#include <iostream>
+#include <signal.h>
+
+using namespace std;
+
+static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+EchoClient::EchoClient(DBus::Connection &connection, const char *path, const char *name)
+: DBus::ObjectProxy(connection, path, name)
+{
+}
+
+void EchoClient::Echoed(const DBus::Variant &value)
+{
+ cout << "!";
+}
+
+DBus::BusDispatcher dispatcher;
+
+int main()
+{
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ EchoClient client(conn, ECHO_SERVER_PATH, ECHO_SERVER_NAME);
+
+ cout << client.Random() << endl;
+ cout << client.Hello("Hello") << endl;
+ try
+ {
+ client.Cat("foobar");
+ }
+ catch(DBus::Error &e)
+ {
+ cout << "Caught error: " << e.name() << endl
+ << "\t" << e.message() << endl;
+ }
+ client.Cat("/etc/hosts");
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.h
new file mode 100644
index 00000000000..54401eca415
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-client.h
@@ -0,0 +1,19 @@
+#ifndef __DEMO_ECHO_CLIENT_H
+#define __DEMO_ECHO_CLIENT_H
+
+#include <dbus-c++/dbus.h>
+#include "echo-client-glue.h"
+
+class EchoClient
+: public org::freedesktop::DBus::EchoDemo_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ EchoClient(DBus::Connection &connection, const char *path, const char *name);
+
+ void Echoed(const DBus::Variant &value);
+};
+
+#endif//__DEMO_ECHO_CLIENT_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-introspect.xml b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-introspect.xml
new file mode 100644
index 00000000000..7d415abdd4c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-introspect.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" ?>
+<node name="/org/freedesktop/DBus/Examples/Echo">
+ <interface name="org.freedesktop.DBus.EchoDemo">
+ <method name="Random">
+ <arg type="i" name="version" direction="out"/>
+ </method>
+ <method name="Hello">
+ <arg type="s" name="name" direction="in"/>
+ <arg type="s" name="greeting" direction="out"/>
+ </method>
+ <method name="Echo">
+ <arg type="v" name="input" direction="in"/>
+ <arg type="v" name="output" direction="out"/>
+ </method>
+ <method name="Cat">
+ <arg type="s" name="file" direction="in"/>
+ <arg type="ay" name="stream" direction="out"/>
+ </method>
+ <method name="Sum">
+ <arg type="ai" name="ints" direction="in"/>
+ <arg type="i" names="sum" direction="out"/>
+ </method>
+ <signal name="Echoed">
+ <arg type="v" name="value"/>
+ </signal>
+ <method name="Info">
+ <arg type="a{ss}" name="info" direction="out"/>
+ </method>
+ </interface>
+</node>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.cpp
new file mode 100644
index 00000000000..ff0a3b03e28
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.cpp
@@ -0,0 +1,96 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "echo-server.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdio.h>
+#include <limits.h>
+
+static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+EchoServer::EchoServer(DBus::Connection &connection)
+: DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH)
+{
+}
+
+int32_t EchoServer::Random(DBus::Error &error)
+{
+ return rand();
+}
+
+std::string EchoServer::Hello(const std::string &name, DBus::Error &error)
+{
+ return "Hello " + name + "!";
+}
+
+DBus::Variant EchoServer::Echo(const DBus::Variant &value, DBus::Error &error)
+{
+ this->Echoed(value);
+
+ return value;
+}
+
+std::vector< uint8_t > EchoServer::Cat(const std::string &file, DBus::Error &error)
+{
+ FILE *handle = fopen(file.c_str(), "rb");
+
+ if (!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found");
+
+ uint8_t buff[1024];
+
+ size_t nread = fread(buff, 1, sizeof(buff), handle);
+
+ fclose(handle);
+
+ return std::vector< uint8_t > (buff, buff + nread);
+}
+
+int32_t EchoServer::Sum(const std::vector<int32_t>& ints, DBus::Error &error)
+{
+ int32_t sum = 0;
+
+ for (size_t i = 0; i < ints.size(); ++i) sum += ints[i];
+
+ return sum;
+}
+
+std::map< std::string, std::string > EchoServer::Info(DBus::Error &error)
+{
+ std::map< std::string, std::string > info;
+ char hostname[HOST_NAME_MAX];
+
+ gethostname(hostname, sizeof(hostname));
+ info["hostname"] = hostname;
+ info["username"] = getlogin();
+
+ return info;
+}
+
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+ conn.request_name(ECHO_SERVER_NAME);
+
+ EchoServer server(conn);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.h
new file mode 100644
index 00000000000..9f4146a6059
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/echo-server.h
@@ -0,0 +1,29 @@
+#ifndef __DEMO_ECHO_SERVER_H
+#define __DEMO_ECHO_SERVER_H
+
+#include <dbus-c++/dbus.h>
+#include "echo-server-glue.h"
+
+class EchoServer
+: public org::freedesktop::DBus::EchoDemo_adaptor,
+ public DBus::IntrospectableAdaptor,
+ public DBus::ObjectAdaptor
+{
+public:
+
+ EchoServer(DBus::Connection &connection);
+
+ int32_t Random(DBus::Error &error);
+
+ std::string Hello(const std::string &name, DBus::Error &error);
+
+ DBus::Variant Echo(const DBus::Variant &value, DBus::Error &error);
+
+ std::vector< uint8_t > Cat(const std::string &file, DBus::Error &error);
+
+ int32_t Sum(const std::vector<int32_t> & ints, DBus::Error &error);
+
+ std::map< std::string, std::string > Info(DBus::Error &error);
+};
+
+#endif//__DEMO_ECHO_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.cpp
new file mode 100644
index 00000000000..19b96ca44d8
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.cpp
@@ -0,0 +1,162 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ef-echo-server.h"
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <stdio.h>
+#include <limits.h>
+
+static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
+static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
+
+DBus::BusDispatcher dispatcher;
+
+
+EchoServer::EchoServer(DBus::Connection &connection)
+: DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH, REGISTER_NOW, AVOID_EXCEPTIONS)
+{
+}
+
+DBus::Message EchoServer::Random(const DBus::CallMessage &call)
+{
+ // Make a new tag that can be used to track this call
+ DBus::Tag *tag = new DBus::Tag();
+
+ // Set up a timeout to cause something to happen later
+ // N.B. This example does not show how to delete the timeout
+ DBus::DefaultTimeout *timeout =
+ new DBus::DefaultTimeout(1000, false, &dispatcher);
+ timeout->data(tag);
+ DBus::Callback_Base<void, DBus::DefaultTimeout &> *cb =
+ new DBus::Callback<EchoServer, void, DBus::DefaultTimeout &>(
+ this, &EchoServer::RandomCallback);
+ timeout->expired = cb;
+
+ return DBus::TagMessage(tag);
+}
+
+void EchoServer::RandomCallback(DBus::DefaultTimeout &timeout)
+{
+ const DBus::Tag *tag = reinterpret_cast<DBus::Tag *>(timeout.data());
+
+ Continuation *ret = find_continuation(tag);
+ assert(ret);
+
+ RandomWriteReply(ret->writer(), rand());
+ return_now(ret);
+ timeout.data(NULL);
+ delete tag;
+ timeout.enabled(false);
+ // N.B. We cannot delete the timeout here, that would deadlock
+}
+
+DBus::Message EchoServer::Hello(const DBus::CallMessage &call, const std::string &name)
+{
+ return HelloMakeReply(call, "Hello " + name + "!");
+}
+
+DBus::Message EchoServer::Echo(const DBus::CallMessage &call, const DBus::Variant &value)
+{
+ this->Echoed(value);
+
+ return EchoMakeReply(call, value);
+}
+
+struct CatData {
+ CatData(FILE *h) : handle(h) {}
+ FILE *handle;
+ DBus::Tag tag;
+};
+
+DBus::Message EchoServer::Cat(const DBus::CallMessage &call, const std::string &file)
+{
+ FILE *handle = fopen(file.c_str(), "rb");
+
+ if (!handle) return DBus::ErrorMessage(call,
+ "org.freedesktop.DBus.EchoDemo.ErrorFileNotFound",
+ "file not found");
+
+ CatData *cat_data = new CatData(handle);
+ // Set up a timeout to cause something to happen later
+ // N.B. This example does not show how to delete the timeout
+ DBus::DefaultTimeout *timeout =
+ new DBus::DefaultTimeout(3000, false, &dispatcher);
+ timeout->data(cat_data);
+ DBus::Callback_Base<void, DBus::DefaultTimeout &> *cb =
+ new DBus::Callback<EchoServer, void, DBus::DefaultTimeout &>(
+ this, &EchoServer::CatCallback);
+ timeout->expired = cb;
+
+ return DBus::TagMessage(&cat_data->tag);
+}
+
+void EchoServer::CatCallback(DBus::DefaultTimeout &timeout)
+{
+ CatData *cat_data = reinterpret_cast<CatData *>(timeout.data());
+ Continuation *ret = find_continuation(&cat_data->tag);
+ assert(ret);
+
+ uint8_t buff[1024];
+ size_t nread = fread(buff, 1, sizeof(buff), cat_data->handle);
+ fclose(cat_data->handle);
+
+ if (nread >= 80) {
+ // Arbitrary size chosen to show how to return an
+ // error from a continuation.
+ return_error(ret, DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileTooBig",
+ "file too big"));
+ } else {
+ CatWriteReply(ret->writer(), std::vector< uint8_t > (buff, buff + nread));
+ return_now(ret);
+ }
+ delete cat_data;
+ timeout.enabled(false);
+ // N.B. We cannot delete the timeout here, that would deadlock
+}
+
+DBus::Message EchoServer::Sum(const DBus::CallMessage &call, const std::vector<int32_t>& ints)
+{
+ int32_t sum = 0;
+
+ for (size_t i = 0; i < ints.size(); ++i) sum += ints[i];
+
+ return SumMakeReply(call, sum);
+}
+
+DBus::Message EchoServer::Info(const DBus::CallMessage &call)
+{
+ std::map< std::string, std::string > info;
+ char hostname[HOST_NAME_MAX];
+
+ gethostname(hostname, sizeof(hostname));
+ info["hostname"] = hostname;
+ info["username"] = getlogin();
+
+ return InfoMakeReply(call, info);
+}
+
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+ conn.request_name(ECHO_SERVER_NAME);
+
+ EchoServer server(conn);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.h
new file mode 100644
index 00000000000..82995b30226
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/echo/ef-echo-server.h
@@ -0,0 +1,31 @@
+#ifndef __DEMO_ECHO_SERVER_H
+#define __DEMO_ECHO_SERVER_H
+
+#include <dbus-c++/dbus.h>
+#include "ef-echo-server-glue.h"
+
+class EchoServer
+: public org::freedesktop::DBus::EchoDemo_adaptor,
+ public DBus::IntrospectableAdaptor,
+ public DBus::ObjectAdaptor
+{
+public:
+
+ EchoServer(DBus::Connection &connection);
+
+ DBus::Message Random(const DBus::CallMessage &call);
+ void RandomCallback(DBus::DefaultTimeout &timeout);
+
+ DBus::Message Hello(const DBus::CallMessage &call, const std::string &name);
+
+ DBus::Message Echo(const DBus::CallMessage &call, const DBus::Variant &value);
+
+ DBus::Message Cat(const DBus::CallMessage &call, const std::string &file);
+ void CatCallback(DBus::DefaultTimeout &timeout);
+
+ DBus::Message Sum(const DBus::CallMessage &call, const std::vector<int32_t> & ints);
+
+ DBus::Message Info(const DBus::CallMessage &call);
+};
+
+#endif//__DEMO_ECHO_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/Makefile.am
new file mode 100644
index 00000000000..00d871b57e2
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/Makefile.am
@@ -0,0 +1,30 @@
+EXTRA_DIST =
+
+if CROSS_COMPILING
+dbusxx_xml2cpp = dbusxx-xml2cpp
+else
+dbusxx_xml2cpp = $(top_builddir)/tools/dbusxx-xml2cpp
+DBUSXX_FLAGS = --templatedir=$(top_builddir)/tools
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/include $(ecore_CFLAGS) $(xml_CFLAGS) -I$(top_srcdir)/tools
+
+if ENABLE_ECORE
+noinst_PROGRAMS = dbus_ecore
+endif
+
+dbus_ecore_SOURCES = dbus_ecore-glue.h dbus_ecore.h dbus_ecore.cpp $(top_srcdir)/tools/xml.cpp
+dbus_ecore_LDADD = $(top_builddir)/src/libdbus-c++-1.la $(ecore_LIBS) $(xml_LIBS)
+
+dbus_ecore-glue.h: $(top_srcdir)/data/org.freedesktop.DBus.xml
+ $(dbusxx_xml2cpp) $^ --proxy=$@ $(DBUSXX_FLAGS)
+
+BUILT_SOURCES = dbus_ecore-glue.h
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.cpp
new file mode 100644
index 00000000000..f0686dcff47
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.cpp
@@ -0,0 +1,71 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "dbus_ecore.h"
+
+#include <xml.h>
+#include <iostream>
+#include <vector>
+
+using namespace std;
+
+static const char* DBUS_SERVER_NAME = "org.freedesktop.DBus";
+static const char* DBUS_SERVER_PATH = "/org/freedesktop/DBus";
+
+typedef vector <string> Names;
+
+DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
+: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME)
+{
+ typedef std::vector< std::string > Names;
+
+ Names names = ListNames();
+
+ for(Names::iterator it = names.begin(); it != names.end(); ++it)
+ {
+ cout << *it << endl;
+ }
+}
+
+void DBusBrowser::NameOwnerChanged(
+ const std::string& name, const std::string& old_owner, const std::string& new_owner )
+{
+ cout << name << ": " << old_owner << " -> " << new_owner << endl;
+}
+
+void DBusBrowser::NameLost( const std::string& name )
+{
+ cout << name << " lost" << endl;
+}
+
+void DBusBrowser::NameAcquired( const std::string& name )
+{
+ cout << name << " acquired" << endl;
+}
+
+DBus::Ecore::BusDispatcher dispatcher;
+
+void niam( int sig )
+{
+ ecore_main_loop_quit();
+}
+
+int main(int argc, char* argv[])
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ ecore_init();
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ DBusBrowser browser(conn);
+
+ ecore_main_loop_begin();
+ ecore_shutdown();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.h
new file mode 100644
index 00000000000..d00d6ea0f67
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/ecore/dbus_ecore.h
@@ -0,0 +1,31 @@
+#ifndef __DEMO_DBUS_BROWSER_H
+#define __DEMO_DBUS_BROWSER_H
+
+#include <dbus-c++/dbus.h>
+#include <dbus-c++/ecore-integration.h>
+#include <Ecore.h>
+
+#include "dbus_ecore-glue.h"
+
+class DBusBrowser
+: public org::freedesktop::DBus_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ DBusBrowser( ::DBus::Connection& conn );
+
+private:
+
+ void NameOwnerChanged( const std::string&, const std::string&, const std::string& );
+
+ void NameLost( const std::string& );
+
+ void NameAcquired( const std::string& );
+
+private:
+
+};
+
+#endif//__DEMO_DBUS_BROWSER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/Makefile.am
new file mode 100644
index 00000000000..5d4fa746287
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/Makefile.am
@@ -0,0 +1,29 @@
+EXTRA_DIST =
+
+if CROSS_COMPILING
+dbusxx_xml2cpp = dbusxx-xml2cpp
+else
+dbusxx_xml2cpp = $(top_builddir)/tools/dbusxx-xml2cpp
+DBUSXX_FLAGS = --templatedir=$(top_builddir)/tools
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(gtkmm_CFLAGS) -I$(top_srcdir)/tools
+
+if HAVE_GTKMM
+noinst_PROGRAMS = dbus-browser
+endif
+
+dbus_browser_SOURCES = dbus-glue.h dbus-browser.h dbus-browser.cpp $(top_srcdir)/tools/xml.cpp
+dbus_browser_LDADD = $(top_builddir)/src/libdbus-c++-1.la $(gtkmm_LIBS)
+
+dbus-glue.h: $(top_srcdir)/data/org.freedesktop.DBus.xml
+ $(dbusxx_xml2cpp) $^ --proxy=$@ $(DBUSXX_FLAGS)
+
+BUILT_SOURCES = dbus-glue.h
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.cpp
new file mode 100644
index 00000000000..94a3936364d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.cpp
@@ -0,0 +1,139 @@
+#include "dbus-browser.h"
+
+#include <xml.h>
+#include <iostream>
+
+using namespace std;
+
+static const char *DBUS_SERVER_NAME = "org.freedesktop.DBus";
+static const char *DBUS_SERVER_PATH = "/org/freedesktop/DBus";
+
+DBusBrowser::DBusBrowser(::DBus::Connection &conn)
+: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME)
+{
+ set_title("D-Bus Browser");
+ set_border_width(5);
+ set_default_size(400, 500);
+
+ typedef std::vector< std::string > Names;
+
+ Names names = ListNames();
+
+ for (Names::iterator it = names.begin(); it != names.end(); ++it)
+ {
+ _cb_busnames.append_text(*it);
+ }
+
+ _cb_busnames.signal_changed().connect(sigc::mem_fun(*this, &DBusBrowser::on_select_busname));
+
+ _tm_inspect = Gtk::TreeStore::create(_records);
+ _tv_inspect.set_model(_tm_inspect);
+ _tv_inspect.append_column("Node", _records.name);
+
+ _sc_tree.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+ _sc_tree.add(_tv_inspect);
+
+ _vbox.pack_start(_cb_busnames, Gtk::PACK_SHRINK);
+ _vbox.pack_start(_sc_tree);
+
+ add(_vbox);
+
+ show_all_children();
+}
+
+void DBusBrowser::NameOwnerChanged(
+ const std::string &name, const std::string &old_owner, const std::string &new_owner)
+{
+ cout << name << ": " << old_owner << " -> " << new_owner << endl;
+}
+
+void DBusBrowser::NameLost(const std::string &name)
+{
+ cout << name << " lost" << endl;
+}
+
+void DBusBrowser::NameAcquired(const std::string &name)
+{
+ cout << name << " acquired" << endl;
+}
+
+void DBusBrowser::on_select_busname()
+{
+ Glib::ustring busname = _cb_busnames.get_active_text();
+ if (busname.empty()) return;
+
+ _tm_inspect->clear();
+ _inspect_append(NULL, "", busname);
+}
+
+void DBusBrowser::_inspect_append(Gtk::TreeModel::Row *row, const std::string &buspath, const std::string &busname)
+{
+ DBusInspector inspector(conn(), buspath.empty() ? "/" : buspath.c_str(), busname.c_str());
+
+ ::DBus::Xml::Document doc(inspector.Introspect());
+ ::DBus::Xml::Node &root = *(doc.root);
+
+ ::DBus::Xml::Nodes ifaces = root["interface"];
+
+ for (::DBus::Xml::Nodes::iterator ii = ifaces.begin(); ii != ifaces.end(); ++ii)
+ {
+ ::DBus::Xml::Node &iface = **ii;
+
+ Gtk::TreeModel::Row i_row = row
+ ? *(_tm_inspect->append(row->children()))
+ : *(_tm_inspect->append());
+ i_row[_records.name] = "interface: " + iface.get("name");
+
+ ::DBus::Xml::Nodes methods = iface["method"];
+
+ for (::DBus::Xml::Nodes::iterator im = methods.begin(); im != methods.end(); ++im)
+ {
+ Gtk::TreeModel::Row m_row = *(_tm_inspect->append(i_row.children()));
+ m_row[_records.name] = "method: " + (*im)->get("name");
+ }
+
+ ::DBus::Xml::Nodes signals = iface["signal"];
+
+ for (::DBus::Xml::Nodes::iterator is = signals.begin(); is != signals.end(); ++is)
+ {
+ Gtk::TreeModel::Row s_row = *(_tm_inspect->append(i_row.children()));
+ s_row[_records.name] = "signal: " + (*is)->get("name");
+ }
+ }
+
+ ::DBus::Xml::Nodes nodes = root["node"];
+
+ for (::DBus::Xml::Nodes::iterator in = nodes.begin(); in != nodes.end(); ++in)
+ {
+ std::string name = (*in)->get("name");
+
+ Gtk::TreeModel::Row n_row = row
+ ? *(_tm_inspect->append(row->children()))
+ : *(_tm_inspect->append());
+ n_row[_records.name] = name;
+
+ _inspect_append(&n_row, buspath + "/" + name, busname);
+ }
+}
+
+DBus::Glib::BusDispatcher dispatcher;
+
+int main(int argc, char *argv[])
+{
+ Gtk::Main kit(argc, argv);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ dispatcher.attach(NULL);
+
+ // activate one of both for either system or session bus
+ // TODO: choose in the GUI
+ DBus::Connection conn = DBus::Connection::SessionBus();
+ //DBus::Connection conn = DBus::Connection::SystemBus();
+
+ DBusBrowser browser(conn);
+
+ Gtk::Main::run(browser);
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.h
new file mode 100644
index 00000000000..9bbefbf084d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/glib/dbus-browser.h
@@ -0,0 +1,62 @@
+#ifndef __DEMO_DBUS_BROWSER_H
+#define __DEMO_DBUS_BROWSER_H
+
+#include <dbus-c++/dbus.h>
+#include <dbus-c++/glib-integration.h>
+#include <gtkmm.h>
+
+#include "dbus-glue.h"
+
+class DBusInspector
+: public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ DBusInspector(DBus::Connection &conn, const char *path, const char *service)
+ : DBus::ObjectProxy(conn, path, service)
+ {}
+};
+
+class DBusBrowser
+: public org::freedesktop::DBus_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy,
+ public Gtk::Window
+{
+public:
+
+ DBusBrowser(::DBus::Connection &);
+
+private:
+
+ void NameOwnerChanged(const std::string &, const std::string &, const std::string &);
+
+ void NameLost(const std::string &);
+
+ void NameAcquired(const std::string &);
+
+ void on_select_busname();
+
+ void _inspect_append(Gtk::TreeModel::Row *, const std::string &, const std::string &);
+
+private:
+
+ class InspectRecord : public Gtk::TreeModel::ColumnRecord
+ {
+ public:
+
+ InspectRecord() { add(name); }
+
+ Gtk::TreeModelColumn<Glib::ustring> name;
+ };
+
+ Gtk::VBox _vbox;
+ Gtk::ScrolledWindow _sc_tree;
+ Gtk::ComboBoxText _cb_busnames;
+ Gtk::TreeView _tv_inspect;
+ Glib::RefPtr<Gtk::TreeStore> _tm_inspect;
+ InspectRecord _records;
+};
+
+#endif//__DEMO_DBUS_BROWSER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/Makefile.am
new file mode 100644
index 00000000000..22868c80fa8
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/Makefile.am
@@ -0,0 +1,9 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+
+noinst_PROGRAMS = hal-listen
+
+hal_listen_SOURCES = hal-listen.h hal-listen.cpp
+hal_listen_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.cpp
new file mode 100644
index 00000000000..1939f8a1573
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.cpp
@@ -0,0 +1,129 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "hal-listen.h"
+
+#include <signal.h>
+#include <iostream>
+
+HalManagerProxy::HalManagerProxy(DBus::Connection &connection)
+: DBus::InterfaceProxy("org.freedesktop.Hal.Manager"),
+ DBus::ObjectProxy(connection, "/org/freedesktop/Hal/Manager", "org.freedesktop.Hal")
+{
+ connect_signal(HalManagerProxy, DeviceAdded, DeviceAddedCb);
+ connect_signal(HalManagerProxy, DeviceRemoved, DeviceRemovedCb);
+
+ std::vector< std::string > devices = GetAllDevices();
+
+ std::vector< std::string >::iterator it;
+ for (it = devices.begin(); it != devices.end(); ++it)
+ {
+ DBus::Path udi = *it;
+
+ std::cout << "found device " << udi << std::endl;
+
+ _devices[udi] = new HalDeviceProxy(connection, udi);
+ }
+}
+
+std::vector< std::string > HalManagerProxy::GetAllDevices()
+{
+ std::vector< std::string > udis;
+ DBus::CallMessage call;
+
+ call.member("GetAllDevices");
+
+ DBus::Message reply = invoke_method(call);
+ DBus::MessageIter it = reply.reader();
+
+ it >> udis;
+ return udis;
+}
+
+void HalManagerProxy::DeviceAddedCb(const DBus::SignalMessage &sig)
+{
+ DBus::MessageIter it = sig.reader();
+ std::string devname;
+
+ it >> devname;
+
+ DBus::Path udi(devname);
+
+ _devices[devname] = new HalDeviceProxy(conn(), udi);
+ std::cout << "added device " << udi << std::endl;
+}
+
+void HalManagerProxy::DeviceRemovedCb(const DBus::SignalMessage &sig)
+{
+ DBus::MessageIter it = sig.reader();
+ std::string devname;
+
+ it >> devname;
+
+ std::cout << "removed device " << devname << std::endl;
+
+ _devices.erase(devname);
+}
+
+HalDeviceProxy::HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi)
+: DBus::InterfaceProxy("org.freedesktop.Hal.Device"),
+ DBus::ObjectProxy(connection, udi, "org.freedesktop.Hal")
+{
+ connect_signal(HalDeviceProxy, PropertyModified, PropertyModifiedCb);
+ connect_signal(HalDeviceProxy, Condition, ConditionCb);
+}
+
+void HalDeviceProxy::PropertyModifiedCb(const DBus::SignalMessage &sig)
+{
+ typedef DBus::Struct< std::string, bool, bool > HalProperty;
+
+ DBus::MessageIter it = sig.reader();
+ int32_t number;
+
+ it >> number;
+
+ DBus::MessageIter arr = it.recurse();
+
+ for (int i = 0; i < number; ++i, ++arr)
+ {
+ HalProperty hp;
+
+ arr >> hp;
+
+ std::cout << "modified property " << hp._1 << " in " << path() << std::endl;
+ }
+}
+
+void HalDeviceProxy::ConditionCb(const DBus::SignalMessage &sig)
+{
+ DBus::MessageIter it = sig.reader();
+ std::string condition;
+
+ it >> condition;
+
+ std::cout << "encountered condition " << condition << " in " << path() << std::endl;
+}
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SystemBus();
+
+ HalManagerProxy hal(conn);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.h
new file mode 100644
index 00000000000..12862e617e9
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/hal/hal-listen.h
@@ -0,0 +1,44 @@
+#ifndef __DEMO_HAL_LISTEN_H
+#define __DEMO_HAL_LISTEN_H
+
+#include <dbus-c++/dbus.h>
+#include <vector>
+#include <map>
+
+class HalDeviceProxy;
+
+class HalManagerProxy
+: public DBus::InterfaceProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ HalManagerProxy(DBus::Connection &connection);
+
+ std::vector< std::string > GetAllDevices();
+
+private:
+
+ void DeviceAddedCb(const DBus::SignalMessage &sig);
+
+ void DeviceRemovedCb(const DBus::SignalMessage &sig);
+
+ std::map< std::string, DBus::RefPtr< HalDeviceProxy > > _devices;
+};
+
+class HalDeviceProxy
+: public DBus::InterfaceProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi);
+
+private:
+
+ void PropertyModifiedCb(const DBus::SignalMessage &sig);
+
+ void ConditionCb(const DBus::SignalMessage &sig);
+};
+
+#endif//__DEMO_HAL_LISTEN_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/Makefile.am
new file mode 100644
index 00000000000..444cac58113
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/Makefile.am
@@ -0,0 +1,33 @@
+EXTRA_DIST = propsgs-introspect.xml
+
+if CROSS_COMPILING
+dbusxx_xml2cpp = dbusxx-xml2cpp
+else
+dbusxx_xml2cpp = $(top_builddir)/tools/dbusxx-xml2cpp
+DBUSXX_FLAGS = --templatedir=$(top_builddir)/tools
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
+
+noinst_PROGRAMS = propsgs-server propsgs-client
+
+propsgs_server_SOURCES = propsgs-glue-adaptor.h propsgs-server.h propsgs-server.cpp
+propsgs_server_LDADD = $(top_builddir)/src/libdbus-c++-1.la
+
+propsgs_client_SOURCES = propsgs-glue-proxy.h propsgs-client.h propsgs-client.cpp
+propsgs_client_LDADD = $(top_builddir)/src/libdbus-c++-1.la -lpthread
+
+propsgs-glue-adaptor.h: propsgs-introspect.xml
+ $(dbusxx_xml2cpp) $^ --adaptor=$@ $(DBUSXX_FLAGS) --
+
+propsgs-glue-proxy.h: propsgs-introspect.xml
+ $(dbusxx_xml2cpp) $^ --proxy=$@ $(DBUSXX_FLAGS) --
+
+BUILT_SOURCES = propsgs-glue-adaptor.h propsgs-glue-proxy.h
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.cpp
new file mode 100644
index 00000000000..d4b51f4bd25
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.cpp
@@ -0,0 +1,72 @@
+#include "propsgs-client.h"
+#include <iostream>
+#include <signal.h>
+#include <pthread.h>
+
+using namespace org::freedesktop::DBus;
+
+static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
+static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
+
+PropsClient::PropsClient(DBus::Connection &connection, const char *path, const char *name)
+: DBus::ObjectProxy(connection, path, name)
+{
+}
+
+void PropsClient::MessageChanged(const std::string& message)
+{
+ std::cout << "MessageChanged signal, new value: " << message << "\n";
+};
+
+void PropsClient::DataChanged(const double& data)
+{
+ std::cout << "DataChanged signal, new value:" << data << "\n";
+};
+
+void *test_property_proxy(void * input)
+{
+ PropsClient *client = static_cast<PropsClient*>(input);
+
+ std::cout << "read property 'Version', value:" << client->Version() << "\n";
+
+ std::cout << "read property 'Message', value:" << client->Message() << "\n";
+
+ client->Message("message set by property access");
+ std::cout << "wrote property 'Message'\n";
+
+ std::cout << "read property 'Message', value:" << client->Message() << "\n";
+
+ client->Data(1.1);
+ std::cout << "wrote property 'Data'\n";
+
+ return NULL;
+}
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ dispatcher.leave();
+ pthread_exit(NULL);
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::_init_threading();
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ PropsClient client (conn, PROPS_SERVER_PATH, PROPS_SERVER_NAME);
+
+ pthread_t thread;
+ pthread_create(&thread, NULL, test_property_proxy, &client);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.h
new file mode 100644
index 00000000000..99b70c500c4
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-client.h
@@ -0,0 +1,22 @@
+#ifndef __DEMO_PROPS_SERVER_H
+#define __DEMO_PROPS_SERVER_H
+
+#include <dbus-c++/dbus.h>
+#include "propsgs-glue-proxy.h"
+
+class PropsClient
+: public org::freedesktop::DBus::PropsGSDemo_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::PropertiesProxy,
+ public DBus::ObjectProxy
+{
+public:
+
+ PropsClient(DBus::Connection &connection, const char *path, const char *name);
+
+ void MessageChanged(const std::string& message);
+
+ void DataChanged(const double& data);
+};
+
+#endif//__DEMO_PROPS_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-introspect.xml b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-introspect.xml
new file mode 100644
index 00000000000..10459308fc3
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-introspect.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<node name="/org/freedesktop/DBus/Examples/Properties">
+ <interface name="org.freedesktop.DBus.PropsGSDemo">
+ <property name="Version" type="i" access="read"/>
+ <property name="Message" type="s" access="readwrite"/>
+ <property name="Data" type="d" access="write"/>
+ <signal name="MessageChanged">
+ <arg name="message" type="s"/>
+ </signal>
+ <signal name="DataChanged">
+ <arg name="Data" type="d"/>
+ </signal>
+ </interface>
+</node>
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.cpp b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.cpp
new file mode 100644
index 00000000000..c3ff23f645b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.cpp
@@ -0,0 +1,56 @@
+#include "propsgs-server.h"
+#include <iostream>
+#include <signal.h>
+
+static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
+static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
+
+PropsServer::PropsServer(DBus::Connection &connection)
+: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH)
+{
+ Version = 1;
+ Message = "default message";
+}
+
+void PropsServer::on_set_property
+ (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value)
+{
+ if (property == "Message")
+ {
+ std::cout << "'Message' has been changed\n";
+
+ std::string msg = value;
+ this->MessageChanged(msg);
+ }
+ if (property == "Data")
+ {
+ std::cout << "'Data' has been changed\n";
+
+ double data = value;
+ this->DataChanged(data);
+ }
+}
+
+DBus::BusDispatcher dispatcher;
+
+void niam(int sig)
+{
+ dispatcher.leave();
+}
+
+int main()
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+
+ DBus::default_dispatcher = &dispatcher;
+
+ DBus::Connection conn = DBus::Connection::SessionBus();
+ conn.request_name(PROPS_SERVER_NAME);
+
+ PropsServer server(conn);
+
+ dispatcher.enter();
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.h b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.h
new file mode 100644
index 00000000000..a3169d629f9
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/examples/properties/propsgs-server.h
@@ -0,0 +1,21 @@
+#ifndef __DEMO_PROPS_SERVER_H
+#define __DEMO_PROPS_SERVER_H
+
+#include <dbus-c++/dbus.h>
+#include "propsgs-glue-adaptor.h"
+
+class PropsServer
+: public org::freedesktop::DBus::PropsGSDemo_adaptor,
+ public DBus::IntrospectableAdaptor,
+ public DBus::PropertiesAdaptor,
+ public DBus::ObjectAdaptor
+{
+public:
+
+ PropsServer(DBus::Connection &connection);
+
+ void on_set_property
+ (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
+};
+
+#endif//__DEMO_PROPS_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/api.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/api.h
new file mode 100644
index 00000000000..48904e81b09
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/api.h
@@ -0,0 +1,38 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_API_H
+#define __DBUSXX_API_H
+
+#ifdef GCC_HASCLASSVISIBILITY
+# define DXXAPILOCAL __attribute__ ((visibility("hidden")))
+# define DXXAPIPUBLIC __attribute__ ((visibility("default")))
+#else
+# define DXXAPILOCAL
+# define DXXAPIPUBLIC
+#endif
+
+#define DXXAPI DXXAPIPUBLIC
+
+#endif//__DBUSXX_API_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/connection.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/connection.h
new file mode 100644
index 00000000000..7c19ea12f48
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/connection.h
@@ -0,0 +1,476 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_CONNECTION_H
+#define __DBUSXX_CONNECTION_H
+
+#include <list>
+
+#include "api.h"
+#include "types.h"
+#include "util.h"
+#include "message.h"
+#include "pendingcall.h"
+
+namespace DBus {
+
+class Connection;
+
+typedef Slot<bool, const Message&> MessageSlot;
+
+typedef std::list<Connection> ConnectionList;
+
+class ObjectAdaptor;
+class Dispatcher;
+
+class DXXAPI Connection
+{
+public:
+
+ static Connection SystemBus();
+
+ static Connection SessionBus();
+
+ static Connection ActivationBus();
+
+ struct Private;
+
+ typedef std::list<Private*> PrivatePList;
+
+ Connection( Private* );
+
+ Connection( const char* address, bool priv = true );
+
+ Connection( const Connection& c );
+
+ virtual ~Connection();
+
+ Dispatcher* setup( Dispatcher* );
+
+ bool operator == ( const Connection& ) const;
+
+ /*!
+ * \brief Adds a match rule to match messages going through the message bus.
+ *
+ * The "rule" argument is the string form of a match rule.
+ *
+ * If you pass NULL for the error, this function will not block; the match
+ * thus won't be added until you flush the connection, and if there's an error
+ * adding the match (only possible error is lack of resources in the bus), you
+ * won't find out about it.
+ *
+ * Normal API conventions would have the function return a boolean value
+ * indicating whether the error was set, but that would require blocking always
+ * to determine the return value.
+ *
+ * The AddMatch method is fully documented in the D-Bus specification. For
+ * quick reference, the format of the match rules is discussed here, but the
+ * specification is the canonical version of this information.
+ *
+ * Rules are specified as a string of comma separated key/value pairs. An
+ * example is "type='signal',sender='org.freedesktop.DBus',
+ * interface='org.freedesktop.DBus',member='Foo', path='/bar/foo',destination=':452345.34'"
+ *
+ * Possible keys you can match on are type, sender, interface, member, path,
+ * destination and numbered keys to match message args (keys are 'arg0', 'arg1', etc.).
+ * Omitting a key from the rule indicates a wildcard match. For instance omitting
+ * the member from a match rule but adding a sender would let all messages from
+ * that sender through regardless of the member.
+ *
+ * Matches are inclusive not exclusive so as long as one rule matches the
+ * message will get through. It is important to note this because every time a
+ * essage is received the application will be paged into memory to process it.
+ * This can cause performance problems such as draining batteries on embedded platforms.
+ *
+ * If you match message args ('arg0', 'arg1', and so forth) only string arguments
+ * will match. That is, arg0='5' means match the string "5" not the integer 5.
+ *
+ * Currently there is no way to match against non-string arguments.
+ *
+ * Matching on interface is tricky because method call messages only optionally
+ * specify the interface. If a message omits the interface, then it will NOT
+ * match if the rule specifies an interface name. This means match rules on
+ * method calls should not usually give an interface.
+ *
+ * However, signal messages are required to include the interface so when
+ * matching signals usually you should specify the interface in the match rule.
+ *
+ * For security reasons, you can match arguments only up to DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER.
+ *
+ * Match rules have a maximum length of DBUS_MAXIMUM_MATCH_RULE_LENGTH bytes.
+ *
+ * Both of these maximums are much higher than you're likely to need, they only
+ * exist because the D-Bus bus daemon has fixed limits on all resource usage.
+ *
+ * \param rule Textual form of match rule.
+ * \throw Error
+ */
+ void add_match( const char* rule );
+
+ /*!
+ * \brief Removes a previously-added match rule "by value" (the most
+ * recently-added identical rule gets removed).
+ *
+ * The "rule" argument is the string form of a match rule.
+ *
+ * The bus compares match rules semantically, not textually, so whitespace and
+ * ordering don't have to be identical to the rule you passed to add_match().
+ *
+ * \param rule Textual form of match rule.
+ * \throw Error
+ */
+ void remove_match( const char* rule );
+
+ /*!
+ * \brief Adds a message filter.
+ *
+ * Filters are handlers that are run on all incoming messages, prior to the
+ * objects registered with ObjectAdaptor::register_obj(). Filters are
+ * run in the order that they were added. The same handler can be added as a
+ * filter more than once, in which case it will be run more than once. Filters
+ * added during a filter callback won't be run on the message being processed.
+ *
+ * \param s The MessageSlot to add.
+ */
+ bool add_filter( MessageSlot& s);
+
+ /*!
+ * \brief Removes a previously-added message filter.
+ *
+ * It is a programming error to call this function for a handler that has not
+ * been added as a filter. If the given handler was added more than once, only
+ * one instance of it will be removed (the most recently-added instance).
+ *
+ * \param s The MessageSlot to remove.
+ */
+ void remove_filter( MessageSlot& s);
+
+ /*!
+ * \brief Sets the unique name of the connection, as assigned by the message bus.
+ *
+ * Can only be used if you registered with the bus manually (i.e. if you did
+ * not call register_bus()). Can only be called once per connection. After
+ * the unique name is set, you can get it with unique_name(void).
+ *
+ * The only reason to use this function is to re-implement the equivalent of
+ * register_bus() yourself. One (probably unusual) reason to do that might
+ * be to do the bus registration call asynchronously instead of synchronously.
+ *
+ * \note Just use dbus_bus_get() or dbus_bus_get_private(), or worst case
+ * register_bus(), instead of messing with this function. There's
+ * really no point creating pain for yourself by doing things manually.
+ * (Not sure if this is yet wrapped.)
+ *
+ * It's hard to use this function safely on shared connections (created by
+ * Connection()) in a multithreaded application, because only one
+ * registration attempt can be sent to the bus. If two threads are both
+ * sending the registration message, there is no mechanism in libdbus itself
+ * to avoid sending it twice.
+ *
+ * Thus, you need a way to coordinate which thread sends the registration
+ * attempt; which also means you know which thread will call
+ * unique_name(const char*). If you don't know about all threads in the app
+ * (for example, if some libraries you're using might start libdbus-using
+ * threads), then you need to avoid using this function on shared connections.
+ *
+ * \param n The unique name.
+ */
+ bool unique_name( const char* n );
+
+ /*!
+ * \brief Gets the unique name of the connection as assigned by the message bus.
+ *
+ * Only possible after the connection has been registered with the message bus.
+ * All connections returned by dbus_bus_get() or dbus_bus_get_private() have
+ * been successfully registered. (Not sure if this is yet wrapped.)
+ *
+ * The name remains valid until the connection is freed, and should not be
+ * freed by the caller.
+ *
+ * Other than dbus_bus_get(), there are two ways to set the unique name; one
+ * is register_bus(), the other is unique_name(const char*). You are
+ * responsible for calling unique_name(const char*) if you register by hand
+ * instead of using register_bus().
+ */
+ const char* unique_name() const;
+
+ /*!
+ * \brief Registers a connection with the bus.
+ *
+ * This must be the first thing an application does when connecting to the
+ * message bus. If registration succeeds, the unique name will be set, and
+ * can be obtained using unique_name(void).
+ *
+ * This function will block until registration is complete.
+ *
+ * If the connection has already registered with the bus (determined by
+ * checking whether unique_name(void) returns a non-NULL value),
+ * then this function does nothing.
+ *
+ * If you use dbus_bus_get() or dbus_bus_get_private() this function will be
+ * called for you. (Not sure if this is yet wrapped.)
+ *
+ * \note Just use dbus_bus_get() or dbus_bus_get_private() instead of
+ * register_bus() and save yourself some pain. Using register_bus()
+ * manually is only useful if you have your own custom message bus not found
+ * in DBusBusType.
+ *
+ * If you open a bus connection by the contructor of Connection() you will have to register_bus()
+ * yourself, or make the appropriate registration method calls yourself. If
+ * you send the method calls yourself, call unique_name(const char*) with
+ * the unique bus name you get from the bus.
+ *
+ * For shared connections (created with dbus_connection_open()) in a
+ * multithreaded application, you can't really make the registration calls
+ * yourself, because you don't know whether some other thread is also
+ * registering, and the bus will kick you off if you send two registration
+ * messages. (TODO: how is this done in the wrapper?)
+ *
+ * If you use register_bus() however, there is a lock that keeps both
+ * apps from registering at the same time.
+ *
+ * The rule in a multithreaded app, then, is that register_bus() must be
+ * used to register, or you need to have your own locks that all threads in
+ * the app will respect.
+ *
+ * In a single-threaded application you can register by hand instead of using
+ * register_bus(), as long as you check unique_name(void) to
+ * see if a unique name has already been stored by another thread before you
+ * send the registration messages.
+ */
+ bool register_bus();
+
+ /*!
+ * \brief Gets whether the connection is currently open.
+ *
+ * A connection may become disconnected when the remote application closes its
+ * end, or exits; a connection may also be disconnected with disconnect().
+ *
+ * There are not separate states for "closed" and "disconnected," the two
+ * terms are synonymous.
+ *
+ * \return true If the connection is still alive.
+ */
+ bool connected() const;
+
+ /*!
+ * \brief Closes a private connection, so no further data can be sent or received.
+ *
+ * This disconnects the transport (such as a socket) underlying the connection.
+ *
+ * Attempts to send messages after closing a connection are safe, but will
+ * result in error replies generated locally in libdbus.
+ *
+ * This function does not affect the connection's reference count. It's safe
+ * to close a connection more than once; all calls after the first do nothing.
+ * It's impossible to "reopen" a connection, a new connection must be created.
+ * This function may result in a call to the DBusDispatchStatusFunction set
+ * with Private::init(), as the disconnect
+ * message it generates needs to be dispatched.
+ *
+ * If a connection is dropped by the remote application, it will close itself.
+ *
+ * You must close a connection prior to releasing the last reference to the
+ * connection.
+ *
+ * You may not close a shared connection. Connections created with
+ * dbus_connection_open() or dbus_bus_get() are shared. These connections are
+ * owned by libdbus, and applications should only unref them, never close them.
+ * Applications can know it is safe to unref these connections because libdbus
+ * will be holding a reference as long as the connection is open. Thus, either
+ * the connection is closed and it is OK to drop the last reference, or the
+ * connection is open and the app knows it does not have the last reference.
+ *
+ * Connections created with dbus_connection_open_private() or
+ * dbus_bus_get_private() are not kept track of or referenced by libdbus.
+ * The creator of these connections is responsible for calling
+ * dbus_connection_close() prior to releasing the last reference, if the
+ * connection is not already disconnected.
+ *
+ * \todo dbus_connection_disconnect() was removed in dbus 0.9x. Maybe this
+ * function should be renamed to close().
+ */
+ void disconnect();
+
+ /*!
+ * \brief Set whether _exit() should be called when the connection receives a
+ * disconnect signal.
+ *
+ * The call to _exit() comes after any handlers for the disconnect signal run;
+ * handlers can cancel the exit by calling this function.
+ *
+ * By default, exit_on_disconnect is false; but for message bus connections
+ * returned from dbus_bus_get() it will be toggled on by default.
+ *
+ * \param exit true If _exit() should be called after a disconnect signal.
+ */
+ void exit_on_disconnect( bool exit );
+
+ /*!
+ * \brief Blocks until the outgoing message queue is empty.
+ */
+ void flush();
+
+ /*!
+ * \brief Adds a message to the outgoing message queue.
+ *
+ * Does not block to write the message to the network; that happens
+ * asynchronously. To force the message to be written, call
+ * dbus_connection_flush(). Because this only queues the message, the only
+ * reason it can fail is lack of memory. Even if the connection is disconnected,
+ * no error will be returned.
+ *
+ * If the function fails due to lack of memory, it returns FALSE. The function
+ * will never fail for other reasons; even if the connection is disconnected,
+ * you can queue an outgoing message, though obviously it won't be sent.
+ *
+ * The message serial is used by the remote application to send a reply; see
+ * Message::serial() or the D-Bus specification.
+ *
+ * \param msg The Message to write.
+ * \param serial Return location for message serial, or NULL if you don't care.
+ * \return true On success.
+ */
+ bool send( const Message& msg, unsigned int* serial = NULL );
+
+ /*!
+ * \brief Sends a message and blocks a certain time period while waiting for a reply.
+ *
+ * This function does not reenter the main loop, i.e. messages other than the
+ * reply are queued up but not processed. This function is used to invoke
+ * method calls on a remote object.
+ *
+ * If a normal reply is received, it is returned, and removed from the
+ * incoming message queue. If it is not received, NULL is returned and the
+ * error is set to DBUS_ERROR_NO_REPLY. If an error reply is received, it is
+ * converted to a DBusError and returned as an error, then the reply message
+ * is deleted and NULL is returned. If something else goes wrong, result is
+ * set to whatever is appropriate, such as DBUS_ERROR_NO_MEMORY or DBUS_ERROR_DISCONNECTED.
+ *
+ * \warning While this function blocks the calling thread will not be
+ * processing the incoming message queue. This means you can end up
+ * deadlocked if the application you're talking to needs you to reply
+ * to a method. To solve this, either avoid the situation, block in a
+ * separate thread from the main connection-dispatching thread, or
+ * use PendingCall to avoid blocking.
+ *
+ * \param msg The Message to write.
+ * \param timeout Timeout in milliseconds (omit for default).
+ * \return The reply Message, which may be an ErrorMessage.
+ * \throw Error
+ */
+ Message send_blocking( Message& msg, int timeout = -1);
+
+ /*!
+ * \brief Queues a message to send, as with send(), but also
+ * returns a DBus::PendingCall used to receive a reply to the message.
+ *
+ * If no reply is received in the given timeout_milliseconds, this function
+ * expires the pending reply and generates a synthetic error reply (generated
+ * in-process, not by the remote application) indicating that a timeout occurred.
+ *
+ * A PendingCall will see a reply message before any filters or registered
+ * object path handlers. See Connection::Private::do_dispatch() in dbus documentation
+ * for details on when handlers are run. (here: Connection::Private::do_dispatch())
+ *
+ * A PendingCall will always see exactly one reply message, unless it's
+ * cancelled with PendingCall::cancel().
+ *
+ * If -1 is passed for the timeout, a sane default timeout is used. -1 is
+ * typically the best value for the timeout for this reason, unless you want
+ * a very short or very long timeout. There is no way to avoid a timeout
+ * entirely, other than passing INT_MAX for the timeout to mean "very long
+ * timeout." libdbus clamps an INT_MAX timeout down to a few hours timeout though.
+ *
+ * \param msg The Message to write.
+ * \param timeout Timeout in milliseconds (omit for default).
+ * \return The PendingCall. The PendingCall::reply_handler() method can be used to
+ * set a callback to be invoked when the reply is received. The pending
+ * call is owned by the application's ObjectProxy class. Once
+ * the handler is done with the PendingCall, it should dispose of it by
+ * calling InterfaceProxy::remove_pending_call(). The pending
+ * call is <em>not</em> cancelled when the PendingCall object is deleted.
+ * Instead, the PendingCall::cancel() method must be used.
+ * \throw ErrorNoMemory
+ */
+ PendingCall *send_async(Message& msg, int timeout = -1);
+
+ void request_name( const char* name, int flags = 0 );
+
+ unsigned long sender_unix_uid(const char *sender);
+
+ /*!
+ * \brief Asks the bus whether a certain name has an owner.
+ *
+ * Using this can easily result in a race condition, since an owner can appear
+ * or disappear after you call this.
+ *
+ * If you want to request a name, just request it; if you want to avoid
+ * replacing a current owner, don't specify DBUS_NAME_FLAG_REPLACE_EXISTING
+ * and you will get an error if there's already an owner.
+ *
+ * \param name The name.
+ * \throw Error
+ */
+ bool has_name( const char* name );
+
+ /*!
+ * \brief Starts a service that will request ownership of the given name.
+ *
+ * The returned result will be one of be one of DBUS_START_REPLY_SUCCESS or
+ * DBUS_START_REPLY_ALREADY_RUNNING if successful. Pass NULL if you don't
+ * care about the result.
+ *
+ * The flags parameter is for future expansion, currently you should specify 0.
+ *
+ * It's often easier to avoid explicitly starting services, and just send a
+ * method call to the service's bus name instead. Method calls start a service
+ * to handle them by default unless you call dbus_message_set_auto_start() to
+ * disable this behavior.
+ *
+ * \todo dbus_message_set_auto_start() not yet wrapped!
+ */
+ bool start_service( const char* name, unsigned long flags );
+
+ const std::vector<std::string>& names();
+
+ void set_timeout(int timeout);
+
+ int get_timeout();
+
+private:
+
+ DXXAPILOCAL void init();
+
+private:
+
+ RefPtrI<Private> _pvt;
+ int _timeout;
+
+friend class ObjectAdaptor; // needed in order to register object paths for a connection
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_CONNECTION_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dbus.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dbus.h
new file mode 100644
index 00000000000..7dfc1641a26
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dbus.h
@@ -0,0 +1,45 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_DBUS_H
+#define __DBUSXX_DBUS_H
+
+#include "types.h"
+#include "interface.h"
+#include "object.h"
+#include "property.h"
+#include "connection.h"
+#include "server.h"
+#include "error.h"
+#include "message.h"
+#include "debug.h"
+#include "pendingcall.h"
+#include "server.h"
+#include "util.h"
+#include "dispatcher.h"
+#include "eventloop.h"
+#include "eventloop-integration.h"
+#include "introspection.h"
+
+#endif//__DBUSXX_DBUS_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/debug.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/debug.h
new file mode 100644
index 00000000000..e66c79b3cfe
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/debug.h
@@ -0,0 +1,38 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_DEBUG_H
+#define __DBUSXX_DEBUG_H
+
+#include "api.h"
+
+namespace DBus {
+
+typedef void (*LogFunction)(const char *format, ...);
+
+extern DXXAPI LogFunction debug_log;
+
+} /* namespace DBus */
+
+#endif
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dispatcher.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dispatcher.h
new file mode 100644
index 00000000000..8e74b649d2c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/dispatcher.h
@@ -0,0 +1,316 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_DISPATCHER_H
+#define __DBUSXX_DISPATCHER_H
+
+#include "api.h"
+#include "connection.h"
+#include "eventloop.h"
+
+namespace DBus {
+
+class DXXAPI Timeout
+{
+public:
+
+ class Internal;
+
+ Timeout(Internal *i);
+
+ virtual ~Timeout(){}
+
+ /*!
+ * \brief Gets the timeout interval.
+ *
+ * The dbus_timeout_handle() should be called each time this interval elapses,
+ * starting after it elapses once.
+ *
+ * The interval may change during the life of the timeout; if so, the timeout
+ * will be disabled and re-enabled (calling the "timeout toggled function") to
+ * notify you of the change.
+ *
+ * return The interval in miliseconds.
+ */
+ int interval() const;
+
+ bool enabled() const;
+
+ /*!
+ * \brief Calls the timeout handler for this timeout.
+ *
+ * This function should be called when the timeout occurs.
+ *
+ * If this function returns FALSE, then there wasn't enough memory to handle
+ * the timeout. Typically just letting the timeout fire again next time it
+ * naturally times out is an adequate response to that problem, but you could
+ * try to do more if you wanted.
+ *
+ * return false If there wasn't enough memory.
+ */
+ bool handle();
+
+ virtual void toggle() = 0;
+
+private:
+
+ DXXAPILOCAL Timeout(const Timeout &);
+
+private:
+
+ Internal *_int;
+};
+
+class DXXAPI Watch
+{
+public:
+
+ class Internal;
+
+ Watch(Internal *i);
+
+ virtual ~Watch(){}
+
+ /*!
+ * \brief A main loop could poll this descriptor to integrate dbus-c++.
+ *
+ * This function calls dbus_watch_get_socket() on win32 and
+ * dbus_watch_get_unix_fd() on all other systems. (see dbus documentation)
+ *
+ * @return The file descriptor.
+ */
+ int descriptor() const;
+
+ /*!
+ * \brief Gets flags from DBusWatchFlags indicating what conditions should be
+ * monitored on the file descriptor.
+ *
+ * The flags returned will only contain DBUS_WATCH_READABLE and DBUS_WATCH_WRITABLE,
+ * never DBUS_WATCH_HANGUP or DBUS_WATCH_ERROR; all watches implicitly include
+ * a watch for hangups, errors, and other exceptional conditions.
+ *
+ * @return The conditions to watch.
+ */
+ int flags() const;
+
+ bool enabled() const;
+
+ /*!
+ * \brief Called to notify the D-Bus library when a previously-added watch
+ * is ready for reading or writing, or has an exception such as a hangup.
+ *
+ * If this function returns FALSE, then the file descriptor may still be
+ * ready for reading or writing, but more memory is needed in order to do the
+ * reading or writing. If you ignore the FALSE return, your application may
+ * spin in a busy loop on the file descriptor until memory becomes available,
+ * but nothing more catastrophic should happen.
+ *
+ * dbus_watch_handle() cannot be called during the DBusAddWatchFunction, as the
+ * connection will not be ready to handle that watch yet.
+ *
+ * It is not allowed to reference a DBusWatch after it has been passed to remove_function.
+ *
+ * @param flags The poll condition using DBusWatchFlags values.
+ * @return false If there wasn't enough memory.
+ */
+ bool handle(int flags);
+
+ virtual void toggle() = 0;
+
+private:
+
+ DXXAPILOCAL Watch(const Watch &);
+
+private:
+
+ Internal *_int;
+};
+
+class DXXAPI Dispatcher
+{
+public:
+ Dispatcher() : _dispatching(false) {}
+
+ virtual ~Dispatcher()
+ {}
+
+ void queue_connection(Connection::Private *);
+
+ void dispatch_pending();
+ bool has_something_to_dispatch();
+
+ virtual void enter() = 0;
+
+ virtual void leave() = 0;
+
+ virtual Timeout *add_timeout(Timeout::Internal *) = 0;
+
+ virtual void rem_timeout(Timeout *) = 0;
+
+ virtual Watch *add_watch(Watch::Internal *) = 0;
+
+ virtual void rem_watch(Watch *) = 0;
+
+ struct Private;
+
+private:
+
+ DefaultMutex _mutex_p;
+ Connection::PrivatePList _pending_queue;
+ bool _dispatching;
+};
+
+extern DXXAPI Dispatcher *default_dispatcher;
+
+/* classes for multithreading support
+*/
+
+class DXXAPI Mutex
+{
+public:
+
+ virtual ~Mutex() {}
+
+ virtual void lock() = 0;
+
+ virtual void unlock() = 0;
+
+ struct Internal;
+
+protected:
+
+ Internal *_int;
+};
+
+class DXXAPI CondVar
+{
+public:
+
+ virtual ~CondVar() {}
+
+ virtual void wait(Mutex *) = 0;
+
+ virtual bool wait_timeout(Mutex *, int timeout) = 0;
+
+ virtual void wake_one() = 0;
+
+ virtual void wake_all() = 0;
+
+ struct Internal;
+
+protected:
+
+ Internal *_int;
+};
+
+typedef Mutex *(*MutexNewFn)();
+typedef void (*MutexUnlockFn)(Mutex *mx);
+
+#ifndef DBUS_HAS_RECURSIVE_MUTEX
+typedef bool (*MutexFreeFn)(Mutex *mx);
+typedef bool (*MutexLockFn)(Mutex *mx);
+#else
+typedef void (*MutexFreeFn)(Mutex *mx);
+typedef void (*MutexLockFn)(Mutex *mx);
+#endif//DBUS_HAS_RECURSIVE_MUTEX
+
+typedef CondVar *(*CondVarNewFn)();
+typedef void (*CondVarFreeFn)(CondVar *cv);
+typedef void (*CondVarWaitFn)(CondVar *cv, Mutex *mx);
+typedef bool (*CondVarWaitTimeoutFn)(CondVar *cv, Mutex *mx, int timeout);
+typedef void (*CondVarWakeOneFn)(CondVar *cv);
+typedef void (*CondVarWakeAllFn)(CondVar *cv);
+
+void DXXAPI _init_threading();
+
+void DXXAPI _init_threading(
+ MutexNewFn, MutexFreeFn, MutexLockFn, MutexUnlockFn,
+ CondVarNewFn, CondVarFreeFn, CondVarWaitFn, CondVarWaitTimeoutFn, CondVarWakeOneFn, CondVarWakeAllFn
+);
+
+template<class Mx, class Cv>
+struct Threading
+{
+ static void init()
+ {
+ _init_threading(
+ mutex_new, mutex_free, mutex_lock, mutex_unlock,
+ condvar_new, condvar_free, condvar_wait, condvar_wait_timeout, condvar_wake_one, condvar_wake_all
+ );
+ }
+
+ static Mutex *mutex_new()
+ {
+ return new Mx;
+ }
+
+ static void mutex_free(Mutex *mx)
+ {
+ delete mx;
+ }
+
+ static void mutex_lock(Mutex *mx)
+ {
+ mx->lock();
+ }
+
+ static void mutex_unlock(Mutex *mx)
+ {
+ mx->unlock();
+ }
+
+ static CondVar *condvar_new()
+ {
+ return new Cv;
+ }
+
+ static void condvar_free(CondVar *cv)
+ {
+ delete cv;
+ }
+
+ static void condvar_wait(CondVar *cv, Mutex *mx)
+ {
+ cv->wait(mx);
+ }
+
+ static bool condvar_wait_timeout(CondVar *cv, Mutex *mx, int timeout)
+ {
+ return cv->wait_timeout(mx, timeout);
+ }
+
+ static void condvar_wake_one(CondVar *cv)
+ {
+ cv->wake_one();
+ }
+
+ static void condvar_wake_all(CondVar *cv)
+ {
+ cv->wake_all();
+ }
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_DISPATCHER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/ecore-integration.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/ecore-integration.h
new file mode 100644
index 00000000000..b475533a16d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/ecore-integration.h
@@ -0,0 +1,114 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_ECORE_INTEGRATION_H
+#define __DBUSXX_ECORE_INTEGRATION_H
+
+#include <Ecore.h>
+
+#include "api.h"
+#include "dispatcher.h"
+#include "Ecore.h"
+
+namespace DBus {
+
+namespace Ecore {
+
+class BusDispatcher;
+
+class DXXAPI BusTimeout : public Timeout
+{
+private:
+
+ BusTimeout( Timeout::Internal*);
+
+ ~BusTimeout();
+
+ void toggle();
+
+ static int timeout_handler( void* );
+
+ void _enable();
+
+ void _disable();
+
+private:
+ Ecore_Timer *_etimer;
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusWatch : public Watch
+{
+private:
+
+ BusWatch( Watch::Internal*);
+
+ ~BusWatch();
+
+ void toggle();
+
+ static int watch_handler_read ( void*, Ecore_Fd_Handler *fdh);
+
+ static int watch_handler_error ( void*, Ecore_Fd_Handler *fdh);
+
+ void _enable();
+
+ void _disable();
+
+private:
+ Ecore_Fd_Handler *fd_handler_read;
+ Ecore_Fd_Handler *fd_handler_error;
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusDispatcher : public Dispatcher
+{
+public:
+ BusDispatcher() {}
+
+ void attach();
+
+ void enter() {}
+
+ void leave() {}
+
+ Timeout* add_timeout( Timeout::Internal* );
+
+ void rem_timeout( Timeout* );
+
+ Watch* add_watch( Watch::Internal* );
+
+ void rem_watch( Watch* );
+
+private:
+
+};
+
+} /* namespace Ecore */
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_ECORE_INTEGRATION_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/error.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/error.h
new file mode 100644
index 00000000000..c1d215153fe
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/error.h
@@ -0,0 +1,284 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_ERROR_H
+#define __DBUSXX_ERROR_H
+
+#include "api.h"
+#include "util.h"
+
+#include <exception>
+
+namespace DBus {
+
+class Message;
+struct InternalError;
+
+class DXXAPI Error : public std::exception
+{
+public:
+
+ Error();
+
+ Error(InternalError &);
+
+ Error(const char *name, const char *message);
+
+ Error(Message &);
+
+ ~Error() throw();
+
+ const char *what() const throw();
+
+ const char *name() const;
+
+ const char *message() const;
+
+ void set(const char *name, const char *message);
+
+ bool is_set() const;
+
+ operator bool() const
+ {
+ return is_set();
+ }
+
+private:
+
+ RefPtrI<InternalError> _int;
+};
+
+struct DXXAPI ErrorFailed : public Error
+{
+ ErrorFailed(const char *message)
+ : Error("org.freedesktop.DBus.Error.Failed", message)
+ {}
+};
+
+struct DXXAPI ErrorNoMemory : public Error
+{
+ ErrorNoMemory(const char *message)
+ : Error("org.freedesktop.DBus.Error.NoMemory", message)
+ {}
+};
+
+struct DXXAPI ErrorServiceUnknown : public Error
+{
+ ErrorServiceUnknown(const char *message)
+ : Error("org.freedesktop.DBus.Error.ServiceUnknown", message)
+ {}
+};
+
+struct DXXAPI ErrorNameHasNoOwner : public Error
+{
+ ErrorNameHasNoOwner(const char *message)
+ : Error("org.freedesktop.DBus.Error.NameHasNoOwner", message)
+ {}
+};
+
+struct DXXAPI ErrorNoReply : public Error
+{
+ ErrorNoReply(const char *message)
+ : Error("org.freedesktop.DBus.Error.NoReply", message)
+ {}
+};
+
+struct DXXAPI ErrorIOError : public Error
+{
+ ErrorIOError(const char *message)
+ : Error("org.freedesktop.DBus.Error.IOError", message)
+ {}
+};
+
+struct DXXAPI ErrorBadAddress : public Error
+{
+ ErrorBadAddress(const char *message)
+ : Error("org.freedesktop.DBus.Error.BadAddress", message)
+ {}
+};
+
+struct DXXAPI ErrorNotSupported : public Error
+{
+ ErrorNotSupported(const char *message)
+ : Error("org.freedesktop.DBus.Error.NotSupported", message)
+ {}
+};
+
+struct DXXAPI ErrorLimitsExceeded : public Error
+{
+ ErrorLimitsExceeded(const char *message)
+ : Error("org.freedesktop.DBus.Error.LimitsExceeded", message)
+ {}
+};
+
+struct DXXAPI ErrorAccessDenied : public Error
+{
+ ErrorAccessDenied(const char *message)
+ : Error("org.freedesktop.DBus.Error.AccessDenied", message)
+ {}
+};
+
+struct DXXAPI ErrorAuthFailed : public Error
+{
+ ErrorAuthFailed(const char *message)
+ : Error("org.freedesktop.DBus.Error.AuthFailed", message)
+ {}
+};
+
+struct DXXAPI ErrorNoServer : public Error
+{
+ ErrorNoServer(const char *message)
+ : Error("org.freedesktop.DBus.Error.NoServer", message)
+ {}
+};
+
+struct DXXAPI ErrorTimeout : public Error
+{
+ ErrorTimeout(const char *message)
+ : Error("org.freedesktop.DBus.Error.Timeout", message)
+ {}
+};
+
+struct DXXAPI ErrorNoNetwork : public Error
+{
+ ErrorNoNetwork(const char *message)
+ : Error("org.freedesktop.DBus.Error.NoNetwork", message)
+ {}
+};
+
+struct DXXAPI ErrorAddressInUse : public Error
+{
+ ErrorAddressInUse(const char *message)
+ : Error("org.freedesktop.DBus.Error.AddressInUse", message)
+ {}
+};
+
+struct DXXAPI ErrorDisconnected : public Error
+{
+ ErrorDisconnected(const char *message)
+ : Error("org.freedesktop.DBus.Error.Disconnected", message)
+ {}
+};
+
+struct DXXAPI ErrorInvalidArgs : public Error
+{
+ ErrorInvalidArgs(const char *message)
+ : Error("org.freedesktop.DBus.Error.InvalidArgs", message)
+ {}
+};
+
+struct DXXAPI ErrorFileNotFound : public Error
+{
+ ErrorFileNotFound(const char *message)
+ : Error("org.freedesktop.DBus.Error.FileNotFound", message)
+ {}
+};
+
+struct DXXAPI ErrorUnknownMethod : public Error
+{
+ ErrorUnknownMethod(const char *message)
+ : Error("org.freedesktop.DBus.Error.UnknownMethod", message)
+ {}
+};
+
+struct DXXAPI ErrorTimedOut : public Error
+{
+ ErrorTimedOut(const char *message)
+ : Error("org.freedesktop.DBus.Error.TimedOut", message)
+ {}
+};
+
+struct DXXAPI ErrorMatchRuleNotFound : public Error
+{
+ ErrorMatchRuleNotFound(const char *message)
+ : Error("org.freedesktop.DBus.Error.MatchRuleNotFound", message)
+ {}
+};
+
+struct DXXAPI ErrorMatchRuleInvalid : public Error
+{
+ ErrorMatchRuleInvalid(const char *message)
+ : Error("org.freedesktop.DBus.Error.MatchRuleInvalid", message)
+ {}
+};
+
+struct DXXAPI ErrorSpawnExecFailed : public Error
+{
+ ErrorSpawnExecFailed(const char *message)
+ : Error("org.freedesktop.DBus.Error.Spawn.ExecFailed", message)
+ {}
+};
+
+struct DXXAPI ErrorSpawnForkFailed : public Error
+{
+ ErrorSpawnForkFailed(const char *message)
+ : Error("org.freedesktop.DBus.Error.Spawn.ForkFailed", message)
+ {}
+};
+
+struct DXXAPI ErrorSpawnChildExited : public Error
+{
+ ErrorSpawnChildExited(const char *message)
+ : Error("org.freedesktop.DBus.Error.Spawn.ChildExited", message)
+ {}
+};
+
+struct DXXAPI ErrorSpawnChildSignaled : public Error
+{
+ ErrorSpawnChildSignaled(const char *message)
+ : Error("org.freedesktop.DBus.Error.Spawn.ChildSignaled", message)
+ {}
+};
+
+struct DXXAPI ErrorSpawnFailed : public Error
+{
+ ErrorSpawnFailed(const char *message)
+ : Error("org.freedesktop.DBus.Error.Spawn.Failed", message)
+ {}
+};
+
+struct DXXAPI ErrorInvalidSignature : public Error
+{
+ ErrorInvalidSignature(const char *message)
+ : Error("org.freedesktop.DBus.Error.InvalidSignature", message)
+ {}
+};
+
+struct DXXAPI ErrorUnixProcessIdUnknown : public Error
+{
+ ErrorUnixProcessIdUnknown(const char *message)
+ : Error("org.freedesktop.DBus.Error.UnixProcessIdUnknown", message)
+ {}
+};
+
+struct DXXAPI ErrorSELinuxSecurityContextUnknown : public Error
+{
+ ErrorSELinuxSecurityContextUnknown(const char *message)
+ : Error("org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", message)
+ {}
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_ERROR_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop-integration.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop-integration.h
new file mode 100644
index 00000000000..1b56ab51b4e
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop-integration.h
@@ -0,0 +1,112 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_EVENTLOOP_INTEGRATION_H
+#define __DBUSXX_EVENTLOOP_INTEGRATION_H
+
+#include <cstring>
+#include <errno.h>
+#include <unistd.h>
+#include "api.h"
+#include "dispatcher.h"
+#include "util.h"
+#include "eventloop.h"
+
+namespace DBus {
+
+/*
+ * Glue between the event loop and the DBus library
+ */
+
+class BusDispatcher;
+
+class DXXAPI BusTimeout : public Timeout, public DefaultTimeout
+{
+ BusTimeout(Timeout::Internal *, BusDispatcher *);
+
+ void toggle();
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusWatch : public Watch, public DefaultWatch
+{
+ BusWatch(Watch::Internal *, BusDispatcher *);
+
+ void toggle();
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusDispatcher : public Dispatcher, public DefaultMainLoop
+{
+public:
+
+ int _pipe[2];
+
+ BusDispatcher() : _running(false)
+ {
+ //pipe to create a new fd used to unlock a dispatcher at any
+ // moment (used by leave function)
+ int ret = pipe(_pipe);
+ if (ret == -1) {
+ char buffer[128]; // buffer copied in Error constructor
+ throw Error("PipeError:errno", strerror_r(errno,
+ buffer,
+ sizeof(buffer)));
+ }
+ _fdunlock[0] = _pipe[0];
+ _fdunlock[1] = _pipe[1];
+
+ }
+
+ ~BusDispatcher()
+ {}
+
+ virtual void enter();
+
+ virtual void leave();
+
+ virtual void do_iteration();
+
+ virtual Timeout *add_timeout(Timeout::Internal *);
+
+ virtual void rem_timeout(Timeout *);
+
+ virtual Watch *add_watch(Watch::Internal *);
+
+ virtual void rem_watch(Watch *);
+
+ void watch_ready(DefaultWatch &);
+
+ void timeout_expired(DefaultTimeout &);
+
+private:
+
+ bool _running;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_EVENTLOOP_INTEGRATION_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop.h
new file mode 100644
index 00000000000..8458756bd11
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/eventloop.h
@@ -0,0 +1,170 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_EVENTLOOP_H
+#define __DBUSXX_EVENTLOOP_H
+
+#include <pthread.h>
+#include <list>
+
+#include "api.h"
+#include "util.h"
+
+namespace DBus {
+
+/*
+ * these Default *classes implement a very simple event loop which
+ * is used here as the default main loop, if you want to hook
+ * a different one use the Bus *classes in eventloop-integration.h
+ * or the Glib::Bus *classes as a reference
+ */
+
+class DefaultMainLoop;
+
+class DXXAPI DefaultTimeout
+{
+public:
+
+ DefaultTimeout(int interval, bool repeat, DefaultMainLoop *);
+
+ virtual ~DefaultTimeout();
+
+ bool enabled(){ return _enabled; }
+ void enabled(bool e){ _enabled = e; }
+
+ int interval(){ return _interval; }
+ void interval(int i){ _interval = i; }
+
+ bool repeat(){ return _repeat; }
+ void repeat(bool r){ _repeat = r; }
+
+ void *data(){ return _data; }
+ void data(void *d){ _data = d; }
+
+ Slot<void, DefaultTimeout &> expired;
+
+private:
+
+ bool _enabled;
+
+ int _interval;
+ bool _repeat;
+
+ double _expiration;
+
+ void *_data;
+
+ DefaultMainLoop *_disp;
+
+friend class DefaultMainLoop;
+};
+
+typedef std::list< DefaultTimeout *> DefaultTimeouts;
+
+class DXXAPI DefaultWatch
+{
+public:
+
+ DefaultWatch(int fd, int flags, DefaultMainLoop *);
+
+ virtual ~DefaultWatch();
+
+ bool enabled(){ return _enabled; }
+ void enabled(bool e){ _enabled = e; }
+
+ int descriptor(){ return _fd; }
+
+ int flags(){ return _flags; }
+ void flags(int f){ _flags = f; }
+
+ int state(){ return _state; }
+
+ void *data(){ return _data; }
+ void data(void *d){ _data = d; }
+
+ Slot<void, DefaultWatch &> ready;
+
+private:
+
+ bool _enabled;
+
+ int _fd;
+ int _flags;
+ int _state;
+
+ void *_data;
+
+ DefaultMainLoop *_disp;
+
+friend class DefaultMainLoop;
+};
+
+typedef std::list< DefaultWatch *> DefaultWatches;
+
+class DXXAPI DefaultMutex
+{
+public:
+
+ /*!
+ * Constructor for non recursive Mutex
+ */
+ DefaultMutex();
+
+ ~DefaultMutex();
+
+ void lock();
+
+ void unlock();
+
+private:
+
+ pthread_mutex_t _mutex;
+};
+
+class DXXAPI DefaultMainLoop
+{
+public:
+
+ DefaultMainLoop();
+
+ virtual ~DefaultMainLoop();
+
+ virtual void dispatch();
+
+ int _fdunlock[2];
+private:
+
+ DefaultMutex _mutex_t;
+ DefaultTimeouts _timeouts;
+
+ DefaultMutex _mutex_w;
+ DefaultWatches _watches;
+
+friend class DefaultTimeout;
+friend class DefaultWatch;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_EVENTLOOP_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/glib-integration.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/glib-integration.h
new file mode 100644
index 00000000000..0f688520dce
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/glib-integration.h
@@ -0,0 +1,123 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_GLIB_INTEGRATION_H
+#define __DBUSXX_GLIB_INTEGRATION_H
+
+#include <glib.h>
+
+#include "api.h"
+#include "dispatcher.h"
+
+namespace DBus {
+
+namespace Glib {
+
+class BusDispatcher;
+
+class DXXAPI BusTimeout : public Timeout
+{
+private:
+
+ BusTimeout(Timeout::Internal *, GMainContext *, int);
+
+ ~BusTimeout();
+
+ void toggle();
+
+ static gboolean timeout_handler(gpointer);
+
+ void _enable();
+
+ void _disable();
+
+private:
+
+ GMainContext *_ctx;
+ int _priority;
+ GSource *_source;
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusWatch : public Watch
+{
+private:
+
+ BusWatch(Watch::Internal *, GMainContext *, int);
+
+ ~BusWatch();
+
+ void toggle();
+
+ static gboolean watch_handler(gpointer);
+
+ void _enable();
+
+ void _disable();
+
+private:
+
+ GMainContext *_ctx;
+ int _priority;
+ GSource *_source;
+
+friend class BusDispatcher;
+};
+
+class DXXAPI BusDispatcher : public Dispatcher
+{
+public:
+
+ BusDispatcher();
+ ~BusDispatcher();
+
+ void attach(GMainContext *);
+
+ void enter() {}
+
+ void leave() {}
+
+ Timeout *add_timeout(Timeout::Internal *);
+
+ void rem_timeout(Timeout *);
+
+ Watch *add_watch(Watch::Internal *);
+
+ void rem_watch(Watch *);
+
+ void set_priority(int priority);
+
+private:
+
+ GMainContext *_ctx;
+ int _priority;
+ GSource *_source;
+};
+
+} /* namespace Glib */
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_GLIB_INTEGRATION_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/interface.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/interface.h
new file mode 100644
index 00000000000..db7b7cb2432
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/interface.h
@@ -0,0 +1,231 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_INTERFACE_H
+#define __DBUSXX_INTERFACE_H
+
+#include <string>
+#include <map>
+#include "api.h"
+#include "util.h"
+#include "types.h"
+
+#include "message.h"
+
+namespace DBus {
+
+//todo: this should belong to to properties.h
+struct DXXAPI PropertyData
+{
+ bool read;
+ bool write;
+ std::string sig;
+ Variant value;
+};
+
+typedef std::map<std::string, PropertyData> PropertyTable;
+
+struct IntrospectedInterface;
+
+class ObjectAdaptor;
+class InterfaceAdaptor;
+class SignalMessage;
+class PendingCall;
+
+typedef std::map<std::string, InterfaceAdaptor *> InterfaceAdaptorTable;
+
+class DXXAPI AdaptorBase
+{
+public:
+
+ virtual const ObjectAdaptor *object() const = 0 ;
+
+protected:
+
+ InterfaceAdaptor *find_interface(const std::string &name);
+
+ virtual ~AdaptorBase()
+ {}
+
+ virtual void _emit_signal(SignalMessage &) = 0;
+
+ InterfaceAdaptorTable _interfaces;
+};
+
+/*
+*/
+
+class ObjectProxy;
+class InterfaceProxy;
+class CallMessage;
+
+typedef std::map<std::string, InterfaceProxy *> InterfaceProxyTable;
+
+class DXXAPI ProxyBase
+{
+public:
+
+ virtual const ObjectProxy *object() const = 0 ;
+
+protected:
+
+ InterfaceProxy *find_interface(const std::string &name);
+
+ virtual ~ProxyBase()
+ {}
+
+ virtual Message _invoke_method(CallMessage &) = 0;
+
+ virtual bool _invoke_method_noreply(CallMessage &call) = 0;
+
+ /*!
+ * \brief Perform a non-blocking method invocation.
+ * \details Queues a message to send, as with _invoke_method(), but instead
+ * of blocking to wait for a reply, immediately returns a DBus::PendingCall
+ * used to receive the reply asynchronously.
+ *
+ * The PendingCall is owned by the caller, and must be disposed of using
+ * _remove_pending_call().
+ */
+ virtual PendingCall *_invoke_method_async(CallMessage &call, int timeout = -1) = 0;
+ /*!
+ * \brief Deletes the supplied PendingCall without cancelling it.
+ * \param pending The PendingCall to be deleted.
+ */
+ virtual void _remove_pending_call(PendingCall *pending) = 0;
+
+ InterfaceProxyTable _interfaces;
+};
+
+class DXXAPI Interface
+{
+public:
+
+ Interface(const std::string &name);
+
+ virtual ~Interface();
+
+ inline const std::string &name() const;
+
+private:
+
+ std::string _name;
+};
+
+/*
+*/
+
+const std::string &Interface::name() const
+{
+ return _name;
+}
+
+/*
+*/
+
+typedef std::map< std::string, Slot<Message, const CallMessage &> > MethodTable;
+typedef std::map< std::string, Variant > PropertyDict;
+
+class DXXAPI InterfaceAdaptor : public Interface, public virtual AdaptorBase
+{
+public:
+
+ InterfaceAdaptor(const std::string &name);
+
+ Message dispatch_method(const CallMessage &);
+
+ void emit_signal(const SignalMessage &);
+
+ Variant *get_property(const std::string &name);
+
+ void set_property(const std::string &name, Variant &value);
+
+ PropertyDict *get_all_properties();
+
+ virtual const IntrospectedInterface *introspect() const
+ {
+ return NULL;
+ }
+
+protected:
+
+ MethodTable _methods;
+ PropertyTable _properties;
+};
+
+/*
+*/
+
+typedef std::map< std::string, Slot<void, const SignalMessage &> > SignalTable;
+
+class DXXAPI InterfaceProxy : public Interface, public virtual ProxyBase
+{
+public:
+
+ InterfaceProxy(const std::string &name);
+
+ Message invoke_method(const CallMessage &);
+
+ bool invoke_method_noreply(const CallMessage &call);
+
+ /*!
+ * \brief Perform a non-blocking method invocation.
+ * \details Queues a message to send, as with invoke_method(), but instead
+ * of blocking to wait for a reply, immediately returns a DBus::PendingCall
+ * used to receive the reply asynchronously.
+ *
+ * The PendingCall is owned by the caller, and must be disposed of using
+ * remove_pending_call().
+ */
+ PendingCall *invoke_method_async(const CallMessage &call, int timeout = -1);
+
+ bool dispatch_signal(const SignalMessage &);
+
+protected:
+ /*!
+ * \brief Deletes the supplied PendingCall without cancelling it.
+ * \param pending The PendingCall to be deleted.
+ */
+ void remove_pending_call(PendingCall *pending);
+
+ SignalTable _signals;
+};
+
+# define register_method(interface, method, callback) \
+ InterfaceAdaptor::_methods[ #method ] = \
+ new ::DBus::Callback< interface, ::DBus::Message, const ::DBus::CallMessage &>(this, & interface :: callback);
+
+# define bind_property(variable, type, can_read, can_write) \
+ InterfaceAdaptor::_properties[ #variable ].read = can_read; \
+ InterfaceAdaptor::_properties[ #variable ].write = can_write; \
+ InterfaceAdaptor::_properties[ #variable ].sig = type; \
+ variable.bind(InterfaceAdaptor::_properties[ #variable ]);
+
+# define connect_signal(interface, signal, callback) \
+ InterfaceProxy::_signals[ #signal ] = \
+ new ::DBus::Callback< interface, void, const ::DBus::SignalMessage &>(this, & interface :: callback);
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_INTERFACE_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/introspection.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/introspection.h
new file mode 100644
index 00000000000..d1bec4f4eb9
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/introspection.h
@@ -0,0 +1,86 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_INTROSPECTION_H
+#define __DBUSXX_INTROSPECTION_H
+
+#include "api.h"
+#include "interface.h"
+
+namespace DBus {
+
+struct DXXAPI IntrospectedArgument
+{
+ const char *name;
+ const char *type;
+ const bool in;
+};
+
+struct DXXAPI IntrospectedMethod
+{
+ const char *name;
+ const IntrospectedArgument *args;
+};
+
+struct DXXAPI IntrospectedProperty
+{
+ const char *name;
+ const char *type;
+ const bool read;
+ const bool write;
+};
+
+struct DXXAPI IntrospectedInterface
+{
+ const char *name;
+ const IntrospectedMethod *methods;
+ const IntrospectedMethod *signals;
+ const IntrospectedProperty *properties;
+};
+
+class DXXAPI IntrospectableAdaptor : public InterfaceAdaptor
+{
+public:
+
+ IntrospectableAdaptor();
+
+ Message Introspect(const CallMessage &);
+
+protected:
+
+ const IntrospectedInterface *introspect() const;
+};
+
+class DXXAPI IntrospectableProxy : public InterfaceProxy
+{
+public:
+
+ IntrospectableProxy();
+
+ std::string Introspect();
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_INTROSPECTION_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/message.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/message.h
new file mode 100644
index 00000000000..a1de8a9ea4d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/message.h
@@ -0,0 +1,331 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_MESSAGE_H
+#define __DBUSXX_MESSAGE_H
+
+#include <string>
+#include <map>
+
+#include "api.h"
+#include "util.h"
+
+namespace DBus {
+
+class Message;
+class ErrorMessage;
+class SignalMessage;
+class ReturnMessage;
+class Error;
+class Connection;
+class Tag;
+
+class DXXAPI MessageIter
+{
+public:
+
+ MessageIter();
+
+ ~MessageIter();
+
+ MessageIter(const MessageIter &iter);
+
+ MessageIter &operator =(const MessageIter &iter);
+
+ int type();
+
+ bool at_end();
+
+ bool has_next();
+
+ MessageIter &operator ++();
+
+ MessageIter operator ++(int);
+
+ bool append_byte(unsigned char byte);
+
+ unsigned char get_byte();
+
+ bool append_bool(bool b);
+
+ bool get_bool();
+
+ bool append_int16(signed short i);
+
+ signed short get_int16();
+
+ bool append_uint16(unsigned short u);
+
+ unsigned short get_uint16();
+
+ bool append_int32(signed int i);
+
+ signed int get_int32();
+
+ bool append_uint32(unsigned int u);
+
+ unsigned int get_uint32();
+
+ bool append_int64(signed long long i);
+
+ signed long long get_int64();
+
+ bool append_uint64(unsigned long long i);
+
+ unsigned long long get_uint64();
+
+ bool append_double(double d);
+
+ double get_double();
+
+ bool append_string(const char *chars);
+
+ const char *get_string();
+
+ bool append_path(const char *chars);
+
+ const char *get_path();
+
+ bool append_signature(const char *chars);
+
+ const char *get_signature();
+
+ char *signature() const; //returned string must be manually free()'d
+
+ int get_fd();
+
+ bool append_fd(int fd);
+
+ MessageIter recurse();
+
+ bool append_array(char type, const void *ptr, size_t length);
+
+ int array_type();
+
+ int get_array(void *ptr);
+
+ bool is_array();
+
+ bool is_dict();
+
+ MessageIter new_array(const char *sig);
+
+ MessageIter new_variant(const char *sig);
+
+ MessageIter new_struct();
+
+ MessageIter new_dict_entry();
+
+ void close_container(MessageIter &container);
+
+ void copy_data(MessageIter &to);
+
+ Message &msg() const
+ {
+ return *_msg;
+ }
+
+private:
+
+ DXXAPILOCAL MessageIter(Message &msg);
+
+ DXXAPILOCAL bool append_basic(int type_id, void *value);
+
+ DXXAPILOCAL void get_basic(int type_id, void *ptr);
+
+private:
+
+ struct Private;
+
+ Private *_pvt;
+
+ Message *_msg;
+
+friend class Message;
+};
+
+class DXXAPI Message
+{
+public:
+
+ struct Private;
+
+ Message(Private *, bool incref = true);
+
+ Message(const Message &m);
+
+ ~Message();
+
+ Message &operator = (const Message &m);
+
+ Message copy();
+
+ int type() const;
+
+ int serial() const;
+
+ int reply_serial() const;
+
+ bool reply_serial(int);
+
+ const char *sender() const;
+
+ bool sender(const char *s);
+
+ const char *destination() const;
+
+ bool destination(const char *s);
+
+ bool is_error() const;
+
+ bool is_signal(const char *interface, const char *member) const;
+
+ Tag *tag() const;
+
+ MessageIter reader() const;
+
+ MessageIter writer();
+
+ bool append(int first_type, ...);
+
+ void terminate();
+
+protected:
+
+ Message();
+
+protected:
+
+ RefPtrI<Private> _pvt;
+
+/* classes who need to read `_pvt` directly
+*/
+friend class ErrorMessage;
+friend class ReturnMessage;
+friend class MessageIter;
+friend class Error;
+friend class Connection;
+friend class TagMessage;
+};
+
+/*
+*/
+
+class DXXAPI ErrorMessage : public Message
+{
+public:
+
+ ErrorMessage();
+
+ ErrorMessage(const Message &, const char *name, const char *message);
+
+ const char *name() const;
+
+ bool name(const char *n);
+
+ bool operator == (const ErrorMessage &) const;
+};
+
+/*
+*/
+
+class DXXAPI SignalMessage : public Message
+{
+public:
+
+ SignalMessage(const char *name);
+
+ SignalMessage(const char *path, const char *interface, const char *name);
+
+ const char *interface() const;
+
+ bool interface(const char *i);
+
+ const char *member() const;
+
+ bool member(const char *m);
+
+ const char *path() const;
+
+ char ** path_split() const;
+
+ bool path(const char *p);
+
+ bool operator == (const SignalMessage &) const;
+};
+
+/*
+*/
+
+class DXXAPI CallMessage : public Message
+{
+public:
+
+ CallMessage();
+
+ CallMessage(const char *dest, const char *path, const char *iface, const char *method);
+
+ const char *interface() const;
+
+ bool interface(const char *i);
+
+ const char *member() const;
+
+ bool member(const char *m);
+
+ const char *path() const;
+
+ char ** path_split() const;
+
+ bool path(const char *p);
+
+ const char *signature() const;
+
+ bool operator == (const CallMessage &) const;
+};
+
+/*
+*/
+
+class DXXAPI TagMessage : public Message
+{
+public:
+ TagMessage(Tag *tag);
+};
+
+/*
+*/
+
+class DXXAPI ReturnMessage : public Message
+{
+public:
+
+ ReturnMessage(const CallMessage &callee);
+
+ const char *signature() const;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_MESSAGE_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/object.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/object.h
new file mode 100644
index 00000000000..0b20a927f86
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/object.h
@@ -0,0 +1,260 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_OBJECT_H
+#define __DBUSXX_OBJECT_H
+
+#include <string>
+#include <list>
+
+#include "api.h"
+#include "interface.h"
+#include "connection.h"
+#include "message.h"
+#include "types.h"
+
+namespace DBus {
+
+class DXXAPI Object
+{
+protected:
+
+ Object(Connection &conn, const Path &path, const char *service);
+
+public:
+
+ virtual ~Object();
+
+ inline const DBus::Path &path() const;
+
+ inline const std::string &service() const;
+
+ inline Connection &conn();
+
+protected:
+ virtual void register_obj() = 0;
+ virtual void unregister_obj() = 0;
+ virtual bool is_registered() = 0;
+
+private:
+
+ DXXAPILOCAL virtual bool handle_message(const Message &) = 0;
+
+private:
+
+ Connection _conn;
+ DBus::Path _path;
+ std::string _service;
+};
+
+/*
+*/
+
+Connection &Object::conn()
+{
+ return _conn;
+}
+
+const DBus::Path &Object::path() const
+{
+ return _path;
+}
+
+const std::string &Object::service() const
+{
+ return _service;
+}
+
+/*
+*/
+
+class DXXAPI Tag
+{
+public:
+
+ virtual ~Tag()
+ {}
+};
+
+/*
+*/
+
+class ObjectAdaptor;
+
+typedef std::list<ObjectAdaptor *> ObjectAdaptorPList;
+typedef std::list<std::string> ObjectPathList;
+
+class DXXAPI ObjectAdaptor : public Object, public virtual AdaptorBase
+{
+public:
+
+ static ObjectAdaptor *from_path(const Path &path);
+
+ static ObjectAdaptorPList from_path_prefix(const std::string &prefix);
+
+ static ObjectPathList child_nodes_from_prefix(const std::string &prefix);
+
+ struct Private;
+
+ enum registration_time {
+ REGISTER_NOW,
+ REGISTER_LATER,
+ };
+
+ enum exceptions_flag {
+ USE_EXCEPTIONS,
+ AVOID_EXCEPTIONS
+ };
+
+ ObjectAdaptor(Connection &conn, const Path &path);
+ ObjectAdaptor(Connection &conn, const Path &path, registration_time rtime);
+ ObjectAdaptor(Connection &conn, const Path &path, registration_time rtime,
+ exceptions_flag eflag);
+
+ ~ObjectAdaptor();
+
+ inline const ObjectAdaptor *object() const;
+
+protected:
+
+ class DXXAPI Continuation
+ {
+ public:
+
+ inline MessageIter &writer();
+
+ inline Tag *tag();
+
+ private:
+
+ Continuation(Connection &conn, const CallMessage &call, const Tag *tag);
+
+ Connection _conn;
+ CallMessage _call;
+ MessageIter _writer;
+ ReturnMessage _return;
+ const Tag *_tag;
+
+ friend class ObjectAdaptor;
+ };
+
+ void return_later(const Tag *tag);
+
+ void return_now(Continuation *ret);
+
+ void return_error(Continuation *ret, const Error error);
+
+ Continuation *find_continuation(const Tag *tag);
+
+ virtual void register_obj();
+ virtual void unregister_obj();
+ virtual bool is_registered();
+
+private:
+
+ void _emit_signal(SignalMessage &);
+
+ bool handle_message(const Message &);
+
+ typedef std::map<const Tag *, Continuation *> ContinuationMap;
+ ContinuationMap _continuations;
+
+ exceptions_flag _eflag;
+
+friend struct Private;
+};
+
+const ObjectAdaptor *ObjectAdaptor::object() const
+{
+ return this;
+}
+
+Tag *ObjectAdaptor::Continuation::tag()
+{
+ return const_cast<Tag *>(_tag);
+}
+
+MessageIter &ObjectAdaptor::Continuation::writer()
+{
+ return _writer;
+}
+
+/*
+*/
+
+class ObjectProxy;
+
+typedef std::list<ObjectProxy *> ObjectProxyPList;
+
+/*!
+ * \brief An ObjectProxy wraps a dbus object on which methods can
+ * be invoked and signals can be received.
+ *
+ * ObjectProxy objects should not be deleted while in a callback
+ * handling either a signal or a pending call reply. Doing so may
+ * result in a deadlock.
+ */
+class DXXAPI ObjectProxy : public Object, public virtual ProxyBase
+{
+public:
+
+ ObjectProxy(Connection &conn, const Path &path, const char *service = "");
+
+ ~ObjectProxy();
+
+ inline const ObjectProxy *object() const;
+
+private:
+
+ Message _invoke_method(CallMessage &);
+
+ bool _invoke_method_noreply(CallMessage &call);
+
+ PendingCall *_invoke_method_async(CallMessage &call, int timeout = -1);
+
+ bool handle_message(const Message &);
+
+protected:
+ virtual void register_obj();
+ virtual void unregister_obj();
+ virtual bool is_registered();
+ virtual void _remove_pending_call(PendingCall *pending);
+
+private:
+ void cancel_pending_calls();
+
+ MessageSlot _filtered;
+
+ typedef std::vector<PendingCall*> PendingCallList;
+ PendingCallList _pending_calls;
+};
+
+const ObjectProxy *ObjectProxy::object() const
+{
+ return this;
+}
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_OBJECT_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/pendingcall.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/pendingcall.h
new file mode 100644
index 00000000000..8bbb6208ba7
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/pendingcall.h
@@ -0,0 +1,149 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_PENDING_CALL_H
+#define __DBUSXX_PENDING_CALL_H
+
+#include "api.h"
+#include "util.h"
+#include "message.h"
+
+namespace DBus {
+
+class Connection;
+class PendingCall;
+
+typedef Slot<void, PendingCall *> AsyncReplyHandler;
+
+class DXXAPI PendingCall
+{
+public:
+
+ struct Private;
+
+ PendingCall(Private *);
+
+ PendingCall(const PendingCall &);
+
+ virtual ~PendingCall();
+
+ PendingCall &operator = (const PendingCall &);
+
+ /*!
+ * \brief Checks whether the pending call has received a reply yet, or not.
+ *
+ * \return true If a reply has been received.
+ */
+ bool completed();
+
+ /*!
+ * \brief Cancels the pending call, such that any reply or error received will
+ * just be ignored.
+ *
+ * Drops the dbus library's internal reference to the DBusPendingCall so will
+ * free the call if nobody else is holding a reference. However you usually
+ * get a reference from Connection::send_async() so probably your app
+ * owns a ref also.
+ *
+ * Note that canceling a pending call will not simulate a timed-out call; if a
+ * call times out, then a timeout error reply is received. If you cancel the
+ * call, no reply is received unless the the reply was already received before
+ * you cancelled.
+ */
+ void cancel();
+
+ /*!
+ * \brief Block until the pending call is completed.
+ *
+ * The blocking is as with Connection::send_blocking(); it
+ * does not enter the main loop or process other messages, it simply waits for
+ * the reply in question.
+ *
+ * If the pending call is already completed, this function returns immediately.
+ */
+ void block();
+
+ /*!
+ * \brief Stores a pointer on a PendingCall, along with an optional function to
+ * be used for freeing the data when the data is set again, or when the
+ * pending call is finalized.
+ *
+ * The slot is allocated automatically.
+ *
+ * \param data The data to store.
+ * \throw ErrorNoMemory
+ */
+ void data( void* data );
+
+ /*!
+ * \brief Retrieves data previously set with dbus_pending_call_set_data().
+ *
+ * The slot must still be allocated (must not have been freed).
+ *
+ * \return The data, or NULL if not found.
+ */
+ void *data();
+
+ /*!
+ * \return The reply handler slot.
+ */
+ AsyncReplyHandler& reply_handler();
+
+ /*!
+ * \brief Sets a callback to handle an asynchronous reply to a method
+ * invocation.
+ *
+ * If the pending call has not been cancelled, the supplied callback will
+ * be invoked when a reply is received. The callback is a templated
+ * class, where the two template arguments are the type of the single
+ * argument taken by the handler function, and the return type of that
+ * function.
+ *
+ * \param handler The callback.
+ */
+ void reply_handler(const AsyncReplyHandler& handler);
+
+ /*!
+ * \brief Gets the reply message
+ *
+ * Ownership of the reply message passes to the caller. This function can only
+ * be called once per pending call, since the reply message is tranferred to
+ * the caller.
+ *
+ * \return The reply Message.
+ * \throw ErrorNoReply
+ */
+ Message steal_reply();
+
+private:
+
+ RefPtrI<Private> _pvt;
+
+friend struct Private;
+friend class Connection;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_PENDING_CALL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/property.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/property.h
new file mode 100644
index 00000000000..8755d018c7a
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/property.h
@@ -0,0 +1,103 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_PROPERTY_H
+#define __DBUSXX_PROPERTY_H
+
+#include "api.h"
+#include "types.h"
+#include "interface.h"
+
+namespace DBus {
+
+template <typename T>
+class PropertyAdaptor
+{
+public:
+
+ PropertyAdaptor() : _data(0)
+ {}
+
+ void bind(PropertyData &data)
+ {
+ _data = &data;
+ }
+
+ T operator() (void) const
+ {
+ return (T)_data->value;
+ }
+
+ PropertyAdaptor &operator = (const T &t)
+ {
+ _data->value.clear();
+ MessageIter wi = _data->value.writer();
+ wi << t;
+ return *this;
+ }
+
+private:
+
+ PropertyData *_data;
+};
+
+struct IntrospectedInterface;
+
+class DXXAPI PropertiesAdaptor : public InterfaceAdaptor
+{
+public:
+
+ PropertiesAdaptor();
+
+ Message Get(const CallMessage &);
+
+ Message Set(const CallMessage &);
+
+ Message GetAll(const CallMessage &);
+
+protected:
+
+ virtual void on_get_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, Variant &/*value*/)
+ {}
+
+ virtual void on_set_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, const Variant &/*value*/)
+ {}
+
+ const IntrospectedInterface *introspect() const;
+};
+
+class DXXAPI PropertiesProxy : public InterfaceProxy
+{
+public:
+
+ PropertiesProxy();
+
+ Variant Get(const std::string &interface, const std::string &property);
+
+ void Set(const std::string &interface, const std::string &property, const Variant &value);
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_PROPERTY_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/refptr_impl.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/refptr_impl.h
new file mode 100644
index 00000000000..fc10cef8255
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/refptr_impl.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_REFPTR_IMPL_H
+#define __DBUSXX_REFPTR_IMPL_H
+
+#include "api.h"
+#include "util.h"
+
+namespace DBus {
+
+template <class T>
+RefPtrI<T>::RefPtrI(T *ptr)
+: __ptr(ptr)
+{}
+
+template <class T>
+RefPtrI<T>::~RefPtrI()
+{
+ if (__cnt.one()) delete __ptr;
+}
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_REFPTR_IMPL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/server.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/server.h
new file mode 100644
index 00000000000..9815bcdc536
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/server.h
@@ -0,0 +1,74 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_SERVER_H
+#define __DBUSXX_SERVER_H
+
+#include <list>
+
+#include "api.h"
+#include "error.h"
+#include "connection.h"
+#include "util.h"
+#include "dispatcher.h"
+
+namespace DBus {
+
+class Server;
+
+typedef std::list<Server> ServerList;
+
+class DXXAPI Server
+{
+public:
+
+ Server(const char *address);
+
+ Dispatcher *setup(Dispatcher *);
+
+ virtual ~Server();
+
+ bool listening() const;
+
+ bool operator == (const Server &) const;
+
+ void disconnect();
+
+ struct Private;
+
+protected:
+
+ Server(const Server &/*s*/)
+ {}
+
+ virtual void on_new_connection(Connection &c) = 0;
+
+private:
+
+ RefPtrI<Private> _pvt;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_SERVER_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/types.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/types.h
new file mode 100644
index 00000000000..a11149a7fca
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/types.h
@@ -0,0 +1,526 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_TYPES_H
+#define __DBUSXX_TYPES_H
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include <map>
+
+#include "api.h"
+#include "util.h"
+#include "message.h"
+#include "error.h"
+
+namespace DBus {
+
+struct DXXAPI Path : public std::string
+{
+ Path() {}
+ Path(const std::string &s) : std::string(s) {}
+ Path(const char *c) : std::string(c) {}
+ Path &operator = (std::string &s)
+ {
+ std::string::operator = (s);
+ return *this;
+ }
+};
+
+struct DXXAPI Signature : public std::string
+{
+ Signature() {}
+ Signature(const std::string &s) : std::string(s) {}
+ Signature(const char *c) : std::string(c) {}
+ Signature &operator = (std::string &s)
+ {
+ std::string::operator = (s);
+ return *this;
+ }
+};
+
+class DXXAPI FileDescriptor
+{
+public:
+ FileDescriptor() : _fd(-1) {}
+ FileDescriptor(int n) : _fd(n) {}
+ FileDescriptor &operator = (int fd)
+ {
+ _fd = fd;
+ return *this;
+ }
+ int get() const { return _fd; }
+private:
+ int _fd;
+};
+
+struct DXXAPI Invalid {};
+
+class DXXAPI Variant
+{
+public:
+
+ Variant();
+
+ Variant(MessageIter &it);
+
+ Variant &operator = (const Variant &v);
+
+ const Signature signature() const;
+
+ void clear();
+
+ MessageIter reader() const
+ {
+ return _msg.reader();
+ }
+
+ MessageIter writer()
+ {
+ return _msg.writer();
+ }
+
+ template <typename T>
+ operator T() const
+ {
+ T cast;
+ MessageIter ri = _msg.reader();
+ ri >> cast;
+ return cast;
+ }
+
+private:
+
+ Message _msg;
+};
+
+template <
+ typename T1,
+ typename T2 = Invalid,
+ typename T3 = Invalid,
+ typename T4 = Invalid,
+ typename T5 = Invalid,
+ typename T6 = Invalid,
+ typename T7 = Invalid,
+ typename T8 = Invalid // who needs more than eight?
+>
+struct Struct
+{
+ T1 _1; T2 _2; T3 _3; T4 _4; T5 _5; T6 _6; T7 _7; T8 _8;
+};
+
+template<typename K, typename V>
+inline bool dict_has_key(const std::map<K,V>& map, const K &key)
+{
+ return map.find(key) != map.end();
+}
+
+template <typename T>
+struct type
+{
+ static std::string sig()
+ {
+ throw ErrorInvalidArgs("unknown type");
+ return "";
+ }
+};
+
+template <> struct type<Variant> { static std::string sig(){ return "v"; } };
+template <> struct type<uint8_t> { static std::string sig(){ return "y"; } };
+template <> struct type<bool> { static std::string sig(){ return "b"; } };
+template <> struct type<int16_t> { static std::string sig(){ return "n"; } };
+template <> struct type<uint16_t> { static std::string sig(){ return "q"; } };
+template <> struct type<int32_t> { static std::string sig(){ return "i"; } };
+template <> struct type<uint32_t> { static std::string sig(){ return "u"; } };
+template <> struct type<int64_t> { static std::string sig(){ return "x"; } };
+template <> struct type<uint64_t> { static std::string sig(){ return "t"; } };
+template <> struct type<double> { static std::string sig(){ return "d"; } };
+template <> struct type<std::string> { static std::string sig(){ return "s"; } };
+template <> struct type<Path> { static std::string sig(){ return "o"; } };
+template <> struct type<Signature> { static std::string sig(){ return "g"; } };
+template <> struct type<Invalid> { static std::string sig(){ return ""; } };
+
+template <typename E>
+struct type< std::vector<E> >
+{ static std::string sig(){ return "a" + type<E>::sig(); } };
+
+template <typename K, typename V>
+struct type< std::map<K,V> >
+{ static std::string sig(){ return "a{" + type<K>::sig() + type<V>::sig() + "}"; } };
+
+template <
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8 // who needs more than eight?
+>
+struct type< Struct<T1,T2,T3,T4,T5,T6,T7,T8> >
+{
+ static std::string sig()
+ {
+ return "("
+ + type<T1>::sig()
+ + type<T2>::sig()
+ + type<T3>::sig()
+ + type<T4>::sig()
+ + type<T5>::sig()
+ + type<T6>::sig()
+ + type<T7>::sig()
+ + type<T8>::sig()
+ + ")";
+ }
+};
+
+} /* namespace DBus */
+
+extern DXXAPI DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Variant &val);
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Invalid &)
+{
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint8_t &val)
+{
+ iter.append_byte(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const bool &val)
+{
+ iter.append_bool(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int16_t& val)
+{
+ iter.append_int16(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint16_t& val)
+{
+ iter.append_uint16(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int32_t& val)
+{
+ iter.append_int32(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint32_t& val)
+{
+ iter.append_uint32(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const int64_t& val)
+{
+ iter.append_int64(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const uint64_t& val)
+{
+ iter.append_uint64(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const double &val)
+{
+ iter.append_double(val);
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::string &val)
+{
+ iter.append_string(val.c_str());
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Path &val)
+{
+ iter.append_path(val.c_str());
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Signature &val)
+{
+ iter.append_signature(val.c_str());
+ return iter;
+}
+
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::FileDescriptor &val)
+{
+ iter.append_fd(val.get());
+ return iter;
+}
+
+template<typename E>
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::vector<E>& val)
+{
+ const std::string sig = DBus::type<E>::sig();
+ DBus::MessageIter ait = iter.new_array(sig.c_str());
+
+ typename std::vector<E>::const_iterator vit;
+ for (vit = val.begin(); vit != val.end(); ++vit)
+ {
+ ait << *vit;
+ }
+
+ iter.close_container(ait);
+ return iter;
+}
+
+template<>
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::vector<uint8_t>& val)
+{
+ DBus::MessageIter ait = iter.new_array("y");
+ ait.append_array('y', &val.front(), val.size());
+ iter.close_container(ait);
+ return iter;
+}
+
+template<typename K, typename V>
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const std::map<K,V>& val)
+{
+ const std::string sig = "{" + DBus::type<K>::sig() + DBus::type<V>::sig() + "}";
+ DBus::MessageIter ait = iter.new_array(sig.c_str());
+
+ typename std::map<K,V>::const_iterator mit;
+ for (mit = val.begin(); mit != val.end(); ++mit)
+ {
+ DBus::MessageIter eit = ait.new_dict_entry();
+
+ eit << mit->first << mit->second;
+
+ ait.close_container(eit);
+ }
+
+ iter.close_container(ait);
+ return iter;
+}
+
+template <
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8
+>
+inline DBus::MessageIter &operator << (DBus::MessageIter &iter, const DBus::Struct<T1,T2,T3,T4,T5,T6,T7,T8>& val)
+{
+/* const std::string sig =
+ DBus::type<T1>::sig() + DBus::type<T2>::sig() + DBus::type<T3>::sig() + DBus::type<T4>::sig() +
+ DBus::type<T5>::sig() + DBus::type<T6>::sig() + DBus::type<T7>::sig() + DBus::type<T8>::sig();
+*/
+ DBus::MessageIter sit = iter.new_struct(/*sig.c_str()*/);
+
+ sit << val._1 << val._2 << val._3 << val._4 << val._5 << val._6 << val._7 << val._8;
+
+ iter.close_container(sit);
+
+ return iter;
+}
+
+/*
+ */
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Invalid &)
+{
+ return iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint8_t &val)
+{
+ val = iter.get_byte();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, bool &val)
+{
+ val = iter.get_bool();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int16_t& val)
+{
+ val = iter.get_int16();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint16_t& val)
+{
+ val = iter.get_uint16();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int32_t& val)
+{
+ val = iter.get_int32();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint32_t& val)
+{
+ val = iter.get_uint32();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, int64_t& val)
+{
+ val = iter.get_int64();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, uint64_t& val)
+{
+ val = iter.get_uint64();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, double &val)
+{
+ val = iter.get_double();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::string &val)
+{
+ val = iter.get_string();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Path &val)
+{
+ val = iter.get_path();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Signature &val)
+{
+ val = iter.get_signature();
+ return ++iter;
+}
+
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::FileDescriptor &val)
+{
+ val = iter.get_fd();
+ return ++iter;
+}
+
+template<typename E>
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::vector<E>& val)
+{
+ if (!iter.is_array())
+ throw DBus::ErrorInvalidArgs("array expected");
+
+ DBus::MessageIter ait = iter.recurse();
+
+ while (!ait.at_end())
+ {
+ E elem;
+
+ ait >> elem;
+
+ val.push_back(elem);
+ }
+ return ++iter;
+}
+
+template<>
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::vector<uint8_t>& val)
+{
+ if (!iter.is_array())
+ throw DBus::ErrorInvalidArgs("array expected");
+
+ if (iter.array_type() != 'y')
+ throw DBus::ErrorInvalidArgs("byte-array expected");
+
+ DBus::MessageIter ait = iter.recurse();
+
+ uint8_t *array;
+ size_t length = ait.get_array(&array);
+
+ val.insert(val.end(), array, array+length);
+
+ return ++iter;
+}
+
+template<typename K, typename V>
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, std::map<K,V>& val)
+{
+ if (!iter.is_dict())
+ throw DBus::ErrorInvalidArgs("dictionary value expected");
+
+ DBus::MessageIter mit = iter.recurse();
+
+ while (!mit.at_end())
+ {
+ K key; V value;
+
+ DBus::MessageIter eit = mit.recurse();
+
+ eit >> key >> value;
+
+ val[key] = value;
+
+ ++mit;
+ }
+
+ return ++iter;
+}
+
+template <
+ typename T1,
+ typename T2,
+ typename T3,
+ typename T4,
+ typename T5,
+ typename T6,
+ typename T7,
+ typename T8
+>
+inline DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Struct<T1,T2,T3,T4,T5,T6,T7,T8>& val)
+{
+ DBus::MessageIter sit = iter.recurse();
+
+ sit >> val._1 >> val._2 >> val._3 >> val._4 >> val._5 >> val._6 >> val._7 >> val._8;
+
+ return ++iter;
+}
+
+extern DXXAPI DBus::MessageIter &operator >> (DBus::MessageIter &iter, DBus::Variant &val);
+
+#endif//__DBUSXX_TYPES_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/util.h b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/util.h
new file mode 100644
index 00000000000..225e1cae65c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/include/dbus-c++/util.h
@@ -0,0 +1,273 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_UTIL_H
+#define __DBUSXX_UTIL_H
+
+#include "api.h"
+#include "debug.h"
+
+namespace DBus {
+
+/*
+ * Very simple reference counting
+ */
+
+class DXXAPI RefCnt
+{
+public:
+
+ RefCnt()
+ {
+ __ref = new int;
+ (*__ref) = 1;
+ }
+
+ RefCnt(const RefCnt &rc)
+ {
+ __ref = rc.__ref;
+ ref();
+ }
+
+ virtual ~RefCnt()
+ {
+ unref();
+ }
+
+ RefCnt &operator = (const RefCnt &ref)
+ {
+ ref.ref();
+ unref();
+ __ref = ref.__ref;
+ return *this;
+ }
+
+ bool noref() const
+ {
+ return (*__ref) == 0;
+ }
+
+ bool one() const
+ {
+ return (*__ref) == 1;
+ }
+
+private:
+
+ DXXAPILOCAL void ref() const
+ {
+ ++ (*__ref);
+ }
+ DXXAPILOCAL void unref() const
+ {
+ -- (*__ref);
+
+ if ((*__ref) < 0)
+ {
+ debug_log("%p: refcount dropped below zero!", __ref);
+ }
+
+ if (noref())
+ {
+ delete __ref;
+ }
+ }
+
+private:
+
+ int *__ref;
+};
+
+/*
+ * Reference counting pointers (emulate boost::shared_ptr)
+ */
+
+template <class T>
+class RefPtrI // RefPtr to incomplete type
+{
+public:
+
+ RefPtrI(T *ptr = 0);
+
+ ~RefPtrI();
+
+ RefPtrI &operator = (const RefPtrI &ref)
+ {
+ if (this != &ref)
+ {
+ if (__cnt.one()) delete __ptr;
+
+ __ptr = ref.__ptr;
+ __cnt = ref.__cnt;
+ }
+ return *this;
+ }
+
+ T &operator *() const
+ {
+ return *__ptr;
+ }
+
+ T *operator ->() const
+ {
+ if (__cnt.noref()) return 0;
+
+ return __ptr;
+ }
+
+ T *get() const
+ {
+ if (__cnt.noref()) return 0;
+
+ return __ptr;
+ }
+
+private:
+
+ T *__ptr;
+ RefCnt __cnt;
+};
+
+template <class T>
+class RefPtr
+{
+public:
+
+ RefPtr(T *ptr = 0)
+ : __ptr(ptr)
+ {}
+
+ ~RefPtr()
+ {
+ if (__cnt.one()) delete __ptr;
+ }
+
+ RefPtr &operator = (const RefPtr &ref)
+ {
+ if (this != &ref)
+ {
+ if (__cnt.one()) delete __ptr;
+
+ __ptr = ref.__ptr;
+ __cnt = ref.__cnt;
+ }
+ return *this;
+ }
+
+ T &operator *() const
+ {
+ return *__ptr;
+ }
+
+ T *operator ->() const
+ {
+ if (__cnt.noref()) return 0;
+
+ return __ptr;
+ }
+
+ T *get() const
+ {
+ if (__cnt.noref()) return 0;
+
+ return __ptr;
+ }
+
+private:
+
+ T *__ptr;
+ RefCnt __cnt;
+};
+
+/*
+ * Typed callback template
+ */
+
+template <class R, class P>
+class Callback_Base
+{
+public:
+
+ virtual R call(P param) const = 0;
+
+ virtual ~Callback_Base()
+ {}
+};
+
+template <class R, class P>
+class Slot
+{
+public:
+
+ Slot &operator = (Callback_Base<R,P>* s)
+ {
+ _cb = s;
+
+ return *this;
+ }
+
+ R operator()(P param) const
+ {
+ /*if (_cb.get())*/ return _cb->call(param);
+ }
+
+ R call(P param) const
+ {
+ /*if (_cb.get())*/ return _cb->call(param);
+ }
+
+ bool empty()
+ {
+ return _cb.get() == 0;
+ }
+
+private:
+
+ RefPtr< Callback_Base<R,P> > _cb;
+};
+
+template <class C, class R, class P>
+class Callback : public Callback_Base<R,P>
+{
+public:
+
+ typedef R (C::*M)(P);
+
+ Callback(C *c, M m)
+ : _c(c), _m(m)
+ {}
+
+ R call(P param) const
+ {
+ /*if (_c)*/ return (_c->*_m)(param);
+ }
+
+private:
+
+ C *_c; M _m;
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_UTIL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/inherit-review-settings-ok b/chromium/third_party/cros_dbus_cplusplus/source/inherit-review-settings-ok
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/inherit-review-settings-ok
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/libdbus-c++.spec.in b/chromium/third_party/cros_dbus_cplusplus/source/libdbus-c++.spec.in
new file mode 100644
index 00000000000..4b2db1ebb41
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/libdbus-c++.spec.in
@@ -0,0 +1,63 @@
+
+
+
+
+Summary: C++ Interface for DBus
+Name: libdbus-c++
+Version: @PACKAGE_VERSION@
+Release: 70001
+URL: http://dev.openwengo.org/trac/openwengo/trac.fcgi/browser/wengophone-ng/branches/wengophone-dbus-api/libs/dbus/src
+Source0: %{name}-%{version}.tar.gz
+License: LGPL
+Group: Libraries
+BuildRoot: %{_tmppath}/%{name}-root
+Prefix: /usr
+
+%description
+
+Ability to reflect dbus methods and signals into a more natural C++ object system.
+
+%package devel
+Requires: libdbus-c++ = %{version}
+Group: Development/Libraries
+Summary: Header files for libdbus-c++
+
+%description devel
+Header files for libdbus-c++
+
+
+%prep
+%setup -q
+
+%build
+./configure --prefix=/usr
+make -j 4
+
+%install
+make prefix=$RPM_BUILD_ROOT%{prefix} install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(755,root,root)
+%{prefix}/lib/libdbus-c++*.so*
+
+
+
+%files devel
+%defattr(-,root,root)
+%{prefix}/bin/dbusxx-xml2cpp
+%{prefix}/bin/dbusxx-introspect
+%{prefix}/lib/libdbus-c*.a
+%{prefix}/lib/libdbus-c*.la
+%{prefix}/include/dbus-c++-1
+%{prefix}/lib/pkgconfig/*.pc
+
+%changelog
+* Thu Feb 8 2007 Ben Martin
+- initial spec file
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/src/Makefile.am
new file mode 100644
index 00000000000..709ba19d675
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/Makefile.am
@@ -0,0 +1,49 @@
+AM_CPPFLAGS = \
+ $(dbus_CFLAGS) \
+ $(glib_CFLAGS) \
+ $(ecore_CFLAGS) \
+ $(PRIVATE_CFLAGS) \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include
+
+if ENABLE_GLIB
+GLIB_H = $(HEADER_DIR)/glib-integration.h
+GLIB_CPP = glib-integration.cpp
+endif
+
+if ENABLE_ECORE
+ECORE_H = $(HEADER_DIR)/ecore-integration.h
+ECORE_CPP = ecore-integration.cpp
+endif
+
+HEADER_DIR = $(top_srcdir)/include/dbus-c++
+HEADER_FILES = \
+ $(HEADER_DIR)/dbus.h \
+ $(HEADER_DIR)/types.h \
+ $(HEADER_DIR)/connection.h \
+ $(HEADER_DIR)/property.h \
+ $(HEADER_DIR)/debug.h \
+ $(HEADER_DIR)/error.h \
+ $(HEADER_DIR)/interface.h \
+ $(HEADER_DIR)/message.h \
+ $(HEADER_DIR)/dispatcher.h \
+ $(HEADER_DIR)/object.h \
+ $(HEADER_DIR)/pendingcall.h \
+ $(HEADER_DIR)/server.h \
+ $(HEADER_DIR)/util.h \
+ $(HEADER_DIR)/refptr_impl.h \
+ $(HEADER_DIR)/introspection.h \
+ $(HEADER_DIR)/api.h \
+ $(HEADER_DIR)/eventloop.h \
+ $(HEADER_DIR)/eventloop-integration.h \
+ $(GLIB_H) $(ECORE_H)
+
+lib_includedir=$(includedir)/dbus-c++-1/dbus-c++/
+lib_include_HEADERS = $(HEADER_FILES)
+
+lib_LTLIBRARIES = libdbus-c++-1.la
+libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h eventloop.cpp eventloop-integration.cpp $(GLIB_CPP) $(ECORE_CPP)
+libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(glib_LIBS) $(pthread_LIBS) $(ecore_LIBS)
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/connection.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/connection.cpp
new file mode 100644
index 00000000000..9b5bc5960a9
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/connection.cpp
@@ -0,0 +1,465 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+#include <dbus-c++/connection.h>
+
+#include <dbus/dbus.h>
+#include <string>
+
+#include "internalerror.h"
+
+#include "connection_p.h"
+#include "dispatcher_p.h"
+#include "server_p.h"
+#include "message_p.h"
+#include "pendingcall_p.h"
+
+using namespace DBus;
+
+Connection::Private::Private(DBusConnection *c, Server::Private *s)
+: conn(c) , dispatcher(0), server(s)
+{
+ init();
+}
+
+Connection::Private::Private(DBusBusType type)
+{
+ InternalError e;
+
+ conn = dbus_bus_get_private(type, e);
+
+ if (e) throw Error(e);
+
+ init();
+}
+
+Connection::Private::~Private()
+{
+ debug_log("terminating connection 0x%08x", conn);
+
+ detach_server();
+
+ if (dbus_connection_get_is_connected(conn))
+ {
+ std::vector<std::string>::iterator i = names.begin();
+
+ while (i != names.end())
+ {
+ debug_log("%s: releasing bus name %s", dbus_bus_get_unique_name(conn), i->c_str());
+ dbus_bus_release_name(conn, i->c_str(), NULL);
+ ++i;
+ }
+ dbus_connection_close(conn);
+ }
+ dbus_connection_unref(conn);
+}
+
+void Connection::Private::init()
+{
+ dbus_connection_ref(conn);
+ dbus_connection_ref(conn); //todo: the library has to own another reference
+
+ disconn_filter = new Callback<Connection::Private, bool, const Message &>(
+ this, &Connection::Private::disconn_filter_function
+ );
+
+ dbus_connection_add_filter(conn, message_filter_stub, &disconn_filter, NULL); // TODO: some assert at least
+
+ dbus_connection_set_dispatch_status_function(conn, dispatch_status_stub, this, 0);
+ dbus_connection_set_exit_on_disconnect(conn, false); //why was this set to true??
+}
+
+void Connection::Private::detach_server()
+{
+/* Server::Private *tmp = server;
+
+ server = NULL;
+
+ if (tmp)
+ {
+ ConnectionList::iterator i;
+
+ for (i = tmp->connections.begin(); i != tmp->connections.end(); ++i)
+ {
+ if (i->_pvt.get() == this)
+ {
+ tmp->connections.erase(i);
+ break;
+ }
+ }
+ }*/
+}
+
+bool Connection::Private::do_dispatch()
+{
+ debug_log("dispatching on %p", conn);
+
+ if (!dbus_connection_get_is_connected(conn))
+ {
+ debug_log("connection terminated");
+
+ detach_server();
+
+ return true;
+ }
+
+ return dbus_connection_dispatch(conn) != DBUS_DISPATCH_DATA_REMAINS;
+}
+
+void Connection::Private::dispatch_status_stub(DBusConnection *dc, DBusDispatchStatus status, void *data)
+{
+ Private *p = static_cast<Private *>(data);
+
+ switch (status)
+ {
+ case DBUS_DISPATCH_DATA_REMAINS:
+ debug_log("some dispatching to do on %p", dc);
+ p->dispatcher->queue_connection(p);
+ break;
+
+ case DBUS_DISPATCH_COMPLETE:
+ debug_log("all dispatching done on %p", dc);
+ break;
+
+ case DBUS_DISPATCH_NEED_MEMORY: //uh oh...
+ debug_log("connection %p needs memory", dc);
+ break;
+ }
+}
+
+DBusHandlerResult Connection::Private::message_filter_stub(DBusConnection *conn, DBusMessage *dmsg, void *data)
+{
+ MessageSlot *slot = static_cast<MessageSlot *>(data);
+
+ Message msg = Message(new Message::Private(dmsg));
+
+ return slot && !slot->empty() && slot->call(msg)
+ ? DBUS_HANDLER_RESULT_HANDLED
+ : DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+bool Connection::Private::disconn_filter_function(const Message &msg)
+{
+ if (msg.is_signal(DBUS_INTERFACE_LOCAL,"Disconnected"))
+ {
+ debug_log("%p disconnected by local bus", conn);
+ dbus_connection_close(conn);
+
+ return true;
+ }
+ return false;
+}
+
+DBusDispatchStatus Connection::Private::dispatch_status()
+{
+ return dbus_connection_get_dispatch_status(conn);
+}
+
+bool Connection::Private::has_something_to_dispatch()
+{
+ return dispatch_status() == DBUS_DISPATCH_DATA_REMAINS;
+}
+
+
+Connection Connection::SystemBus()
+{
+ return Connection(new Private(DBUS_BUS_SYSTEM));
+}
+
+Connection Connection::SessionBus()
+{
+ return Connection(new Private(DBUS_BUS_SESSION));
+}
+
+Connection Connection::ActivationBus()
+{
+ return Connection(new Private(DBUS_BUS_STARTER));
+}
+
+Connection::Connection(const char *address, bool priv)
+: _timeout(-1)
+{
+ InternalError e;
+ DBusConnection *conn = priv
+ ? dbus_connection_open_private(address, e)
+ : dbus_connection_open(address, e);
+
+ if (e) throw Error(e);
+
+ _pvt = new Private(conn);
+
+ setup(default_dispatcher);
+
+ debug_log("connected to %s", address);
+}
+
+Connection::Connection(Connection::Private *p)
+: _pvt(p), _timeout(-1)
+{
+ setup(default_dispatcher);
+}
+
+Connection::Connection(const Connection &c)
+: _pvt(c._pvt),_timeout(c._timeout)
+{
+ dbus_connection_ref(_pvt->conn);
+}
+
+Connection::~Connection()
+{
+ dbus_connection_unref(_pvt->conn);
+}
+
+Dispatcher *Connection::setup(Dispatcher *dispatcher)
+{
+ debug_log("registering stubs for connection %p", _pvt->conn);
+
+ if (!dispatcher) dispatcher = default_dispatcher;
+
+ if (!dispatcher) throw ErrorFailed("no default dispatcher set for new connection");
+
+ Dispatcher *prev = _pvt->dispatcher;
+
+ _pvt->dispatcher = dispatcher;
+
+ dispatcher->queue_connection(_pvt.get());
+
+ dbus_connection_set_watch_functions(
+ _pvt->conn,
+ Dispatcher::Private::on_add_watch,
+ Dispatcher::Private::on_rem_watch,
+ Dispatcher::Private::on_toggle_watch,
+ dispatcher,
+ 0
+ );
+
+ dbus_connection_set_timeout_functions(
+ _pvt->conn,
+ Dispatcher::Private::on_add_timeout,
+ Dispatcher::Private::on_rem_timeout,
+ Dispatcher::Private::on_toggle_timeout,
+ dispatcher,
+ 0
+ );
+
+ return prev;
+}
+
+bool Connection::operator == (const Connection &c) const
+{
+ return _pvt->conn == c._pvt->conn;
+}
+
+bool Connection::register_bus()
+{
+ InternalError e;
+
+ bool r = dbus_bus_register(_pvt->conn, e);
+
+ if (e) throw (e);
+
+ return r;
+}
+
+bool Connection::connected() const
+{
+ return dbus_connection_get_is_connected(_pvt->conn);
+}
+
+void Connection::disconnect()
+{
+// dbus_connection_disconnect(_pvt->conn); // disappeared in 0.9x
+ dbus_connection_close(_pvt->conn);
+}
+
+void Connection::exit_on_disconnect(bool exit)
+{
+ dbus_connection_set_exit_on_disconnect(_pvt->conn, exit);
+}
+
+bool Connection::unique_name(const char *n)
+{
+ return dbus_bus_set_unique_name(_pvt->conn, n);
+}
+
+const char *Connection::unique_name() const
+{
+ return dbus_bus_get_unique_name(_pvt->conn);
+}
+
+void Connection::flush()
+{
+ dbus_connection_flush(_pvt->conn);
+}
+
+void Connection::add_match(const char *rule)
+{
+ InternalError e;
+
+ dbus_bus_add_match(_pvt->conn, rule, e);
+
+ debug_log("%s: added match rule %s", unique_name(), rule);
+
+ if (e) throw Error(e);
+}
+
+void Connection::remove_match(const char *rule)
+{
+ InternalError e;
+
+ dbus_bus_remove_match(_pvt->conn, rule, e);
+
+ debug_log("%s: removed match rule %s", unique_name(), rule);
+
+ if (e) throw Error(e);
+}
+
+bool Connection::add_filter(MessageSlot &s)
+{
+ debug_log("%s: adding filter", unique_name());
+ return dbus_connection_add_filter(_pvt->conn, Private::message_filter_stub, &s, NULL);
+}
+
+void Connection::remove_filter(MessageSlot &s)
+{
+ debug_log("%s: removing filter", unique_name());
+ dbus_connection_remove_filter(_pvt->conn, Private::message_filter_stub, &s);
+}
+
+bool Connection::send(const Message &msg, unsigned int *serial)
+{
+ return dbus_connection_send(_pvt->conn, msg._pvt->msg, serial);
+}
+
+Message Connection::send_blocking(Message &msg, int timeout)
+{
+ DBusMessage *reply;
+ InternalError e;
+
+ if (this->_timeout != -1)
+ {
+ reply = dbus_connection_send_with_reply_and_block(_pvt->conn, msg._pvt->msg, this->_timeout, e);
+ }
+ else
+ {
+ reply = dbus_connection_send_with_reply_and_block(_pvt->conn, msg._pvt->msg, timeout, e);
+ }
+
+ if (e) throw Error(e);
+
+ return Message(new Message::Private(reply), false);
+}
+
+PendingCall *Connection::send_async(Message &msg, int timeout)
+{
+ DBusPendingCall *pending;
+
+ // TODO(ers) At the moment using a timeout other than -1
+ // results in a deadlock if the timeout expires.
+ if (!dbus_connection_send_with_reply(_pvt->conn, msg._pvt->msg, &pending, timeout))
+ {
+ throw ErrorNoMemory("Unable to start asynchronous call");
+ }
+ return new PendingCall(new PendingCall::Private(pending));
+}
+
+void Connection::request_name(const char *name, int flags)
+{
+ InternalError e;
+
+ debug_log("%s: registering bus name %s", unique_name(), name);
+
+ /*
+ * TODO:
+ * Think about giving back the 'ret' value. Some people on the list
+ * requested about this...
+ */
+ int ret = dbus_bus_request_name(_pvt->conn, name, flags, e);
+
+ if (ret == -1)
+ {
+ if (e) throw Error(e);
+ }
+
+// this->remove_match("destination");
+
+ if (name)
+ {
+ _pvt->names.push_back(name);
+ std::string match = "destination='" + _pvt->names.back() + "'";
+ add_match(match.c_str());
+ }
+}
+
+unsigned long Connection::sender_unix_uid(const char *sender)
+{
+ InternalError e;
+
+ unsigned long ul = dbus_bus_get_unix_user(_pvt->conn, sender, e);
+
+ if (e) throw Error(e);
+
+ return ul;
+}
+
+bool Connection::has_name(const char *name)
+{
+ InternalError e;
+
+ bool b = dbus_bus_name_has_owner(_pvt->conn, name, e);
+
+ if (e) throw Error(e);
+
+ return b;
+}
+
+const std::vector<std::string>& Connection::names()
+{
+ return _pvt->names;
+}
+
+bool Connection::start_service(const char *name, unsigned long flags)
+{
+ InternalError e;
+
+ bool b = dbus_bus_start_service_by_name(_pvt->conn, name, flags, NULL, e);
+
+ if (e) throw Error(e);
+
+ return b;
+}
+
+void Connection::set_timeout(int timeout)
+{
+ _timeout=timeout;
+}
+
+int Connection::get_timeout()
+{
+ return _timeout;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/connection_p.h b/chromium/third_party/cros_dbus_cplusplus/source/src/connection_p.h
new file mode 100644
index 00000000000..a6ea96cdd07
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/connection_p.h
@@ -0,0 +1,76 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_CONNECTION_P_H
+#define __DBUSXX_CONNECTION_P_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/connection.h>
+#include <dbus-c++/server.h>
+#include <dbus-c++/dispatcher.h>
+#include <dbus-c++/refptr_impl.h>
+
+#include <dbus/dbus.h>
+
+#include <string>
+
+namespace DBus {
+
+struct DXXAPILOCAL Connection::Private
+{
+ DBusConnection * conn;
+
+ std::vector<std::string> names;
+
+ Dispatcher *dispatcher;
+ bool do_dispatch();
+
+ MessageSlot disconn_filter;
+ bool disconn_filter_function(const Message &);
+
+ Server::Private *server;
+ void detach_server();
+
+ Private(DBusConnection *, Server::Private * = NULL);
+
+ Private(DBusBusType);
+
+ ~Private();
+
+ void init();
+
+ DBusDispatchStatus dispatch_status();
+ bool has_something_to_dispatch();
+
+ static void dispatch_status_stub(DBusConnection *, DBusDispatchStatus, void *);
+
+ static DBusHandlerResult message_filter_stub(DBusConnection *, DBusMessage *, void *);
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_CONNECTION_P_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/debug.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/debug.cpp
new file mode 100644
index 00000000000..4f97dae2ddc
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/debug.cpp
@@ -0,0 +1,56 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+
+#include <stdarg.h>
+#include <cstdio>
+#include <stdlib.h>
+
+static void _debug_log_default(const char *format, ...)
+{
+#ifdef DEBUG
+
+ static int debug_env = getenv("DBUSXX_VERBOSE") ? 1 : 0;
+
+ if (debug_env)
+ {
+ va_list args;
+ va_start(args, format);
+
+ fprintf(stderr, "dbus-c++: ");
+ vfprintf(stderr, format, args);
+ fprintf(stderr, "\n");
+
+ va_end(args);
+ }
+
+#endif//DEBUG
+}
+
+DBus::LogFunction DBus::debug_log = _debug_log_default;
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher.cpp
new file mode 100644
index 00000000000..37bd2790b1b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher.cpp
@@ -0,0 +1,279 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cassert>
+
+#include <dbus-c++/dispatcher.h>
+
+#include <dbus/dbus.h>
+
+#include "dispatcher_p.h"
+#include "server_p.h"
+#include "connection_p.h"
+
+DBus::Dispatcher *DBus::default_dispatcher = NULL;
+
+using namespace DBus;
+
+Timeout::Timeout(Timeout::Internal *i)
+: _int(i)
+{
+ dbus_timeout_set_data((DBusTimeout *)i, this, NULL);
+}
+
+int Timeout::interval() const
+{
+ return dbus_timeout_get_interval((DBusTimeout *)_int);
+}
+
+bool Timeout::enabled() const
+{
+ return dbus_timeout_get_enabled((DBusTimeout *)_int);
+}
+
+bool Timeout::handle()
+{
+ return dbus_timeout_handle((DBusTimeout *)_int);
+}
+
+/*
+*/
+
+Watch::Watch(Watch::Internal *i)
+: _int(i)
+{
+ dbus_watch_set_data((DBusWatch *)i, this, NULL);
+}
+
+int Watch::descriptor() const
+{
+#if HAVE_WIN32
+ return dbus_watch_get_socket((DBusWatch*)_int);
+#else
+ return dbus_watch_get_unix_fd((DBusWatch*)_int);
+#endif
+}
+
+int Watch::flags() const
+{
+ return dbus_watch_get_flags((DBusWatch *)_int);
+}
+
+bool Watch::enabled() const
+{
+ return dbus_watch_get_enabled((DBusWatch *)_int);
+}
+
+bool Watch::handle(int flags)
+{
+ return dbus_watch_handle((DBusWatch *)_int, flags);
+}
+
+/*
+*/
+
+dbus_bool_t Dispatcher::Private::on_add_watch(DBusWatch *watch, void *data)
+{
+ Dispatcher *d = static_cast<Dispatcher *>(data);
+
+ Watch::Internal *w = reinterpret_cast<Watch::Internal *>(watch);
+
+ d->add_watch(w);
+
+ return true;
+}
+
+void Dispatcher::Private::on_rem_watch(DBusWatch *watch, void *data)
+{
+ Dispatcher *d = static_cast<Dispatcher *>(data);
+
+ Watch *w = static_cast<Watch *>(dbus_watch_get_data(watch));
+
+ d->rem_watch(w);
+}
+
+void Dispatcher::Private::on_toggle_watch(DBusWatch *watch, void *data)
+{
+ Watch *w = static_cast<Watch *>(dbus_watch_get_data(watch));
+
+ w->toggle();
+}
+
+dbus_bool_t Dispatcher::Private::on_add_timeout(DBusTimeout *timeout, void *data)
+{
+ Dispatcher *d = static_cast<Dispatcher *>(data);
+
+ Timeout::Internal *t = reinterpret_cast<Timeout::Internal *>(timeout);
+
+ d->add_timeout(t);
+
+ return true;
+}
+
+void Dispatcher::Private::on_rem_timeout(DBusTimeout *timeout, void *data)
+{
+ Dispatcher *d = static_cast<Dispatcher *>(data);
+
+ Timeout *t = static_cast<Timeout *>(dbus_timeout_get_data(timeout));
+
+ d->rem_timeout(t);
+}
+
+void Dispatcher::Private::on_toggle_timeout(DBusTimeout *timeout, void *data)
+{
+ Timeout *t = static_cast<Timeout *>(dbus_timeout_get_data(timeout));
+
+ t->toggle();
+}
+
+void Dispatcher::queue_connection(Connection::Private *cp)
+{
+ _mutex_p.lock();
+ _pending_queue.push_back(cp);
+ _mutex_p.unlock();
+}
+
+
+bool Dispatcher::has_something_to_dispatch()
+{
+ _mutex_p.lock();
+ bool has_something = false;
+ for(Connection::PrivatePList::iterator it = _pending_queue.begin();
+ it != _pending_queue.end() && !has_something;
+ ++it)
+ {
+ has_something = (*it)->has_something_to_dispatch();
+ }
+
+ _mutex_p.unlock();
+ return has_something;
+}
+
+
+void Dispatcher::dispatch_pending()
+{
+ _mutex_p.lock();
+
+ // Reentrancy is not permitted for this function
+ assert(!_dispatching);
+ _dispatching = true;
+
+ // SEEME: dbus-glib is dispatching only one message at a time to not starve the loop/other things...
+
+ while (_pending_queue.size() > 0)
+ {
+ Connection::PrivatePList::iterator i, j;
+ i = _pending_queue.begin();
+ while (i != _pending_queue.end())
+ {
+ j = i;
+ ++j;
+ _mutex_p.unlock();
+ bool done = (*i)->do_dispatch();
+ _mutex_p.lock();
+ if (done)
+ _pending_queue.erase(i);
+
+ i = j;
+ }
+ }
+ _dispatching = false;
+ _mutex_p.unlock();
+}
+
+void DBus::_init_threading()
+{
+#ifdef DBUS_HAS_THREADS_INIT_DEFAULT
+ dbus_threads_init_default();
+#else
+ debug_log("Thread support is not enabled! Your D-Bus version is too old!");
+#endif//DBUS_HAS_THREADS_INIT_DEFAULT
+}
+
+void DBus::_init_threading(
+ MutexNewFn m1,
+ MutexFreeFn m2,
+ MutexLockFn m3,
+ MutexUnlockFn m4,
+ CondVarNewFn c1,
+ CondVarFreeFn c2,
+ CondVarWaitFn c3,
+ CondVarWaitTimeoutFn c4,
+ CondVarWakeOneFn c5,
+ CondVarWakeAllFn c6
+)
+{
+#ifndef DBUS_HAS_RECURSIVE_MUTEX
+ DBusThreadFunctions functions = {
+ DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK |
+ DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK |
+ DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK |
+ DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK|
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK,
+ (DBusMutexNewFunction) m1,
+ (DBusMutexFreeFunction) m2,
+ (DBusMutexLockFunction) m3,
+ (DBusMutexUnlockFunction) m4,
+ (DBusCondVarNewFunction) c1,
+ (DBusCondVarFreeFunction) c2,
+ (DBusCondVarWaitFunction) c3,
+ (DBusCondVarWaitTimeoutFunction) c4,
+ (DBusCondVarWakeOneFunction) c5,
+ (DBusCondVarWakeAllFunction) c6
+ };
+#else
+ DBusThreadFunctions functions = {
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK |
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK |
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK |
+ DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK |
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK|
+ DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK,
+ 0, 0, 0, 0,
+ (DBusCondVarNewFunction) c1,
+ (DBusCondVarFreeFunction) c2,
+ (DBusCondVarWaitFunction) c3,
+ (DBusCondVarWaitTimeoutFunction) c4,
+ (DBusCondVarWakeOneFunction) c5,
+ (DBusCondVarWakeAllFunction) c6,
+ (DBusRecursiveMutexNewFunction) m1,
+ (DBusRecursiveMutexFreeFunction) m2,
+ (DBusRecursiveMutexLockFunction) m3,
+ (DBusRecursiveMutexUnlockFunction) m4
+ };
+#endif//DBUS_HAS_RECURSIVE_MUTEX
+ dbus_threads_init(&functions);
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher_p.h b/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher_p.h
new file mode 100644
index 00000000000..33c0cac3906
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/dispatcher_p.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_DISPATCHER_P_H
+#define __DBUSXX_DISPATCHER_P_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/dispatcher.h>
+
+#include <dbus/dbus.h>
+
+#include "internalerror.h"
+
+namespace DBus {
+
+struct DXXAPILOCAL Dispatcher::Private
+{
+ static dbus_bool_t on_add_watch(DBusWatch *watch, void *data);
+
+ static void on_rem_watch(DBusWatch *watch, void *data);
+
+ static void on_toggle_watch(DBusWatch *watch, void *data);
+
+ static dbus_bool_t on_add_timeout(DBusTimeout *timeout, void *data);
+
+ static void on_rem_timeout(DBusTimeout *timeout, void *data);
+
+ static void on_toggle_timeout(DBusTimeout *timeout, void *data);
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_DISPATCHER_P_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/ecore-integration.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/ecore-integration.cpp
new file mode 100644
index 00000000000..e530e060513
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/ecore-integration.cpp
@@ -0,0 +1,213 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/ecore-integration.h>
+
+#include <dbus/dbus.h> // for DBUS_WATCH_*
+
+using namespace DBus;
+
+Ecore::BusTimeout::BusTimeout( Timeout::Internal* ti)
+: Timeout(ti)
+{
+ _enable();
+}
+
+Ecore::BusTimeout::~BusTimeout()
+{
+ _disable();
+}
+
+void Ecore::BusTimeout::toggle()
+{
+ debug_log("ecore: timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off");
+
+ if(Timeout::enabled()) _enable();
+ else _disable();
+}
+
+int Ecore::BusTimeout::timeout_handler( void *data )
+{
+ Ecore::BusTimeout* t = reinterpret_cast<Ecore::BusTimeout*>(data);
+
+ debug_log("Ecore::BusTimeout::timeout_handler( void *data )");
+
+ t->handle();
+
+ return 1; // 1 -> reshedule in ecore for next timer interval
+}
+
+void Ecore::BusTimeout::_enable()
+{
+ debug_log("Ecore::BusTimeout::_enable()");
+
+ _etimer = ecore_timer_add (((double)Timeout::interval())/1000, timeout_handler, this);
+}
+
+void Ecore::BusTimeout::_disable()
+{
+ debug_log("Ecore::BusTimeout::_disable()");
+
+ ecore_timer_del (_etimer);
+}
+
+/*static bool watch_prepare( int *timeout )
+{
+ debug_log("ecore: watch_prepare");
+
+ *timeout = -1;
+ return false;
+}*/
+
+/*static bool watch_check( )
+{
+ debug_log("ecore: watch_check");
+
+ return true;
+}*/
+
+static bool watch_dispatch( void *data )
+{
+ debug_log("ecore: watch_dispatch");
+
+ bool cb = true;
+ DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers
+ return cb;
+}
+
+Ecore::BusWatch::BusWatch( Watch::Internal* wi)
+: Watch(wi)
+{
+ _enable();
+}
+
+Ecore::BusWatch::~BusWatch()
+{
+ _disable();
+}
+
+void Ecore::BusWatch::toggle()
+{
+ debug_log("ecore: watch %p toggled (%s)", this, Watch::enabled() ? "on":"off");
+
+ if(Watch::enabled()) _enable();
+ else _disable();
+}
+
+int Ecore::BusWatch::watch_handler_read( void *data, Ecore_Fd_Handler *fdh )
+{
+ Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
+
+ debug_log("ecore: watch_handler_read");
+
+ int flags = DBUS_WATCH_READABLE;
+
+ watch_dispatch(NULL);
+
+ w->handle(flags);
+
+ return 1;
+}
+
+int Ecore::BusWatch::watch_handler_error( void *data, Ecore_Fd_Handler *fdh )
+{
+ //Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
+
+ debug_log("ecore: watch_handler_error");
+
+ //int flags = DBUS_WATCH_ERROR;
+
+ watch_dispatch(NULL);
+
+ return 1;
+}
+
+void Ecore::BusWatch::_enable()
+{
+ debug_log("Ecore::BusWatch::_enable()");
+
+ //int flags = Watch::flags();
+
+ fd_handler_read = ecore_main_fd_handler_add (Watch::descriptor(),
+ ECORE_FD_READ,
+ watch_handler_read,
+ this,
+ NULL, NULL);
+
+ ecore_main_fd_handler_active_set(fd_handler_read, ECORE_FD_READ);
+
+ fd_handler_error = ecore_main_fd_handler_add (Watch::descriptor(),
+ ECORE_FD_ERROR,
+ watch_handler_error,
+ this,
+ NULL, NULL);
+
+ ecore_main_fd_handler_active_set(fd_handler_error, ECORE_FD_ERROR);
+}
+
+void Ecore::BusWatch::_disable()
+{
+ ecore_main_fd_handler_del (fd_handler_read);
+ ecore_main_fd_handler_del (fd_handler_error);
+}
+
+void Ecore::BusDispatcher::attach( )
+{
+}
+
+Timeout* Ecore::BusDispatcher::add_timeout( Timeout::Internal* wi )
+{
+ Timeout* t = new Ecore::BusTimeout( wi );
+
+ debug_log("ecore: added timeout %p (%s)", t, t->enabled() ? "on":"off");
+
+ return t;
+}
+
+void Ecore::BusDispatcher::rem_timeout( Timeout* t )
+{
+ debug_log("ecore: removed timeout %p", t);
+
+ delete t;
+}
+
+Watch* Ecore::BusDispatcher::add_watch( Watch::Internal* wi )
+{
+ Watch* w = new Ecore::BusWatch(wi);
+
+ debug_log("ecore: added watch %p (%s) fd=%d flags=%d",
+ w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
+ );
+ return w;
+}
+
+void Ecore::BusDispatcher::rem_watch( Watch* w )
+{
+ debug_log("ecore: removed watch %p", w);
+
+ delete w;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/error.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/error.cpp
new file mode 100644
index 00000000000..c34430b6a1c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/error.cpp
@@ -0,0 +1,88 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/message.h>
+#include <dbus-c++/error.h>
+
+#include <dbus/dbus.h>
+
+#include "message_p.h"
+#include "internalerror.h"
+
+using namespace DBus;
+
+/*
+*/
+
+Error::Error()
+: _int(new InternalError)
+{}
+
+Error::Error(InternalError &i)
+: _int(new InternalError(i))
+{}
+
+Error::Error(const char *name, const char *message)
+: _int(new InternalError)
+{
+ set(name, message);
+}
+
+Error::Error(Message &m)
+: _int(new InternalError)
+{
+ dbus_set_error_from_message(&(_int->error), m._pvt->msg);
+}
+
+Error::~Error() throw()
+{
+}
+
+const char *Error::name() const
+{
+ return _int->error.name;
+}
+
+const char *Error::message() const
+{
+ return _int->error.message;
+}
+
+bool Error::is_set() const
+{
+ return *(_int);
+}
+
+void Error::set(const char *name, const char *message)
+{
+ dbus_set_error(&(_int->error), name, message);
+}
+
+const char *Error::what() const throw()
+{
+ return _int->error.message;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop-integration.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop-integration.cpp
new file mode 100644
index 00000000000..0d5d2728b02
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop-integration.cpp
@@ -0,0 +1,178 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <dbus-c++/eventloop-integration.h>
+#include <dbus-c++/debug.h>
+
+#include <sys/poll.h>
+
+#include <dbus/dbus.h>
+#include <errno.h>
+
+using namespace DBus;
+
+BusTimeout::BusTimeout(Timeout::Internal *ti, BusDispatcher *bd)
+: Timeout(ti), DefaultTimeout(Timeout::interval(), true, bd)
+{
+ DefaultTimeout::enabled(Timeout::enabled());
+}
+
+void BusTimeout::toggle()
+{
+ debug_log("timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off");
+
+ DefaultTimeout::enabled(Timeout::enabled());
+}
+
+BusWatch::BusWatch(Watch::Internal *wi, BusDispatcher *bd)
+: Watch(wi), DefaultWatch(Watch::descriptor(), 0, bd)
+{
+ int flags = POLLHUP | POLLERR;
+
+ if (Watch::flags() & DBUS_WATCH_READABLE)
+ flags |= POLLIN;
+ if (Watch::flags() & DBUS_WATCH_WRITABLE)
+ flags |= POLLOUT;
+
+ DefaultWatch::flags(flags);
+ DefaultWatch::enabled(Watch::enabled());
+}
+
+void BusWatch::toggle()
+{
+ debug_log("watch %p toggled (%s)", this, Watch::enabled() ? "on":"off");
+
+ DefaultWatch::enabled(Watch::enabled());
+}
+
+void BusDispatcher::enter()
+{
+ debug_log("entering dispatcher %p", this);
+
+ _running = true;
+
+ while (_running)
+ {
+ do_iteration();
+ }
+
+ debug_log("leaving dispatcher %p", this);
+}
+
+void BusDispatcher::leave()
+{
+ _running = false;
+
+ int ret = write(_fdunlock[1],"exit",strlen("exit"));
+ if (ret == -1) {
+ char buffer[128]; // buffer copied in Error constructor
+ throw Error("PipeError:errno", strerror_r(errno,
+ buffer,
+ sizeof(buffer)));
+ }
+ close(_fdunlock[1]);
+ close(_fdunlock[0]);
+}
+
+void BusDispatcher::do_iteration()
+{
+ dispatch_pending();
+ dispatch();
+}
+
+Timeout *BusDispatcher::add_timeout(Timeout::Internal *ti)
+{
+ BusTimeout *bt = new BusTimeout(ti, this);
+
+ bt->expired = new Callback<BusDispatcher, void, DefaultTimeout &>(this, &BusDispatcher::timeout_expired);
+ bt->data(bt);
+
+ debug_log("added timeout %p (%s) interval=%d",
+ bt, ((Timeout *)bt)->enabled() ? "on":"off", ((Timeout *)bt)->interval());
+
+ return bt;
+}
+
+void BusDispatcher::rem_timeout(Timeout *t)
+{
+ debug_log("removed timeout %p", t);
+
+ delete t;
+}
+
+Watch *BusDispatcher::add_watch(Watch::Internal *wi)
+{
+ BusWatch *bw = new BusWatch(wi, this);
+
+ bw->ready = new Callback<BusDispatcher, void, DefaultWatch &>(this, &BusDispatcher::watch_ready);
+ bw->data(bw);
+
+ debug_log("added watch %p (%s) fd=%d flags=%d",
+ bw, ((Watch *)bw)->enabled() ? "on":"off", ((Watch *)bw)->descriptor(), ((Watch *)bw)->flags());
+
+ return bw;
+}
+
+void BusDispatcher::rem_watch(Watch *w)
+{
+ debug_log("removed watch %p", w);
+
+ delete w;
+}
+
+void BusDispatcher::timeout_expired(DefaultTimeout &et)
+{
+ debug_log("timeout %p expired", &et);
+
+ BusTimeout *timeout = reinterpret_cast<BusTimeout *>(et.data());
+
+ timeout->handle();
+}
+
+void BusDispatcher::watch_ready(DefaultWatch &ew)
+{
+ BusWatch *watch = reinterpret_cast<BusWatch *>(ew.data());
+
+ debug_log("watch %p ready, flags=%d state=%d",
+ watch, ((Watch *)watch)->flags(), watch->state()
+ );
+
+ int flags = 0;
+
+ if (watch->state() & POLLIN)
+ flags |= DBUS_WATCH_READABLE;
+ if (watch->state() & POLLOUT)
+ flags |= DBUS_WATCH_WRITABLE;
+ if (watch->state() & POLLHUP)
+ flags |= DBUS_WATCH_HANGUP;
+ if (watch->state() & POLLERR)
+ flags |= DBUS_WATCH_ERROR;
+
+ watch->handle(flags);
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop.cpp
new file mode 100644
index 00000000000..7bf03afda8b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/eventloop.cpp
@@ -0,0 +1,256 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cassert>
+#include <errno.h>
+
+#include <dbus-c++/eventloop.h>
+#include <dbus-c++/debug.h>
+
+#include <sys/poll.h>
+#include <sys/time.h>
+
+#include <dbus/dbus.h>
+
+using namespace DBus;
+
+static double millis(timeval tv)
+{
+ return (tv.tv_sec *1000.0 + tv.tv_usec/1000.0);
+}
+
+DefaultTimeout::DefaultTimeout(int interval, bool repeat, DefaultMainLoop *ed)
+: _enabled(true), _interval(interval), _repeat(repeat), _expiration(0), _data(0), _disp(ed)
+{
+ timeval now;
+ gettimeofday(&now, NULL);
+
+ _expiration = millis(now) + interval;
+
+ _disp->_mutex_t.lock();
+ _disp->_timeouts.push_back(this);
+ _disp->_mutex_t.unlock();
+}
+
+DefaultTimeout::~DefaultTimeout()
+{
+ _disp->_mutex_t.lock();
+ _disp->_timeouts.remove(this);
+ _disp->_mutex_t.unlock();
+}
+
+DefaultWatch::DefaultWatch(int fd, int flags, DefaultMainLoop *ed)
+: _enabled(true), _fd(fd), _flags(flags), _state(0), _data(0), _disp(ed)
+{
+ _disp->_mutex_w.lock();
+ _disp->_watches.push_back(this);
+ _disp->_mutex_w.unlock();
+}
+
+DefaultWatch::~DefaultWatch()
+{
+ _disp->_mutex_w.lock();
+ _disp->_watches.remove(this);
+ _disp->_mutex_w.unlock();
+}
+
+DefaultMutex::DefaultMutex()
+{
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
+ pthread_mutex_init(&_mutex, &attr);
+}
+
+DefaultMutex::~DefaultMutex()
+{
+ pthread_mutex_destroy(&_mutex);
+}
+
+void DefaultMutex::lock()
+{
+ int r = pthread_mutex_lock(&_mutex);
+ /* This assert is here to avoid a difficult-to-diagnose deadlock. See
+ * crosbug.com/8486 and crosbug.com/8596. */
+ assert(r != EDEADLK);
+}
+
+void DefaultMutex::unlock()
+{
+ pthread_mutex_unlock(&_mutex);
+}
+
+DefaultMainLoop::DefaultMainLoop()
+{
+}
+
+DefaultMainLoop::~DefaultMainLoop()
+{
+ _mutex_w.lock();
+
+ DefaultWatches::iterator wi = _watches.begin();
+ while (wi != _watches.end())
+ {
+ DefaultWatches::iterator wmp = wi;
+ ++wmp;
+ _mutex_w.unlock();
+ delete (*wi);
+ _mutex_w.lock();
+ wi = wmp;
+ }
+ _mutex_w.unlock();
+
+ _mutex_t.lock();
+
+ DefaultTimeouts::iterator ti = _timeouts.begin();
+ while (ti != _timeouts.end())
+ {
+ DefaultTimeouts::iterator tmp = ti;
+ ++tmp;
+ _mutex_t.unlock();
+ delete (*ti);
+ _mutex_t.lock();
+ ti = tmp;
+ }
+ _mutex_t.unlock();
+}
+
+void DefaultMainLoop::dispatch()
+{
+ _mutex_w.lock();
+
+ int nfd = _watches.size();
+
+ if(_fdunlock)
+ {
+ nfd=nfd+2;
+ }
+
+ pollfd fds[nfd];
+
+ DefaultWatches::iterator wi = _watches.begin();
+
+ for (nfd = 0; wi != _watches.end(); ++wi)
+ {
+ if ((*wi)->enabled())
+ {
+ fds[nfd].fd = (*wi)->descriptor();
+ fds[nfd].events = (*wi)->flags();
+ fds[nfd].revents = 0;
+
+ ++nfd;
+ }
+ }
+
+ if(_fdunlock){
+ fds[nfd].fd = _fdunlock[0];
+ fds[nfd].events = POLLIN | POLLOUT | POLLPRI ;
+ fds[nfd].revents = 0;
+
+ nfd++;
+ fds[nfd].fd = _fdunlock[1];
+ fds[nfd].events = POLLIN | POLLOUT | POLLPRI ;
+ fds[nfd].revents = 0;
+ }
+
+ _mutex_w.unlock();
+
+ int wait_min = 10000;
+
+ DefaultTimeouts::iterator ti;
+
+ _mutex_t.lock();
+
+ for (ti = _timeouts.begin(); ti != _timeouts.end(); ++ti)
+ {
+ if ((*ti)->enabled() && (*ti)->interval() < wait_min)
+ wait_min = (*ti)->interval();
+ }
+
+ _mutex_t.unlock();
+
+ poll(fds, nfd, wait_min);
+
+ timeval now;
+ gettimeofday(&now, NULL);
+
+ double now_millis = millis(now);
+
+ _mutex_t.lock();
+
+ ti = _timeouts.begin();
+
+ while (ti != _timeouts.end())
+ {
+ DefaultTimeouts::iterator tmp = ti;
+ ++tmp;
+
+ if ((*ti)->enabled() && now_millis >= (*ti)->_expiration)
+ {
+ (*ti)->expired(*(*ti));
+
+ if ((*ti)->_repeat)
+ {
+ (*ti)->_expiration = now_millis + (*ti)->_interval;
+ }
+
+ }
+
+ ti = tmp;
+ }
+
+ _mutex_t.unlock();
+
+ _mutex_w.lock();
+
+ for (int j = 0; j < nfd; ++j)
+ {
+ DefaultWatches::iterator wi;
+
+ for (wi = _watches.begin(); wi != _watches.end();)
+ {
+ DefaultWatches::iterator tmp = wi;
+ ++tmp;
+
+ if ((*wi)->enabled() && (*wi)->_fd == fds[j].fd)
+ {
+ if (fds[j].revents)
+ {
+ (*wi)->_state = fds[j].revents;
+
+ (*wi)->ready(*(*wi));
+
+ fds[j].revents = 0;
+ }
+ }
+
+ wi = tmp;
+ }
+ }
+ _mutex_w.unlock();
+}
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/glib-integration.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/glib-integration.cpp
new file mode 100644
index 00000000000..491c950129f
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/glib-integration.cpp
@@ -0,0 +1,314 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/glib-integration.h>
+
+#include <dbus/dbus.h> // for DBUS_WATCH_*
+
+using namespace DBus;
+
+Glib::BusTimeout::BusTimeout(Timeout::Internal *ti, GMainContext *ctx, int priority)
+: Timeout(ti), _ctx(ctx), _priority(priority), _source(NULL)
+{
+ if (Timeout::enabled())
+ _enable();
+}
+
+Glib::BusTimeout::~BusTimeout()
+{
+ _disable();
+}
+
+void Glib::BusTimeout::toggle()
+{
+ debug_log("glib: timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off");
+
+ if (Timeout::enabled()) _enable();
+ else _disable();
+}
+
+gboolean Glib::BusTimeout::timeout_handler(gpointer data)
+{
+ Glib::BusTimeout *t = reinterpret_cast<Glib::BusTimeout *>(data);
+
+ t->handle();
+
+ return TRUE;
+}
+
+void Glib::BusTimeout::_enable()
+{
+ if (_source)
+ _disable(); // be sane
+
+ _source = g_timeout_source_new(Timeout::interval());
+ g_source_set_priority(_source, _priority);
+ g_source_set_callback(_source, timeout_handler, this, NULL);
+ g_source_attach(_source, _ctx);
+}
+
+void Glib::BusTimeout::_disable()
+{
+ if (_source)
+ {
+ g_source_destroy(_source);
+ _source = NULL;
+ }
+}
+
+struct BusSource
+{
+ GSource source;
+ GPollFD poll;
+};
+
+static gboolean watch_prepare(GSource *source, gint *timeout)
+{
+ //debug_log("glib: watch_prepare");
+
+ *timeout = -1;
+ return FALSE;
+}
+
+static gboolean watch_check(GSource *source)
+{
+ //debug_log("glib: watch_check");
+
+ BusSource *io = (BusSource *)source;
+ return io->poll.revents ? TRUE : FALSE;
+}
+
+static gboolean watch_dispatch(GSource *source, GSourceFunc callback, gpointer data)
+{
+ debug_log("glib: watch_dispatch");
+
+ gboolean cb = callback(data);
+ return cb;
+}
+
+static GSourceFuncs watch_funcs = {
+ watch_prepare,
+ watch_check,
+ watch_dispatch,
+ NULL
+};
+
+Glib::BusWatch::BusWatch(Watch::Internal *wi, GMainContext *ctx, int priority)
+: Watch(wi), _ctx(ctx), _priority(priority), _source(NULL)
+{
+ if (Watch::enabled())
+ _enable();
+}
+
+Glib::BusWatch::~BusWatch()
+{
+ _disable();
+}
+
+void Glib::BusWatch::toggle()
+{
+ debug_log("glib: watch %p toggled (%s)", this, Watch::enabled() ? "on":"off");
+
+ if (Watch::enabled()) _enable();
+ else _disable();
+}
+
+gboolean Glib::BusWatch::watch_handler(gpointer data)
+{
+ Glib::BusWatch *w = reinterpret_cast<Glib::BusWatch *>(data);
+
+ BusSource *io = (BusSource *)(w->_source);
+
+ int flags = 0;
+ if (io->poll.revents &G_IO_IN)
+ flags |= DBUS_WATCH_READABLE;
+ if (io->poll.revents &G_IO_OUT)
+ flags |= DBUS_WATCH_WRITABLE;
+ if (io->poll.revents &G_IO_ERR)
+ flags |= DBUS_WATCH_ERROR;
+ if (io->poll.revents &G_IO_HUP)
+ flags |= DBUS_WATCH_HANGUP;
+
+ w->handle(flags);
+
+ return TRUE;
+}
+
+void Glib::BusWatch::_enable()
+{
+ if (_source)
+ _disable(); // be sane
+ _source = g_source_new(&watch_funcs, sizeof(BusSource));
+ g_source_set_priority(_source, _priority);
+ g_source_set_callback(_source, watch_handler, this, NULL);
+
+ int flags = Watch::flags();
+ int condition = 0;
+
+ if (flags &DBUS_WATCH_READABLE)
+ condition |= G_IO_IN;
+ if (flags &DBUS_WATCH_WRITABLE)
+ condition |= G_IO_OUT;
+ if (flags &DBUS_WATCH_ERROR)
+ condition |= G_IO_ERR;
+ if (flags &DBUS_WATCH_HANGUP)
+ condition |= G_IO_HUP;
+
+ GPollFD *poll = &(((BusSource *)_source)->poll);
+ poll->fd = Watch::descriptor();
+ poll->events = condition;
+ poll->revents = 0;
+
+ g_source_add_poll(_source, poll);
+ g_source_attach(_source, _ctx);
+}
+
+void Glib::BusWatch::_disable()
+{
+ if (!_source)
+ return;
+ GPollFD *poll = &(((BusSource *)_source)->poll);
+ g_source_remove_poll(_source, poll);
+ g_source_destroy(_source);
+ _source = NULL;
+}
+
+/*
+ * We need this on top of the IO handlers, because sometimes
+ * there are messages to dispatch queued up but no IO pending.
+ * (fixes also a previous problem of code not working in case of multiple dispatchers)
+*/
+struct DispatcherSource
+{
+ GSource source;
+ Dispatcher *dispatcher;
+};
+
+
+static gboolean dispatcher_prepare(GSource *source, gint *timeout)
+{
+ Dispatcher *dispatcher = ((DispatcherSource*)source)->dispatcher;
+
+ *timeout = -1;
+
+ return dispatcher->has_something_to_dispatch()? TRUE:FALSE;
+}
+
+static gboolean dispatcher_check(GSource *source)
+{
+ return FALSE;
+}
+
+static gboolean
+dispatcher_dispatch(GSource *source,
+ GSourceFunc callback,
+ gpointer user_data)
+{
+ Dispatcher *dispatcher = ((DispatcherSource*)source)->dispatcher;
+
+ dispatcher->dispatch_pending();
+ return TRUE;
+}
+
+static const GSourceFuncs dispatcher_funcs = {
+ dispatcher_prepare,
+ dispatcher_check,
+ dispatcher_dispatch,
+ NULL
+};
+
+Glib::BusDispatcher::BusDispatcher()
+: _ctx(NULL), _priority(G_PRIORITY_DEFAULT), _source(NULL)
+{
+}
+
+Glib::BusDispatcher::~BusDispatcher()
+{
+ if (_source)
+ {
+ GSource *temp = _source;
+ _source = NULL;
+
+ g_source_destroy (temp);
+ g_source_unref (temp);
+ }
+
+ if (_ctx)
+ g_main_context_unref(_ctx);
+}
+
+void Glib::BusDispatcher::attach(GMainContext *ctx)
+{
+ g_assert(_ctx == NULL); // just to be sane
+
+ _ctx = ctx ? ctx : g_main_context_default();
+ g_main_context_ref(_ctx);
+
+ // create the source for dispatching messages
+ _source = g_source_new((GSourceFuncs *) &dispatcher_funcs,
+ sizeof(DispatcherSource));
+
+ ((DispatcherSource*)_source)->dispatcher = this;
+ g_source_attach (_source, _ctx);
+}
+
+Timeout *Glib::BusDispatcher::add_timeout(Timeout::Internal *wi)
+{
+ Timeout *t = new Glib::BusTimeout(wi, _ctx, _priority);
+
+ debug_log("glib: added timeout %p (%s)", t, t->enabled() ? "on":"off");
+
+ return t;
+}
+
+void Glib::BusDispatcher::rem_timeout(Timeout *t)
+{
+ debug_log("glib: removed timeout %p", t);
+
+ delete t;
+}
+
+Watch *Glib::BusDispatcher::add_watch(Watch::Internal *wi)
+{
+ Watch *w = new Glib::BusWatch(wi, _ctx, _priority);
+
+ debug_log("glib: added watch %p (%s) fd=%d flags=%d",
+ w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
+ );
+ return w;
+}
+
+void Glib::BusDispatcher::rem_watch(Watch *w)
+{
+ debug_log("glib: removed watch %p", w);
+
+ delete w;
+}
+
+void Glib::BusDispatcher::set_priority(int priority)
+{
+ _priority = priority;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/interface.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/interface.cpp
new file mode 100644
index 00000000000..1fa0618323d
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/interface.cpp
@@ -0,0 +1,207 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+#include <dbus-c++/interface.h>
+#include <dbus-c++/pendingcall.h>
+
+#include "internalerror.h"
+
+using namespace DBus;
+
+Interface::Interface(const std::string &name)
+: _name(name)
+{}
+
+Interface::~Interface()
+{}
+
+InterfaceAdaptor *AdaptorBase::find_interface(const std::string &name)
+{
+ InterfaceAdaptorTable::const_iterator ii = _interfaces.find(name);
+
+ return ii != _interfaces.end() ? ii->second : NULL;
+}
+
+InterfaceAdaptor::InterfaceAdaptor(const std::string &name)
+: Interface(name)
+{
+ debug_log("adding interface %s", name.c_str());
+
+ _interfaces[name] = this;
+}
+
+Message InterfaceAdaptor::dispatch_method(const CallMessage &msg)
+{
+ const char *name = msg.member();
+
+ MethodTable::iterator mi = _methods.find(name);
+ if (mi != _methods.end())
+ {
+ return mi->second.call(msg);
+ }
+ else
+ {
+ return ErrorMessage(msg, DBUS_ERROR_UNKNOWN_METHOD, name);
+ }
+}
+
+void InterfaceAdaptor::emit_signal(const SignalMessage &sig)
+{
+ SignalMessage &sig2 = const_cast<SignalMessage &>(sig);
+
+ if (sig2.interface() == NULL)
+ sig2.interface(name().c_str());
+
+ _emit_signal(sig2);
+}
+
+Variant *InterfaceAdaptor::get_property(const std::string &name)
+{
+ PropertyTable::iterator pti = _properties.find(name);
+
+ if (pti != _properties.end())
+ {
+ if (!pti->second.read)
+ throw ErrorAccessDenied("property is not readable");
+
+ return &(pti->second.value);
+ }
+ return NULL;
+}
+
+void InterfaceAdaptor::set_property(const std::string &name, Variant &value)
+{
+ PropertyTable::iterator pti = _properties.find(name);
+
+ if (pti != _properties.end())
+ {
+ if (!pti->second.write)
+ throw ErrorAccessDenied("property is not writeable");
+
+ Signature sig = value.signature();
+
+ if (pti->second.sig != sig)
+ throw ErrorInvalidSignature("property expects a different type");
+
+ pti->second.value = value;
+ return;
+ }
+ throw ErrorFailed("requested property not found");
+}
+
+PropertyDict *InterfaceAdaptor::get_all_properties()
+{
+ PropertyTable::iterator pti;
+ PropertyDict *dict = new PropertyDict();
+
+ for (pti = _properties.begin(); pti != _properties.end(); ++pti)
+ {
+ // Skip unreadable properties
+ if (!pti->second.read)
+ continue;
+
+ Variant v = pti->second.value;
+ // Skip uninitialized properties
+ if (v.signature().empty())
+ continue;
+
+ std::string key = pti->first;
+ (*dict)[key] = v;
+ }
+ return dict;
+}
+
+InterfaceProxy *ProxyBase::find_interface(const std::string &name)
+{
+ InterfaceProxyTable::const_iterator ii = _interfaces.find(name);
+
+ return ii != _interfaces.end() ? ii->second : NULL;
+}
+
+InterfaceProxy::InterfaceProxy(const std::string &name)
+: Interface(name)
+{
+ debug_log("adding interface %s", name.c_str());
+
+ _interfaces[name] = this;
+}
+
+bool InterfaceProxy::dispatch_signal(const SignalMessage &msg)
+{
+ const char *name = msg.member();
+
+ SignalTable::iterator si = _signals.find(name);
+ if (si != _signals.end())
+ {
+ si->second.call(msg);
+ // Here we always return false because there might be
+ // another InterfaceProxy listening for the same signal.
+ // This way we instruct libdbus-1 to go on dispatching
+ // the signal.
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+Message InterfaceProxy::invoke_method(const CallMessage &call)
+{
+ CallMessage &call2 = const_cast<CallMessage &>(call);
+
+ if (call.interface() == NULL)
+ call2.interface(name().c_str());
+
+ return _invoke_method(call2);
+}
+
+bool InterfaceProxy::invoke_method_noreply(const CallMessage &call)
+{
+ CallMessage &call2 = const_cast<CallMessage &>(call);
+
+ if (call.interface() == NULL)
+ call2.interface(name().c_str());
+
+ return _invoke_method_noreply(call2);
+}
+
+PendingCall *InterfaceProxy::invoke_method_async(const CallMessage &call, int timeout)
+{
+ CallMessage &call2 = const_cast<CallMessage &>(call);
+
+ if (call.interface() == NULL)
+ call2.interface(name().c_str());
+
+ return _invoke_method_async(call2, timeout);
+}
+
+void InterfaceProxy::remove_pending_call(PendingCall *pending)
+{
+ _remove_pending_call(pending);
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/internalerror.h b/chromium/third_party/cros_dbus_cplusplus/source/src/internalerror.h
new file mode 100644
index 00000000000..36fe20c6d29
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/internalerror.h
@@ -0,0 +1,77 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_INTERNALERROR_H
+#define __DBUSXX_INTERNALERROR_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/error.h>
+
+#include <dbus/dbus.h>
+
+namespace DBus {
+
+struct DXXAPI InternalError
+{
+ DBusError error;
+
+ InternalError()
+ {
+ dbus_error_init(&error);
+ }
+
+ explicit InternalError(DBusError *e)
+ {
+ dbus_error_init(&error);
+ dbus_move_error(e, &error);
+ }
+
+ InternalError(const InternalError &ie)
+ {
+ dbus_error_init(&error);
+ dbus_move_error(const_cast<DBusError *>(&(ie.error)), &error);
+ }
+
+ ~InternalError()
+ {
+ dbus_error_free(&error);
+ }
+
+ operator DBusError *()
+ {
+ return &error;
+ }
+
+ operator bool()
+ {
+ return dbus_error_is_set(&error);
+ }
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_INTERNALERROR_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/introspection.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/introspection.cpp
new file mode 100644
index 00000000000..1ff179ea662
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/introspection.cpp
@@ -0,0 +1,193 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/introspection.h>
+#include <dbus-c++/object.h>
+#include <dbus-c++/message.h>
+
+#include <dbus/dbus.h>
+
+#include <sstream>
+
+using namespace DBus;
+
+static const char *introspectable_name = "org.freedesktop.DBus.Introspectable";
+
+IntrospectableAdaptor::IntrospectableAdaptor()
+: InterfaceAdaptor(introspectable_name)
+{
+ register_method(IntrospectableAdaptor, Introspect, Introspect);
+}
+
+Message IntrospectableAdaptor::Introspect(const CallMessage &call)
+{
+ debug_log("requested introspection data");
+
+ std::ostringstream xml;
+
+ xml << DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE;
+
+ const std::string path = object()->path();
+
+ xml << "<node name=\"" << path << "\">";
+
+ InterfaceAdaptorTable::const_iterator iti;
+
+ for (iti = _interfaces.begin(); iti != _interfaces.end(); ++iti)
+ {
+ debug_log("introspecting interface %s", iti->first.c_str());
+
+ const IntrospectedInterface *intro = iti->second->introspect();
+ if (intro)
+ {
+ xml << "\n\t<interface name=\"" << intro->name << "\">";
+
+ for (const IntrospectedProperty *p = intro->properties; p->name; ++p)
+ {
+ std::string access;
+
+ if (p->read) access += "read";
+ if (p->write) access += "write";
+
+ xml << "\n\t\t<property name=\"" << p->name << "\""
+ << " type=\"" << p->type << "\""
+ << " access=\"" << access << "\"/>";
+ }
+
+ for (const IntrospectedMethod *m = intro->methods; m->args; ++m)
+ {
+ xml << "\n\t\t<method name=\"" << m->name << "\">";
+
+ for (const IntrospectedArgument *a = m->args; a->type; ++a)
+ {
+ xml << "\n\t\t\t<arg direction=\"" << (a->in ? "in" : "out") << "\""
+ << " type=\"" << a->type << "\"";
+
+ if (a->name) xml << " name=\"" << a->name << "\"";
+
+ xml << "/>";
+ }
+
+ xml << "\n\t\t</method>";
+ }
+
+ for (const IntrospectedMethod *m = intro->signals; m->args; ++m)
+ {
+ xml << "\n\t\t<signal name=\"" << m->name << "\">";
+
+ for (const IntrospectedArgument *a = m->args; a->type; ++a)
+ {
+ xml << "<arg type=\"" << a->type << "\"";
+
+ if (a->name) xml << " name=\"" << a->name << "\"";
+
+ xml << "/>";
+ }
+ xml << "\n\t\t</signal>";
+ }
+
+ xml << "\n\t</interface>";
+ }
+ }
+
+ const ObjectPathList nodes = ObjectAdaptor::child_nodes_from_prefix(path + '/');
+ ObjectPathList::const_iterator oni;
+
+ for (oni = nodes.begin(); oni != nodes.end(); ++oni)
+ {
+ xml << "\n\t<node name=\"" << (*oni) << "\"/>";
+ }
+
+ /* broken
+ const ObjectAdaptorPList children = ObjectAdaptor::from_path_prefix(path + '/');
+
+ ObjectAdaptorPList::const_iterator oci;
+
+ for (oci = children.begin(); oci != children.end(); ++oci)
+ {
+ std::string name = (*oci)->path().substr(path.length()+1);
+ name.substr(name.find('/'));
+
+ xml << "<node name=\"" << name << "\"/>";
+ }
+ */
+
+ xml << "\n</node>";
+
+ ReturnMessage reply(call);
+ MessageIter wi = reply.writer();
+ wi.append_string(xml.str().c_str());
+ return reply;
+}
+
+const IntrospectedInterface *IntrospectableAdaptor::introspect() const
+{
+ static IntrospectedArgument Introspect_args[] =
+ {
+ { "data", "s", false },
+ { 0, 0, 0 }
+ };
+ static IntrospectedMethod Introspectable_methods[] =
+ {
+ { "Introspect", Introspect_args },
+ { 0, 0 }
+ };
+ static IntrospectedMethod Introspectable_signals[] =
+ {
+ { 0, 0 }
+ };
+ static IntrospectedProperty Introspectable_properties[] =
+ {
+ { 0, 0, 0, 0 }
+ };
+ static IntrospectedInterface Introspectable_interface =
+ {
+ introspectable_name,
+ Introspectable_methods,
+ Introspectable_signals,
+ Introspectable_properties
+ };
+ return &Introspectable_interface;
+}
+
+IntrospectableProxy::IntrospectableProxy()
+: InterfaceProxy(introspectable_name)
+{}
+
+std::string IntrospectableProxy::Introspect()
+{
+ DBus::CallMessage call;
+
+ call.member("Introspect");
+
+ DBus::Message ret = invoke_method(call);
+
+ DBus::MessageIter ri = ret.reader();
+ const char *str = ri.get_string();
+
+ return str;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/message.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/message.cpp
new file mode 100644
index 00000000000..61c0f7724e5
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/message.cpp
@@ -0,0 +1,705 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/message.h>
+
+#include <dbus/dbus.h>
+#include <cstdlib>
+
+#include "internalerror.h"
+#include "message_p.h"
+
+// TODO(thestig) Remove this once Chromium stops supporting Ubuntu Lucid, where
+// libdbus 1.2.16 does not have DBUS_TYPE_UNIX_FD.
+#ifndef DBUS_TYPE_UNIX_FD
+#define DBUS_TYPE_UNIX_FD ((int) 'h')
+#endif
+
+using namespace DBus;
+
+/*
+*/
+
+MessageIter::MessageIter()
+: _pvt(new Private), _msg(NULL) {}
+
+MessageIter::MessageIter(Message &msg)
+: _pvt(new Private), _msg(&msg) {}
+
+MessageIter::MessageIter(const MessageIter &iter)
+: _pvt(new Private(*iter._pvt)), _msg(iter._msg) {}
+
+MessageIter::~MessageIter()
+{
+ delete _pvt;
+ _pvt = NULL;
+ _msg = NULL;
+}
+
+MessageIter &MessageIter::operator =(const MessageIter &iter)
+{
+ if (this != &iter)
+ {
+ *_pvt = *iter._pvt;
+ _msg = iter._msg;
+ }
+ return *this;
+}
+
+int MessageIter::type()
+{
+ return dbus_message_iter_get_arg_type(&_pvt->iter);
+}
+
+bool MessageIter::at_end()
+{
+ return type() == DBUS_TYPE_INVALID;
+}
+
+bool MessageIter::has_next()
+{
+ return dbus_message_iter_has_next(&_pvt->iter);
+}
+
+MessageIter &MessageIter::operator ++()
+{
+ dbus_message_iter_next(&_pvt->iter);
+ return (*this);
+}
+
+MessageIter MessageIter::operator ++(int)
+{
+ MessageIter copy(*this);
+ ++(*this);
+ return copy;
+}
+
+bool MessageIter::append_basic(int type_id, void *value)
+{
+ return dbus_message_iter_append_basic(&_pvt->iter, type_id, value);
+}
+
+void MessageIter::get_basic(int type_id, void *ptr)
+{
+ if (type() != type_id)
+ throw ErrorInvalidArgs("type mismatch");
+
+ dbus_message_iter_get_basic(&_pvt->iter, ptr);
+}
+
+bool MessageIter::append_byte(unsigned char b)
+{
+ return append_basic(DBUS_TYPE_BYTE, &b);
+}
+
+unsigned char MessageIter::get_byte()
+{
+ unsigned char b;
+ get_basic(DBUS_TYPE_BYTE, &b);
+ return b;
+}
+
+bool MessageIter::append_bool(bool b)
+{
+ dbus_bool_t db = b ? TRUE : FALSE;
+ return append_basic(DBUS_TYPE_BOOLEAN, &db);
+}
+
+bool MessageIter::get_bool()
+{
+ dbus_bool_t db;
+ get_basic(DBUS_TYPE_BOOLEAN, &db);
+ return db ? true : false;
+}
+
+bool MessageIter::append_int16(signed short i)
+{
+ return append_basic(DBUS_TYPE_INT16, &i);
+}
+
+signed short MessageIter::get_int16()
+{
+ signed short i;
+ get_basic(DBUS_TYPE_INT16, &i);
+ return i;
+}
+
+bool MessageIter::append_uint16(unsigned short u)
+{
+ return append_basic(DBUS_TYPE_UINT16, &u);
+}
+
+unsigned short MessageIter::get_uint16()
+{
+ unsigned short u;
+ get_basic(DBUS_TYPE_UINT16, &u);
+ return u;
+}
+
+bool MessageIter::append_int32(signed int i)
+{
+ return append_basic(DBUS_TYPE_INT32, &i);
+}
+
+signed int MessageIter::get_int32()
+{
+ signed int i;
+ get_basic(DBUS_TYPE_INT32, &i);
+ return i;
+}
+
+bool MessageIter::append_uint32(unsigned int u)
+{
+ return append_basic(DBUS_TYPE_UINT32, &u);
+}
+
+unsigned int MessageIter::get_uint32()
+{
+ unsigned int u;
+ get_basic(DBUS_TYPE_UINT32, &u);
+ return u;
+}
+
+signed long long MessageIter::get_int64()
+{
+ signed long long i;
+ get_basic(DBUS_TYPE_INT64, &i);
+ return i;
+}
+
+bool MessageIter::append_int64(signed long long i)
+{
+ return append_basic(DBUS_TYPE_INT64, &i);
+}
+
+unsigned long long MessageIter::get_uint64()
+{
+ unsigned long long u;
+ get_basic(DBUS_TYPE_UINT64, &u);
+ return u;
+}
+
+bool MessageIter::append_uint64(unsigned long long u)
+{
+ return append_basic(DBUS_TYPE_UINT64, &u);
+}
+
+double MessageIter::get_double()
+{
+ double d;
+ get_basic(DBUS_TYPE_DOUBLE, &d);
+ return d;
+}
+
+bool MessageIter::append_double(double d)
+{
+ return append_basic(DBUS_TYPE_DOUBLE, &d);
+}
+
+bool MessageIter::append_string(const char *chars)
+{
+ return append_basic(DBUS_TYPE_STRING, &chars);
+}
+
+const char *MessageIter::get_string()
+{
+ char *chars;
+ get_basic(DBUS_TYPE_STRING, &chars);
+ return chars;
+}
+
+bool MessageIter::append_path(const char *chars)
+{
+ return append_basic(DBUS_TYPE_OBJECT_PATH, &chars);
+}
+
+const char *MessageIter::get_path()
+{
+ char *chars;
+ get_basic(DBUS_TYPE_OBJECT_PATH, &chars);
+ return chars;
+}
+
+bool MessageIter::append_signature(const char *chars)
+{
+ return append_basic(DBUS_TYPE_SIGNATURE, &chars);
+}
+
+const char *MessageIter::get_signature()
+{
+ char *chars;
+ get_basic(DBUS_TYPE_SIGNATURE, &chars);
+ return chars;
+}
+
+bool MessageIter::append_fd(int fd)
+{
+ return append_basic(DBUS_TYPE_UNIX_FD, &fd);
+}
+
+int MessageIter::get_fd()
+{
+ int fd;
+ get_basic(DBUS_TYPE_UNIX_FD, &fd);
+ return fd;
+}
+
+MessageIter MessageIter::recurse()
+{
+ MessageIter iter(msg());
+ dbus_message_iter_recurse(&_pvt->iter, &iter._pvt->iter);
+ return iter;
+}
+
+char *MessageIter::signature() const
+{
+ return dbus_message_iter_get_signature(&_pvt->iter);
+}
+
+bool MessageIter::append_array(char type, const void *ptr, size_t length)
+{
+ return dbus_message_iter_append_fixed_array(&_pvt->iter, type, &ptr, length);
+}
+
+int MessageIter::array_type()
+{
+ return dbus_message_iter_get_element_type(&_pvt->iter);
+}
+
+int MessageIter::get_array(void *ptr)
+{
+ int length;
+ dbus_message_iter_get_fixed_array(&_pvt->iter, ptr, &length);
+ return length;
+}
+
+bool MessageIter::is_array()
+{
+ return dbus_message_iter_get_arg_type(&_pvt->iter) == DBUS_TYPE_ARRAY;
+}
+
+bool MessageIter::is_dict()
+{
+ return is_array() && dbus_message_iter_get_element_type(&_pvt->iter) == DBUS_TYPE_DICT_ENTRY;
+}
+
+MessageIter MessageIter::new_array(const char *sig)
+{
+ MessageIter arr(msg());
+ dbus_message_iter_open_container(
+ &_pvt->iter, DBUS_TYPE_ARRAY, sig, &arr._pvt->iter
+ );
+ return arr;
+}
+
+MessageIter MessageIter::new_variant(const char *sig)
+{
+ MessageIter var(msg());
+ dbus_message_iter_open_container(
+ &_pvt->iter, DBUS_TYPE_VARIANT, sig, &var._pvt->iter
+ );
+ return var;
+}
+
+MessageIter MessageIter::new_struct()
+{
+ MessageIter stu(msg());
+ dbus_message_iter_open_container(
+ &_pvt->iter, DBUS_TYPE_STRUCT, NULL, &stu._pvt->iter
+ );
+ return stu;
+}
+
+MessageIter MessageIter::new_dict_entry()
+{
+ MessageIter ent(msg());
+ dbus_message_iter_open_container(
+ &_pvt->iter, DBUS_TYPE_DICT_ENTRY, NULL, &ent._pvt->iter
+ );
+ return ent;
+}
+
+void MessageIter::close_container(MessageIter &container)
+{
+ dbus_message_iter_close_container(&_pvt->iter, &container._pvt->iter);
+}
+
+static bool is_basic_type(int typecode)
+{
+ switch (typecode)
+ {
+ case DBUS_TYPE_BYTE:
+ case DBUS_TYPE_BOOLEAN:
+ case DBUS_TYPE_INT16:
+ case DBUS_TYPE_UINT16:
+ case DBUS_TYPE_INT32:
+ case DBUS_TYPE_UINT32:
+ case DBUS_TYPE_INT64:
+ case DBUS_TYPE_UINT64:
+ case DBUS_TYPE_DOUBLE:
+ case DBUS_TYPE_STRING:
+ case DBUS_TYPE_OBJECT_PATH:
+ case DBUS_TYPE_SIGNATURE:
+ case DBUS_TYPE_UNIX_FD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void MessageIter::copy_data(MessageIter &to)
+{
+ for (MessageIter &from = *this; !from.at_end(); ++from)
+ {
+ if (is_basic_type(from.type()))
+ {
+ debug_log("copying basic type: %c", from.type());
+
+ unsigned char value[8];
+ from.get_basic(from.type(), &value);
+ to.append_basic(from.type(), &value);
+ }
+ else
+ {
+ MessageIter from_container = from.recurse();
+ char *sig = from_container.signature();
+
+ debug_log("copying compound type: %c[%s]", from.type(), sig);
+
+ MessageIter to_container (to.msg());
+ dbus_message_iter_open_container
+ (
+ &to._pvt->iter,
+ from.type(),
+ from.type() == DBUS_TYPE_DICT_ENTRY ||
+ from.type() == DBUS_TYPE_STRUCT ? NULL : sig,
+ &to_container._pvt->iter
+ );
+
+ from_container.copy_data(to_container);
+ to.close_container(to_container);
+ free(sig);
+ }
+ }
+}
+
+/*
+*/
+
+Message::Message()
+: _pvt(new Private)
+{
+}
+
+Message::Message(Message::Private *p, bool incref)
+: _pvt(p)
+{
+ if (_pvt->msg && incref) dbus_message_ref(_pvt->msg);
+}
+
+Message::Message(const Message &m)
+: _pvt(m._pvt)
+{
+ if (_pvt->msg)
+ dbus_message_ref(_pvt->msg);
+}
+
+Message::~Message()
+{
+ if (_pvt->msg)
+ dbus_message_unref(_pvt->msg);
+}
+
+Message &Message::operator = (const Message &m)
+{
+ if (&m != this)
+ {
+ if (_pvt->msg)
+ dbus_message_unref(_pvt->msg);
+ _pvt = m._pvt;
+ if (_pvt->msg)
+ dbus_message_ref(_pvt->msg);
+ }
+ return *this;
+}
+
+Message Message::copy()
+{
+ Private *pvt = new Private(_pvt->msg ? dbus_message_copy(_pvt->msg) : NULL);
+ return Message(pvt);
+}
+
+bool Message::append(int first_type, ...)
+{
+ va_list vl;
+ va_start(vl, first_type);
+
+ bool b = dbus_message_append_args_valist(_pvt->msg, first_type, vl);
+
+ va_end(vl);
+ return b;
+}
+
+void Message::terminate()
+{
+ dbus_message_append_args(_pvt->msg, DBUS_TYPE_INVALID);
+}
+
+int Message::type() const
+{
+ return dbus_message_get_type(_pvt->msg);
+}
+
+int Message::serial() const
+{
+ return dbus_message_get_serial(_pvt->msg);
+}
+
+int Message::reply_serial() const
+{
+ return dbus_message_get_reply_serial(_pvt->msg);
+}
+
+bool Message::reply_serial(int s)
+{
+ return dbus_message_set_reply_serial(_pvt->msg, s);
+}
+
+const char *Message::sender() const
+{
+ return dbus_message_get_sender(_pvt->msg);
+}
+
+bool Message::sender(const char *s)
+{
+ return dbus_message_set_sender(_pvt->msg, s);
+}
+
+const char *Message::destination() const
+{
+ return dbus_message_get_destination(_pvt->msg);
+}
+
+bool Message::destination(const char *s)
+{
+ return dbus_message_set_destination(_pvt->msg, s);
+}
+
+bool Message::is_error() const
+{
+ return type() == DBUS_MESSAGE_TYPE_ERROR;
+}
+
+bool Message::is_signal(const char *interface, const char *member) const
+{
+ return dbus_message_is_signal(_pvt->msg, interface, member);
+}
+
+Tag *Message::tag() const
+{
+ return _pvt->tag;
+}
+
+
+MessageIter Message::writer()
+{
+ MessageIter iter(*this);
+ dbus_message_iter_init_append(_pvt->msg, &iter._pvt->iter);
+ return iter;
+}
+
+MessageIter Message::reader() const
+{
+ MessageIter iter(const_cast<Message &>(*this));
+ dbus_message_iter_init(_pvt->msg, &iter._pvt->iter);
+ return iter;
+}
+
+/*
+*/
+
+ErrorMessage::ErrorMessage()
+{
+ _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
+}
+
+ErrorMessage::ErrorMessage(const Message &to_reply, const char *name, const char *message)
+{
+ _pvt->msg = dbus_message_new_error(to_reply._pvt->msg, name, message);
+}
+
+bool ErrorMessage::operator == (const ErrorMessage &m) const
+{
+ return dbus_message_is_error(_pvt->msg, m.name());
+}
+
+const char *ErrorMessage::name() const
+{
+ return dbus_message_get_error_name(_pvt->msg);
+}
+
+bool ErrorMessage::name(const char *n)
+{
+ return dbus_message_set_error_name(_pvt->msg, n);
+}
+
+/*
+*/
+
+SignalMessage::SignalMessage(const char *name)
+{
+ _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_SIGNAL);
+ member(name);
+}
+
+SignalMessage::SignalMessage(const char *path, const char *interface, const char *name)
+{
+ _pvt->msg = dbus_message_new_signal(path, interface, name);
+}
+
+bool SignalMessage::operator == (const SignalMessage &m) const
+{
+ return dbus_message_is_signal(_pvt->msg, m.interface(), m.member());
+}
+
+const char *SignalMessage::interface() const
+{
+ return dbus_message_get_interface(_pvt->msg);
+}
+
+bool SignalMessage::interface(const char *i)
+{
+ return dbus_message_set_interface(_pvt->msg, i);
+}
+
+const char *SignalMessage::member() const
+{
+ return dbus_message_get_member(_pvt->msg);
+}
+
+bool SignalMessage::member(const char *m)
+{
+ return dbus_message_set_member(_pvt->msg, m);
+}
+
+const char *SignalMessage::path() const
+{
+ return dbus_message_get_path(_pvt->msg);
+}
+
+char ** SignalMessage::path_split() const
+{
+ char ** p;
+ dbus_message_get_path_decomposed(_pvt->msg, &p); //todo: return as a std::vector ?
+ return p;
+}
+
+bool SignalMessage::path(const char *p)
+{
+ return dbus_message_set_path(_pvt->msg, p);
+}
+
+/*
+*/
+
+CallMessage::CallMessage()
+{
+ _pvt->msg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
+}
+
+CallMessage::CallMessage(const char *dest, const char *path, const char *iface, const char *method)
+{
+ _pvt->msg = dbus_message_new_method_call(dest, path, iface, method);
+}
+
+bool CallMessage::operator == (const CallMessage &m) const
+{
+ return dbus_message_is_method_call(_pvt->msg, m.interface(), m.member());
+}
+
+const char *CallMessage::interface() const
+{
+ return dbus_message_get_interface(_pvt->msg);
+}
+
+bool CallMessage::interface(const char *i)
+{
+ return dbus_message_set_interface(_pvt->msg, i);
+}
+
+const char *CallMessage::member() const
+{
+ return dbus_message_get_member(_pvt->msg);
+}
+
+bool CallMessage::member(const char *m)
+{
+ return dbus_message_set_member(_pvt->msg, m);
+}
+
+const char *CallMessage::path() const
+{
+ return dbus_message_get_path(_pvt->msg);
+}
+
+char ** CallMessage::path_split() const
+{
+ char ** p;
+ dbus_message_get_path_decomposed(_pvt->msg, &p);
+ return p;
+}
+
+bool CallMessage::path(const char *p)
+{
+ return dbus_message_set_path(_pvt->msg, p);
+}
+
+const char *CallMessage::signature() const
+{
+ return dbus_message_get_signature(_pvt->msg);
+}
+
+/*
+ */
+
+TagMessage::TagMessage(Tag *tag)
+{
+ _pvt->tag = tag;
+}
+
+/*
+*/
+
+ReturnMessage::ReturnMessage(const CallMessage &callee)
+{
+ _pvt = new Private(dbus_message_new_method_return(callee._pvt->msg));
+}
+
+const char *ReturnMessage::signature() const
+{
+ return dbus_message_get_signature(_pvt->msg);
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/message_p.h b/chromium/third_party/cros_dbus_cplusplus/source/src/message_p.h
new file mode 100644
index 00000000000..926b7f9429e
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/message_p.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_MESSAGE_P_H
+#define __DBUSXX_MESSAGE_P_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/message.h>
+#include <dbus-c++/refptr_impl.h>
+
+#include <dbus/dbus.h>
+
+namespace DBus {
+
+struct DXXAPILOCAL MessageIter::Private {
+ DBusMessageIter iter;
+};
+
+struct DXXAPILOCAL Message::Private
+{
+ DBusMessage *msg;
+ Tag *tag;
+
+ Private() : msg(0), tag(0)
+ {}
+
+ Private(DBusMessage *m) : msg(m), tag(0)
+ {}
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_MESSAGE_P_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/object.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/object.cpp
new file mode 100644
index 00000000000..e1e40aa6949
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/object.cpp
@@ -0,0 +1,492 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+#include <dbus-c++/object.h>
+#include "internalerror.h"
+
+#include <cstring>
+#include <map>
+#include <dbus/dbus.h>
+
+#include "message_p.h"
+#include "server_p.h"
+#include "connection_p.h"
+
+using namespace DBus;
+
+Object::Object(Connection &conn, const Path &path, const char *service)
+: _conn(conn), _path(path), _service(service ? service : "")
+{
+}
+
+Object::~Object()
+{
+}
+
+struct ObjectAdaptor::Private
+{
+ static void unregister_function_stub(DBusConnection *, void *);
+ static DBusHandlerResult message_function_stub(DBusConnection *, DBusMessage *, void *);
+};
+
+static DBusObjectPathVTable _vtable =
+{
+ ObjectAdaptor::Private::unregister_function_stub,
+ ObjectAdaptor::Private::message_function_stub,
+ NULL, NULL, NULL, NULL
+};
+
+void ObjectAdaptor::Private::unregister_function_stub(DBusConnection *conn, void *data)
+{
+ //TODO: what do we have to do here ?
+}
+
+DBusHandlerResult ObjectAdaptor::Private::message_function_stub(DBusConnection *, DBusMessage *dmsg, void *data)
+{
+ ObjectAdaptor *o = static_cast<ObjectAdaptor *>(data);
+
+ if (o)
+ {
+ Message msg(new Message::Private(dmsg));
+
+ debug_log("in object %s", o->path().c_str());
+ debug_log(" got message #%d from %s to %s",
+ msg.serial(),
+ msg.sender(),
+ msg.destination()
+ );
+
+ return o->handle_message(msg)
+ ? DBUS_HANDLER_RESULT_HANDLED
+ : DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ else
+ {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+}
+
+typedef std::map<Path, ObjectAdaptor *> ObjectAdaptorTable;
+static ObjectAdaptorTable _adaptor_table;
+
+ObjectAdaptor *ObjectAdaptor::from_path(const Path &path)
+{
+ ObjectAdaptorTable::iterator ati = _adaptor_table.find(path);
+
+ if (ati != _adaptor_table.end())
+ return ati->second;
+
+ return NULL;
+}
+
+ObjectAdaptorPList ObjectAdaptor::from_path_prefix(const std::string &prefix)
+{
+ ObjectAdaptorPList ali;
+
+ ObjectAdaptorTable::iterator ati = _adaptor_table.begin();
+
+ size_t plen = prefix.length();
+
+ while (ati != _adaptor_table.end())
+ {
+ if (!strncmp(ati->second->path().c_str(), prefix.c_str(), plen))
+ ali.push_back(ati->second);
+
+ ++ati;
+ }
+
+ return ali;
+}
+
+ObjectPathList ObjectAdaptor::child_nodes_from_prefix(const std::string &prefix)
+{
+ ObjectPathList ali;
+
+ ObjectAdaptorTable::iterator ati = _adaptor_table.begin();
+
+ size_t plen = prefix.length();
+
+ while (ati != _adaptor_table.end())
+ {
+ if (!strncmp(ati->second->path().c_str(), prefix.c_str(), plen))
+ {
+ std::string p = ati->second->path().substr(plen);
+ p = p.substr(0,p.find('/'));
+ ali.push_back(p);
+ }
+ ++ati;
+ }
+
+ ali.sort();
+ ali.unique();
+
+ return ali;
+}
+
+ObjectAdaptor::ObjectAdaptor(Connection &conn, const Path &path)
+: Object(conn, path, conn.unique_name()), _eflag(USE_EXCEPTIONS)
+{
+ register_obj();
+}
+
+ObjectAdaptor::ObjectAdaptor(Connection &conn, const Path &path, registration_time rtime)
+: Object(conn, path, conn.unique_name()), _eflag(USE_EXCEPTIONS)
+{
+ if (rtime == REGISTER_NOW)
+ register_obj();
+}
+
+ObjectAdaptor::ObjectAdaptor(Connection &conn, const Path &path, registration_time rtime,
+ exceptions_flag eflag)
+: Object(conn, path, conn.unique_name()), _eflag(eflag)
+{
+ if (rtime == REGISTER_NOW)
+ register_obj();
+}
+
+ObjectAdaptor::~ObjectAdaptor()
+{
+ unregister_obj();
+}
+
+void ObjectAdaptor::register_obj()
+{
+ debug_log("registering local object %s", path().c_str());
+
+ if (conn()._pvt->conn == NULL)
+ {
+ throw ErrorInvalidArgs("NULL connection");
+ }
+ else if (path().c_str() == NULL)
+ {
+ throw ErrorInvalidArgs("NULL path");
+ }
+ else if (path().c_str()[0] != '/')
+ {
+ std::string message = "Path must start with '/': " + path();
+ throw ErrorInvalidArgs(message.c_str());
+ }
+
+ if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_str(), &_vtable, this))
+ {
+ throw ErrorNoMemory("unable to register object path");
+ }
+
+ _adaptor_table[path()] = this;
+}
+
+void ObjectAdaptor::unregister_obj()
+{
+ if (!is_registered())
+ return;
+
+ _adaptor_table.erase(path());
+
+ debug_log("unregistering local object %s", path().c_str());
+
+ if (conn()._pvt->conn == NULL)
+ {
+ throw ErrorInvalidArgs("NULL connection");
+ }
+ else if (path().c_str() == NULL)
+ {
+ throw ErrorInvalidArgs("NULL path");
+ }
+ else if (path().c_str()[0] != '/')
+ {
+ std::string message = "Path must start with '/': " + path();
+ throw ErrorInvalidArgs(message.c_str());
+ }
+
+ dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str());
+}
+
+bool ObjectAdaptor::is_registered()
+{
+ return _adaptor_table.find(path()) != _adaptor_table.end();
+}
+
+void ObjectAdaptor::_emit_signal(SignalMessage &sig)
+{
+ sig.path(path().c_str());
+
+ conn().send(sig);
+}
+
+struct ReturnLaterError
+{
+ const Tag *tag;
+};
+
+bool ObjectAdaptor::handle_message(const Message &msg)
+{
+ switch (msg.type())
+ {
+ case DBUS_MESSAGE_TYPE_METHOD_CALL:
+ {
+ const CallMessage &cmsg = reinterpret_cast<const CallMessage &>(msg);
+ const char *member = cmsg.member();
+ const char *interface = cmsg.interface();
+
+ debug_log(" invoking method %s.%s", interface, member);
+
+ InterfaceAdaptor *ii = find_interface(interface);
+ if (ii)
+ {
+ if (_eflag == AVOID_EXCEPTIONS) {
+ Message ret = ii->dispatch_method(cmsg);
+ Tag *tag = ret.tag();
+ if (tag) {
+ _continuations[tag] =
+ new Continuation(conn(), cmsg, tag);
+ } else {
+ conn().send(ret);
+ }
+ return true;
+ }
+ // TODO(jglasgow@google.com): make this code
+ // conditional based on compile time option to
+ // support exceptions.
+ try
+ {
+ Message ret = ii->dispatch_method(cmsg);
+ conn().send(ret);
+ }
+ catch(Error &e)
+ {
+ ErrorMessage em(cmsg, e.name(), e.message());
+ conn().send(em);
+ }
+ catch(ReturnLaterError &rle)
+ {
+ _continuations[rle.tag] = new Continuation(conn(), cmsg, rle.tag);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ default:
+ {
+ return false;
+ }
+ }
+}
+
+void ObjectAdaptor::return_later(const Tag *tag)
+{
+ ReturnLaterError rle = { tag };
+ throw rle;
+}
+
+void ObjectAdaptor::return_now(Continuation *ret)
+{
+ ret->_conn.send(ret->_return);
+
+ ContinuationMap::iterator di = _continuations.find(ret->_tag);
+
+ delete di->second;
+
+ _continuations.erase(di);
+}
+
+void ObjectAdaptor::return_error(Continuation *ret, const Error error)
+{
+ ret->_conn.send(ErrorMessage(ret->_call, error.name(), error.message()));
+
+ ContinuationMap::iterator di = _continuations.find(ret->_tag);
+
+ delete di->second;
+
+ _continuations.erase(di);
+}
+
+ObjectAdaptor::Continuation *ObjectAdaptor::find_continuation(const Tag *tag)
+{
+ ContinuationMap::iterator di = _continuations.find(tag);
+
+ return di != _continuations.end() ? di->second : NULL;
+}
+
+ObjectAdaptor::Continuation::Continuation(Connection &conn, const CallMessage &call, const Tag *tag)
+: _conn(conn), _call(call), _return(_call), _tag(tag)
+{
+ _writer = _return.writer(); //todo: verify
+}
+
+/*
+*/
+
+ObjectProxy::ObjectProxy(Connection &conn, const Path &path, const char *service)
+: Object(conn, path, service)
+{
+ register_obj();
+}
+
+// TODO(ers@google.com): unregister_obj() makes a synchronous
+// dbus method call, which can result in a deadlock if the
+// ObjectProxy is deleted while in a callback from a signal
+// or a pending call reply.
+ObjectProxy::~ObjectProxy()
+{
+ cancel_pending_calls();
+ unregister_obj();
+}
+
+void ObjectProxy::cancel_pending_calls()
+{
+ PendingCallList::const_iterator pi = _pending_calls.begin();
+ while (pi != _pending_calls.end())
+ {
+ (*pi)->cancel();
+ delete *pi;
+ ++pi;
+ }
+ _pending_calls.clear();
+}
+
+void ObjectProxy::_remove_pending_call(PendingCall *pending)
+{
+ PendingCallList::iterator pi = _pending_calls.begin();
+ while (pi != _pending_calls.end())
+ {
+ if (*pi == pending)
+ {
+ _pending_calls.erase(pi);
+ break;
+ }
+ ++pi;
+ }
+ delete pending;
+}
+
+void ObjectProxy::register_obj()
+{
+ debug_log("registering remote object %s", path().c_str());
+
+ _filtered = new Callback<ObjectProxy, bool, const Message &>(this, &ObjectProxy::handle_message);
+
+ conn().add_filter(_filtered);
+
+ InterfaceProxyTable::const_iterator ii = _interfaces.begin();
+ while (ii != _interfaces.end())
+ {
+ std::string im = "type='signal',interface='"+ii->first+"',path='"+path()+"'";
+ conn().add_match(im.c_str());
+ ++ii;
+ }
+}
+
+void ObjectProxy::unregister_obj()
+{
+ debug_log("unregistering remote object %s", path().c_str());
+
+ InterfaceProxyTable::const_iterator ii = _interfaces.begin();
+ while (ii != _interfaces.end())
+ {
+ std::string im = "type='signal',interface='"+ii->first+"',path='"+path()+"'";
+ conn().remove_match(im.c_str());
+ ++ii;
+ }
+ conn().remove_filter(_filtered);
+}
+
+bool ObjectProxy::is_registered()
+{
+ return true;
+}
+
+Message ObjectProxy::_invoke_method(CallMessage &call)
+{
+ if (call.path() == NULL)
+ call.path(path().c_str());
+
+ if (call.destination() == NULL)
+ call.destination(service().c_str());
+
+ return conn().send_blocking(call);
+}
+
+bool ObjectProxy::_invoke_method_noreply(CallMessage &call)
+{
+ if (call.path() == NULL)
+ call.path(path().c_str());
+
+ if (call.destination() == NULL)
+ call.destination(service().c_str());
+
+ return conn().send(call);
+}
+
+PendingCall *ObjectProxy::_invoke_method_async(CallMessage &call, int timeout)
+{
+ if (call.path() == NULL)
+ call.path(path().c_str());
+
+ if (call.destination() == NULL)
+ call.destination(service().c_str());
+
+ PendingCall *pending = conn().send_async(call, timeout);
+ _pending_calls.push_back(pending);
+ return pending;
+}
+
+bool ObjectProxy::handle_message(const Message &msg)
+{
+ switch (msg.type())
+ {
+ case DBUS_MESSAGE_TYPE_SIGNAL:
+ {
+ const SignalMessage &smsg = reinterpret_cast<const SignalMessage &>(msg);
+ const char *interface = smsg.interface();
+ const char *member = smsg.member();
+ const char *objpath = smsg.path();
+
+ if (objpath != path()) return false;
+
+ debug_log("filtered signal %s(in %s) from %s to object %s",
+ member, interface, msg.sender(), objpath);
+
+ InterfaceProxy *ii = find_interface(interface);
+ if (ii)
+ {
+ return ii->dispatch_signal(smsg);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ default:
+ {
+ return false;
+ }
+ }
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall.cpp
new file mode 100644
index 00000000000..e566c8b34df
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall.cpp
@@ -0,0 +1,144 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/pendingcall.h>
+
+#include <dbus/dbus.h>
+
+#include "internalerror.h"
+#include "pendingcall_p.h"
+#include "message_p.h"
+
+using namespace DBus;
+
+PendingCall::Private::Private(DBusPendingCall *dpc)
+: call(dpc), dataslot(-1)
+{
+ if (!dbus_pending_call_allocate_data_slot(&dataslot))
+ {
+ throw ErrorNoMemory("Unable to allocate data slot");
+ }
+}
+
+PendingCall::Private::~Private()
+{
+ if (dataslot != -1)
+ {
+ dbus_pending_call_free_data_slot(&dataslot);
+ }
+}
+
+void PendingCall::Private::notify_stub(DBusPendingCall *dpc, void *data)
+{
+ PendingCall *pc = static_cast<PendingCall*>(data);
+ pc->_pvt->reply_handler(pc);
+}
+
+PendingCall::PendingCall(PendingCall::Private *p)
+: _pvt(p)
+{
+ if (!dbus_pending_call_set_notify(_pvt->call, Private::notify_stub, this, NULL))
+ {
+ throw ErrorNoMemory("Unable to initialize pending call");
+ }
+}
+
+PendingCall::PendingCall(const PendingCall &c)
+: _pvt(c._pvt)
+{
+ dbus_pending_call_ref(_pvt->call);
+}
+
+PendingCall::~PendingCall()
+{
+ dbus_pending_call_unref(_pvt->call);
+}
+
+PendingCall &PendingCall::operator = (const PendingCall &c)
+{
+ if (&c != this)
+ {
+ dbus_pending_call_unref(_pvt->call);
+ _pvt = c._pvt;
+ dbus_pending_call_ref(_pvt->call);
+ }
+ return *this;
+}
+
+bool PendingCall::completed()
+{
+ return dbus_pending_call_get_completed(_pvt->call);
+}
+
+void PendingCall::cancel()
+{
+ dbus_pending_call_cancel(_pvt->call);
+}
+
+void PendingCall::block()
+{
+ dbus_pending_call_block(_pvt->call);
+}
+
+void PendingCall::data(void *p)
+{
+ if (!dbus_pending_call_set_data(_pvt->call, _pvt->dataslot, p, NULL))
+ {
+ throw ErrorNoMemory("Unable to initialize data slot");
+ }
+}
+
+void *PendingCall::data()
+{
+ return dbus_pending_call_get_data(_pvt->call, _pvt->dataslot);
+}
+
+AsyncReplyHandler& PendingCall::reply_handler()
+{
+ return _pvt->reply_handler;
+}
+
+void PendingCall::reply_handler(const AsyncReplyHandler& handler)
+{
+ _pvt->reply_handler = handler;
+}
+
+Message PendingCall::steal_reply()
+{
+ DBusMessage *dmsg = dbus_pending_call_steal_reply(_pvt->call);
+ if (!dmsg)
+ {
+ dbus_bool_t callComplete = dbus_pending_call_get_completed(_pvt->call);
+
+ if (callComplete)
+ throw ErrorNoReply("No reply available");
+ else
+ throw ErrorNoReply("Call not complete");
+ }
+
+ return Message(new Message::Private(dmsg));
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall_p.h b/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall_p.h
new file mode 100644
index 00000000000..e0e3133e2f4
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/pendingcall_p.h
@@ -0,0 +1,54 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_PENDING_CALL_P_H
+#define __DBUSXX_PENDING_CALL_P_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/pendingcall.h>
+#include <dbus-c++/refptr_impl.h>
+
+#include <dbus/dbus.h>
+
+namespace DBus {
+
+struct DXXAPILOCAL PendingCall::Private
+{
+ DBusPendingCall *call;
+ int dataslot;
+ AsyncReplyHandler reply_handler;
+
+ Private(DBusPendingCall *);
+
+ ~Private();
+
+ static void notify_stub(DBusPendingCall *dpc, void *data);
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_PENDING_CALL_P_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/property.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/property.cpp
new file mode 100644
index 00000000000..52a6804ba2e
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/property.cpp
@@ -0,0 +1,192 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+#include <dbus-c++/property.h>
+
+#include <dbus-c++/introspection.h>
+
+using namespace DBus;
+
+static const char *properties_name = "org.freedesktop.DBus.Properties";
+
+PropertiesAdaptor::PropertiesAdaptor()
+: InterfaceAdaptor(properties_name)
+{
+ register_method(PropertiesAdaptor, Get, Get);
+ register_method(PropertiesAdaptor, Set, Set);
+ register_method(PropertiesAdaptor, GetAll, GetAll);
+}
+
+Message PropertiesAdaptor::Get(const CallMessage &call)
+{
+ MessageIter ri = call.reader();
+
+ std::string iface_name;
+ std::string property_name;
+
+ ri >> iface_name >> property_name;
+
+ debug_log("requesting property %s on interface %s", property_name.c_str(), iface_name.c_str());
+
+ InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name);
+
+ if (!interface)
+ throw ErrorFailed("requested interface not found");
+
+ Variant *value = interface->get_property(property_name);
+
+ if (!value)
+ throw ErrorFailed("requested property not found");
+
+ if (value->signature().empty())
+ throw ErrorFailed("requested property has not been initialized");
+
+ on_get_property(*interface, property_name, *value);
+
+ ReturnMessage reply(call);
+
+ MessageIter wi = reply.writer();
+
+ wi << *value;
+ return reply;
+}
+
+Message PropertiesAdaptor::Set(const CallMessage &call)
+{
+ MessageIter ri = call.reader();
+
+ std::string iface_name;
+ std::string property_name;
+ Variant value;
+
+ ri >> iface_name >> property_name >> value;
+
+ InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name);
+
+ if (!interface)
+ throw ErrorFailed("requested interface not found");
+
+ on_set_property(*interface, property_name, value);
+
+ interface->set_property(property_name, value);
+
+ ReturnMessage reply(call);
+
+ return reply;
+}
+
+Message PropertiesAdaptor::GetAll(const CallMessage &call)
+{
+ MessageIter ri = call.reader();
+
+ std::string iface_name;
+ std::string property_name;
+ Variant value;
+
+ ri >> iface_name;
+
+ InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name);
+
+ if (!interface)
+ throw ErrorFailed("requested interface not found");
+
+ PropertyDict *properties;
+ properties = interface->get_all_properties();
+
+ ReturnMessage reply(call);
+
+ MessageIter wi = reply.writer();
+
+ wi << *properties;
+ delete properties;
+ return reply;
+}
+
+const IntrospectedInterface *PropertiesAdaptor::introspect() const
+{
+ static IntrospectedArgument Get_args[] =
+ {
+ { "interface_name", "s", true },
+ { "property_name", "s", true },
+ { "value", "v", false },
+ { 0, 0, 0 }
+ };
+ static IntrospectedArgument Set_args[] =
+ {
+ { "interface_name", "s", true },
+ { "property_name", "s", true },
+ { "value", "v", true },
+ { 0, 0, 0 }
+ };
+ static IntrospectedArgument GetAll_args[] =
+ {
+ { "interface_name", "s", true },
+ { "properties", "a{sv}", false },
+ { 0, 0, 0 }
+ };
+ static IntrospectedMethod Properties_methods[] =
+ {
+ { "Get", Get_args },
+ { "Set", Set_args },
+ { "GetAll", GetAll_args },
+ { 0, 0 }
+ };
+ static IntrospectedMethod Properties_signals[] =
+ {
+ { 0, 0 }
+ };
+ static IntrospectedProperty Properties_properties[] =
+ {
+ { 0, 0, 0, 0 }
+ };
+ static IntrospectedInterface Properties_interface =
+ {
+ properties_name,
+ Properties_methods,
+ Properties_signals,
+ Properties_properties
+ };
+ return &Properties_interface;
+}
+
+PropertiesProxy::PropertiesProxy()
+: InterfaceProxy(properties_name)
+{
+}
+
+Variant PropertiesProxy::Get(const std::string &iface, const std::string &property)
+{
+//todo
+ Variant v;
+ return v;
+}
+
+void PropertiesProxy::Set(const std::string &iface, const std::string &property, const Variant &value)
+{
+//todo
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/server.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/server.cpp
new file mode 100644
index 00000000000..0c652e55109
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/server.cpp
@@ -0,0 +1,129 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/debug.h>
+#include <dbus-c++/server.h>
+
+#include "internalerror.h"
+#include "server_p.h"
+#include "connection_p.h"
+#include "dispatcher_p.h"
+
+using namespace DBus;
+
+Server::Private::Private(DBusServer *s)
+: server(s)
+{
+}
+
+Server::Private::~Private()
+{
+}
+
+void Server::Private::on_new_conn_cb(DBusServer *server, DBusConnection *conn, void *data)
+{
+ Server *s = static_cast<Server *>(data);
+
+ Connection nc (new Connection::Private(conn, s->_pvt.get()));
+
+ s->_pvt->connections.push_back(nc);
+
+ s->on_new_connection(nc);
+
+ debug_log("incoming connection 0x%08x", conn);
+}
+
+Server::Server(const char *address)
+{
+ InternalError e;
+ DBusServer *server = dbus_server_listen(address, e);
+
+ if (e) throw Error(e);
+
+ debug_log("server 0x%08x listening on %s", server, address);
+
+ _pvt = new Private(server);
+
+ dbus_server_set_new_connection_function(_pvt->server, Private::on_new_conn_cb, this, NULL);
+
+ setup(default_dispatcher);
+}
+/*
+Server::Server(const Server &s)
+: _pvt(s._pvt)
+{
+ dbus_server_ref(_pvt->server);
+}
+*/
+Server::~Server()
+{
+ dbus_server_unref(_pvt->server);
+}
+
+Dispatcher *Server::setup(Dispatcher *dispatcher)
+{
+ debug_log("registering stubs for server %p", _pvt->server);
+
+ Dispatcher *prev = _pvt->dispatcher;
+
+ dbus_server_set_watch_functions(
+ _pvt->server,
+ Dispatcher::Private::on_add_watch,
+ Dispatcher::Private::on_rem_watch,
+ Dispatcher::Private::on_toggle_watch,
+ dispatcher,
+ 0
+ );
+
+ dbus_server_set_timeout_functions(
+ _pvt->server,
+ Dispatcher::Private::on_add_timeout,
+ Dispatcher::Private::on_rem_timeout,
+ Dispatcher::Private::on_toggle_timeout,
+ dispatcher,
+ 0
+ );
+
+ _pvt->dispatcher = dispatcher;
+
+ return prev;
+}
+
+bool Server::operator == (const Server &s) const
+{
+ return _pvt->server == s._pvt->server;
+}
+
+bool Server::listening() const
+{
+ return dbus_server_get_is_connected(_pvt->server);
+}
+void Server::disconnect()
+{
+ dbus_server_disconnect(_pvt->server);
+}
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/server_p.h b/chromium/third_party/cros_dbus_cplusplus/source/src/server_p.h
new file mode 100644
index 00000000000..826132d2bd6
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/server_p.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_SERVER_P_H
+#define __DBUSXX_SERVER_P_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/server.h>
+#include <dbus-c++/dispatcher.h>
+#include <dbus-c++/refptr_impl.h>
+
+#include <dbus/dbus.h>
+
+namespace DBus {
+
+struct DXXAPILOCAL Server::Private
+{
+ DBusServer *server;
+
+ Dispatcher *dispatcher;
+
+ ConnectionList connections;
+
+ Private(DBusServer *);
+
+ ~Private();
+
+ static void on_new_conn_cb(DBusServer *server, DBusConnection *conn, void *data);
+};
+
+} /* namespace DBus */
+
+#endif//__DBUSXX_SERVER_P_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/src/types.cpp b/chromium/third_party/cros_dbus_cplusplus/source/src/types.cpp
new file mode 100644
index 00000000000..9d61d446b45
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/src/types.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/types.h>
+#include <dbus-c++/object.h>
+#include <dbus/dbus.h>
+#include <cstdlib>
+#include <stdarg.h>
+
+#include "message_p.h"
+#include "internalerror.h"
+
+using namespace DBus;
+
+Variant::Variant()
+: _msg(CallMessage()) // dummy message used as temporary storage for variant data
+{
+}
+
+Variant::Variant(MessageIter &it)
+: _msg(CallMessage())
+{
+ MessageIter vi = it.recurse();
+ MessageIter mi = _msg.writer();
+ vi.copy_data(mi);
+}
+
+Variant &Variant::operator = (const Variant &v)
+{
+ if (&v != this)
+ {
+ _msg = v._msg;
+ }
+ return *this;
+}
+
+void Variant::clear()
+{
+ CallMessage empty;
+ _msg = empty;
+}
+
+const Signature Variant::signature() const
+{
+ char *sigbuf = reader().signature();
+
+ Signature signature = sigbuf;
+
+ free(sigbuf);
+
+ return signature;
+}
+
+MessageIter &operator << (MessageIter &iter, const Variant &val)
+{
+ const Signature sig = val.signature();
+
+ MessageIter rit = val.reader();
+ MessageIter wit = iter.new_variant(sig.c_str());
+
+ rit.copy_data(wit);
+
+ iter.close_container(wit);
+
+ return iter;
+}
+
+MessageIter &operator >> (MessageIter &iter, Variant &val)
+{
+ if (iter.type() != DBUS_TYPE_VARIANT)
+ throw ErrorInvalidArgs("variant type expected");
+
+ val.clear();
+
+ MessageIter vit = iter.recurse();
+ MessageIter mit = val.writer();
+
+ vit.copy_data(mit);
+
+ return ++iter;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/Makefile.am b/chromium/third_party/cros_dbus_cplusplus/source/tools/Makefile.am
new file mode 100644
index 00000000000..8e2d8b9a28b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/Makefile.am
@@ -0,0 +1,32 @@
+# hacky, but ...
+
+CXX = $(CXX_FOR_BUILD)
+
+AM_CPPFLAGS = \
+ $(dbus_CFLAGS) \
+ $(xml_CFLAGS) \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/ctemplate \
+ -DDATADIR=\"$(pkgdatadir)/\"
+ -Wall
+
+if CROSS_COMPILING
+libdbus_cxx_la = $(BUILD_LIBDBUS_CXX_DIR)/src/libdbus-c++-1.la
+else
+libdbus_cxx_la = $(top_builddir)/src/libdbus-c++-1.la
+endif
+
+bin_PROGRAMS = dbusxx-xml2cpp dbusxx-introspect
+
+dbusxx_xml2cpp_SOURCES = xml.h xml.cpp xml2cpp.h xml2cpp.cpp \
+ generate_stubs.cpp generate_stubs.h generator_utils.cpp generator_utils.h
+dbusxx_xml2cpp_LDADD = $(libdbus_cxx_la) $(xml_LIBS) -lctemplate_nothreads
+
+dbusxx_introspect_SOURCES = introspect.h introspect.cpp
+dbusxx_introspect_LDADD = $(libdbus_cxx_la)
+
+pkgdata_DATA = proxy-stubs.tpl adaptor-stubs.tpl ef-adaptor-stubs.tpl
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/adaptor-stubs.tpl b/chromium/third_party/cros_dbus_cplusplus/source/tools/adaptor-stubs.tpl
new file mode 100644
index 00000000000..7981a581453
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/adaptor-stubs.tpl
@@ -0,0 +1,148 @@
+/*
+ * {{AUTO_GENERATED_WARNING}}
+ */
+#ifndef __dbusxx__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
+#define __dbusxx__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
+
+#include <dbus-c++/dbus.h>
+#include <cassert>{{BI_NEWLINE}}
+
+{{#FOR_EACH_INTERFACE}}
+{{#FOR_EACH_NAMESPACE}}
+namespace {{NAMESPACE_NAME}} {
+{{/FOR_EACH_NAMESPACE}}
+
+{{BI_NEWLINE}}class {{CLASS_NAME}}_adaptor
+ : public ::DBus::InterfaceAdaptor
+{
+public:
+
+ {{CLASS_NAME}}_adaptor()
+ : ::DBus::InterfaceAdaptor("{{INTERFACE_NAME}}")
+ {
+{{#FOR_EACH_PROPERTY}}
+ bind_property({{PROP_NAME}}, "{{PROP_SIG}}", {{PROP_READABLE}}, {{PROP_WRITEABLE}});
+{{/FOR_EACH_PROPERTY}}
+{{#FOR_EACH_METHOD}}
+ register_method({{CLASS_NAME}}_adaptor, {{METHOD_NAME}}, _{{METHOD_NAME}}_stub);
+{{/FOR_EACH_METHOD}}
+ }
+
+ const ::DBus::IntrospectedInterface *introspect() const
+ {
+{{#FOR_EACH_METHOD}}
+ static const ::DBus::IntrospectedArgument {{METHOD_NAME}}_args[] =
+ {
+ {{#FOR_EACH_METHOD_ARG}}
+ { "{{METHOD_ARG_NAME}}", "{{METHOD_ARG_SIG}}", {{METHOD_ARG_IN_OUT}} },
+ {{/FOR_EACH_METHOD_ARG}}
+ { 0, 0, 0 }
+ };
+{{/FOR_EACH_METHOD}}
+{{#FOR_EACH_SIGNAL}}
+ static const ::DBus::IntrospectedArgument {{SIGNAL_NAME}}_args[] =
+ {
+ {{#FOR_EACH_SIGNAL_ARG}}
+ { "{{SIGNAL_ARG_NAME}}", "{{SIGNAL_ARG_SIG}}", false },
+ {{/FOR_EACH_SIGNAL_ARG}}
+ { 0, 0, 0 }
+ };
+{{/FOR_EACH_SIGNAL}}
+ static const ::DBus::IntrospectedMethod {{CLASS_NAME}}_adaptor_methods[] =
+ {
+{{#FOR_EACH_METHOD}}
+ { "{{METHOD_NAME}}", {{METHOD_NAME}}_args },
+{{/FOR_EACH_METHOD}}
+ { 0, 0 }
+ };
+ static const ::DBus::IntrospectedMethod {{CLASS_NAME}}_adaptor_signals[] =
+ {
+{{#FOR_EACH_SIGNAL}}
+ { "{{SIGNAL_NAME}}", {{SIGNAL_NAME}}_args },
+{{/FOR_EACH_SIGNAL}}
+ { 0, 0 }
+ };
+ static const ::DBus::IntrospectedProperty {{CLASS_NAME}}_adaptor_properties[] =
+ {
+{{#FOR_EACH_PROPERTY}}
+ { "{{PROP_NAME}}", "{{PROP_SIG}}", {{PROP_READABLE}}, {{PROP_WRITEABLE}} },
+{{/FOR_EACH_PROPERTY}}
+ { 0, 0, 0, 0 }
+ };
+ static const ::DBus::IntrospectedInterface {{CLASS_NAME}}_adaptor_interface =
+ {
+ "{{INTERFACE_NAME}}",
+ {{CLASS_NAME}}_adaptor_methods,
+ {{CLASS_NAME}}_adaptor_signals,
+ {{CLASS_NAME}}_adaptor_properties
+ };
+ return &{{CLASS_NAME}}_adaptor_interface;
+ }
+
+ /* Properties exposed by this interface.
+ * Use property() and property(value) to
+ * get and set a particular property.
+ */
+{{#FOR_EACH_PROPERTY}}
+ ::DBus::PropertyAdaptor<{{PROP_TYPE}} > {{PROP_NAME}};
+{{/FOR_EACH_PROPERTY}}
+
+ /* Methods exported by this interface.
+ * You will have to implement them in your ObjectAdaptor.
+ */
+{{#FOR_EACH_METHOD}}
+ virtual {{METHOD_RETURN_TYPE}} {{METHOD_NAME}}({{#METHOD_ADAPTOR_ARG_LIST}}{{METHOD_ARG_DECL}}{{#METHOD_ADAPTOR_ARG_LIST_separator}}, {{/METHOD_ADAPTOR_ARG_LIST_separator}}{{/METHOD_ADAPTOR_ARG_LIST}}) = 0;
+{{/FOR_EACH_METHOD}}
+
+ /* signal emitters for this interface */
+{{#FOR_EACH_SIGNAL}}
+ void {{SIGNAL_NAME}}({{#CONST_SIGNAL_ARG_LIST}}{{SIGNAL_ARG_DECL}}{{#CONST_SIGNAL_ARG_LIST_separator}}, {{/CONST_SIGNAL_ARG_LIST_separator}}{{/CONST_SIGNAL_ARG_LIST}})
+ {
+ ::DBus::SignalMessage __sig("{{SIGNAL_NAME}}");
+{{#SIGNAL_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __sig.writer();
+{{#FOR_EACH_SIGNAL_ARG}}
+ __wi << {{SIGNAL_ARG_NAME}};
+{{/FOR_EACH_SIGNAL_ARG}}
+{{/SIGNAL_ARGS_SECTION}}
+ emit_signal(__sig);
+ }
+{{/FOR_EACH_SIGNAL}}
+
+private:
+ /* unmarshallers (to unpack the DBus message before calling the actual
+ * interface method)
+ */
+{{#FOR_EACH_METHOD}}
+ ::DBus::Message _{{METHOD_NAME}}_stub(const ::DBus::CallMessage &__call)
+ {
+ ::DBus::Error __error;
+{{#METHOD_IN_ARGS_SECTION}}
+ ::DBus::MessageIter __ri = __call.reader();
+{{#FOR_EACH_METHOD_IN_ARG}}
+ {{METHOD_IN_ARG_TYPE}} {{METHOD_IN_ARG_NAME}}; __ri >> {{METHOD_IN_ARG_NAME}};
+{{/FOR_EACH_METHOD_IN_ARG}}
+{{/METHOD_IN_ARGS_SECTION}}
+{{#METHOD_OUT_ARGS_SECTION}}
+{{#FOR_EACH_METHOD_OUT_ARG}}
+ {{METHOD_OUT_ARG_TYPE}} {{METHOD_OUT_ARG_NAME}};
+{{/FOR_EACH_METHOD_OUT_ARG}}
+{{/METHOD_OUT_ARGS_SECTION}}
+ {{METHOD_RETURN_ASSIGN}}{{METHOD_NAME}}({{#METHOD_ADAPTOR_ARG_LIST}}{{METHOD_ARG_NAME}}{{#METHOD_ADAPTOR_ARG_LIST_separator}}, {{/METHOD_ADAPTOR_ARG_LIST_separator}}{{/METHOD_ADAPTOR_ARG_LIST}});
+ if (__error.is_set())
+ return ::DBus::ErrorMessage(__call, __error.name(), __error.message());
+ ::DBus::ReturnMessage __reply(__call);
+{{#METHOD_OUT_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __reply.writer();
+{{#FOR_EACH_METHOD_OUT_ARG}}
+ __wi << {{METHOD_OUT_ARG_NAME}};
+{{/FOR_EACH_METHOD_OUT_ARG}}
+{{/METHOD_OUT_ARGS_SECTION}}
+ return __reply;
+ }
+{{/FOR_EACH_METHOD}}
+};
+{{#FOR_EACH_NAMESPACE}}}{{/FOR_EACH_NAMESPACE}}
+{{/FOR_EACH_INTERFACE}}
+
+#endif // __dbusxx__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/ef-adaptor-stubs.tpl b/chromium/third_party/cros_dbus_cplusplus/source/tools/ef-adaptor-stubs.tpl
new file mode 100644
index 00000000000..f6b16fcfc7b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/ef-adaptor-stubs.tpl
@@ -0,0 +1,186 @@
+/*
+ * {{AUTO_GENERATED_WARNING}}
+ */
+#ifndef __dbusxx_ef__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
+#define __dbusxx_ef__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
+
+#include <dbus-c++/dbus.h>
+#include <cassert>{{BI_NEWLINE}}
+
+{{#FOR_EACH_INTERFACE}}
+{{#FOR_EACH_NAMESPACE}}
+namespace {{NAMESPACE_NAME}} {
+{{/FOR_EACH_NAMESPACE}}
+
+{{BI_NEWLINE}}class {{CLASS_NAME}}_adaptor
+ : public ::DBus::InterfaceAdaptor
+{
+public:
+
+ {{CLASS_NAME}}_adaptor()
+ : ::DBus::InterfaceAdaptor("{{INTERFACE_NAME}}")
+ {
+{{#FOR_EACH_PROPERTY}}
+ bind_property({{PROP_NAME}}, "{{PROP_SIG}}", {{PROP_READABLE}}, {{PROP_WRITEABLE}});
+{{/FOR_EACH_PROPERTY}}
+{{#FOR_EACH_METHOD}}
+ register_method({{CLASS_NAME}}_adaptor, {{METHOD_NAME}}, _{{METHOD_NAME}}_stub);
+{{/FOR_EACH_METHOD}}
+ }
+
+ const ::DBus::IntrospectedInterface *introspect() const
+ {
+{{#FOR_EACH_METHOD}}
+ static const ::DBus::IntrospectedArgument {{METHOD_NAME}}_args[] =
+ {
+ {{#FOR_EACH_METHOD_ARG}}
+ { "{{METHOD_ARG_NAME}}", "{{METHOD_ARG_SIG}}", {{METHOD_ARG_IN_OUT}} },
+ {{/FOR_EACH_METHOD_ARG}}
+ { 0, 0, 0 }
+ };
+{{/FOR_EACH_METHOD}}
+{{#FOR_EACH_SIGNAL}}
+ static const ::DBus::IntrospectedArgument {{SIGNAL_NAME}}_args[] =
+ {
+ {{#FOR_EACH_SIGNAL_ARG}}
+ { "{{SIGNAL_ARG_NAME}}", "{{SIGNAL_ARG_SIG}}", false },
+ {{/FOR_EACH_SIGNAL_ARG}}
+ { 0, 0, 0 }
+ };
+{{/FOR_EACH_SIGNAL}}
+ static const ::DBus::IntrospectedMethod {{CLASS_NAME}}_adaptor_methods[] =
+ {
+{{#FOR_EACH_METHOD}}
+ { "{{METHOD_NAME}}", {{METHOD_NAME}}_args },
+{{/FOR_EACH_METHOD}}
+ { 0, 0 }
+ };
+ static const ::DBus::IntrospectedMethod {{CLASS_NAME}}_adaptor_signals[] =
+ {
+{{#FOR_EACH_SIGNAL}}
+ { "{{SIGNAL_NAME}}", {{SIGNAL_NAME}}_args },
+{{/FOR_EACH_SIGNAL}}
+ { 0, 0 }
+ };
+ static const ::DBus::IntrospectedProperty {{CLASS_NAME}}_adaptor_properties[] =
+ {
+{{#FOR_EACH_PROPERTY}}
+ { "{{PROP_NAME}}", "{{PROP_SIG}}", {{PROP_READABLE}}, {{PROP_WRITEABLE}} },
+{{/FOR_EACH_PROPERTY}}
+ { 0, 0, 0, 0 }
+ };
+ static const ::DBus::IntrospectedInterface {{CLASS_NAME}}_adaptor_interface =
+ {
+ "{{INTERFACE_NAME}}",
+ {{CLASS_NAME}}_adaptor_methods,
+ {{CLASS_NAME}}_adaptor_signals,
+ {{CLASS_NAME}}_adaptor_properties
+ };
+ return &{{CLASS_NAME}}_adaptor_interface;
+ }
+
+ /* Properties exposed by this interface.
+ * Use property() and property(value) to
+ * get and set a particular property.
+ */
+{{#FOR_EACH_PROPERTY}}
+ ::DBus::PropertyAdaptor< {{PROP_TYPE}} > {{PROP_NAME}};
+{{/FOR_EACH_PROPERTY}}
+
+ /* Methods exported by this interface.
+ * You will have to implement them in your ObjectAdaptor.
+ *
+ * Your code should return in one of 3 ways:
+ *
+ * Return a result:
+ * return XxxxMakeReply(call, _return_values, ...);
+ *
+ * Return an error:
+ * return DBus::ErrorMessage(call, "org.foo", "my error");
+ *
+ * Return a continuation:
+ * DBus::Tag *tag = new DBus::Tag(); // Or tag from other obj
+ * return DBus::TagMessage(tag);
+ *
+ * // Later do....
+ * Continuation *ret = find_continuation(tag);
+ * XxxxWriteReply(ret->writer(), _return_values, ...);
+ * return_now(ret);
+ *
+ * // Or later do...
+ * Continuation *ret = find_continuation(tag);
+ * return_error(ret, DBus::Error("org.foo", "my error");
+ *
+ */
+{{#FOR_EACH_METHOD}}
+ virtual ::DBus::Message {{METHOD_NAME}}(const ::DBus::CallMessage &__call{{#METHOD_IN_ARGS_SECTION}}, {{#FOR_EACH_METHOD_IN_ARG}}const {{METHOD_IN_ARG_TYPE}} &{{METHOD_IN_ARG_NAME}}{{#FOR_EACH_METHOD_IN_ARG_separator}}, {{/FOR_EACH_METHOD_IN_ARG_separator}}{{/FOR_EACH_METHOD_IN_ARG}}{{/METHOD_IN_ARGS_SECTION}}) = 0;
+{{/FOR_EACH_METHOD}}
+
+ /* signal emitters for this interface */
+{{#FOR_EACH_SIGNAL}}
+ void {{SIGNAL_NAME}}({{#CONST_SIGNAL_ARG_LIST}}{{SIGNAL_ARG_DECL}}{{#CONST_SIGNAL_ARG_LIST_separator}}, {{/CONST_SIGNAL_ARG_LIST_separator}}{{/CONST_SIGNAL_ARG_LIST}})
+ {
+ ::DBus::SignalMessage __sig("{{SIGNAL_NAME}}");
+{{#SIGNAL_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __sig.writer();
+{{#FOR_EACH_SIGNAL_ARG}}
+ __wi << {{SIGNAL_ARG_NAME}};
+{{/FOR_EACH_SIGNAL_ARG}}
+{{/SIGNAL_ARGS_SECTION}}
+ emit_signal(__sig);
+ }
+{{/FOR_EACH_SIGNAL}}
+
+protected:
+ /* The following functions, XxxxMakeReply and XxxxWriteReply,
+ * are helper functions which can be used when returning a result in an
+ * adaptor implemented method or in a continuation returning a result
+ * asynchronously. See the examples above.
+ */
+{{#FOR_EACH_METHOD}}
+ ::DBus::Message {{METHOD_NAME}}MakeReply(const ::DBus::CallMessage &__call{{#METHOD_OUT_ARGS_SECTION}}, {{#FOR_EACH_METHOD_OUT_ARG}}const {{METHOD_OUT_ARG_TYPE}} &{{METHOD_OUT_ARG_NAME}}{{#FOR_EACH_METHOD_OUT_ARG_separator}}, {{/FOR_EACH_METHOD_OUT_ARG_separator}}{{/FOR_EACH_METHOD_OUT_ARG}}{{/METHOD_OUT_ARGS_SECTION}})
+ {
+ ::DBus::ReturnMessage __reply(__call);
+ // Maybe this should just call XxxxWriteReply();
+{{#METHOD_OUT_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __reply.writer();
+{{#FOR_EACH_METHOD_OUT_ARG}}
+ __wi << {{METHOD_OUT_ARG_NAME}};
+{{/FOR_EACH_METHOD_OUT_ARG}}
+{{/METHOD_OUT_ARGS_SECTION}}
+ return __reply;
+ }
+
+ void {{METHOD_NAME}}WriteReply(::DBus::MessageIter &__wi{{#METHOD_OUT_ARGS_SECTION}}, {{#FOR_EACH_METHOD_OUT_ARG}}const {{METHOD_OUT_ARG_TYPE}} &{{METHOD_OUT_ARG_NAME}}{{#FOR_EACH_METHOD_OUT_ARG_separator}}, {{/FOR_EACH_METHOD_OUT_ARG_separator}}{{/FOR_EACH_METHOD_OUT_ARG}}{{/METHOD_OUT_ARGS_SECTION}})
+ {
+{{#METHOD_OUT_ARGS_SECTION}}
+{{#FOR_EACH_METHOD_OUT_ARG}}
+ __wi << {{METHOD_OUT_ARG_NAME}};
+{{/FOR_EACH_METHOD_OUT_ARG}}
+{{/METHOD_OUT_ARGS_SECTION}}
+ }
+{{/FOR_EACH_METHOD}}
+
+
+private:
+ /* unmarshallers (to unpack the DBus message before calling the actual
+ * interface method)
+ */
+{{#FOR_EACH_METHOD}}
+ ::DBus::Message _{{METHOD_NAME}}_stub(const ::DBus::CallMessage &__call)
+ {
+{{#METHOD_IN_ARGS_SECTION}}
+ ::DBus::MessageIter __ri = __call.reader();
+{{#FOR_EACH_METHOD_IN_ARG}}
+ {{METHOD_IN_ARG_TYPE}} {{METHOD_IN_ARG_NAME}}; __ri >> {{METHOD_IN_ARG_NAME}};
+{{/FOR_EACH_METHOD_IN_ARG}}
+{{/METHOD_IN_ARGS_SECTION}}
+ return {{METHOD_NAME}}(__call{{#METHOD_IN_ARGS_SECTION}}, {{#FOR_EACH_METHOD_IN_ARG}}{{METHOD_IN_ARG_NAME}}{{#FOR_EACH_METHOD_IN_ARG_separator}}, {{/FOR_EACH_METHOD_IN_ARG_separator}}{{/FOR_EACH_METHOD_IN_ARG}}{{/METHOD_IN_ARGS_SECTION}});
+
+ }
+{{/FOR_EACH_METHOD}}
+};
+{{#FOR_EACH_NAMESPACE}}}{{/FOR_EACH_NAMESPACE}}
+{{/FOR_EACH_INTERFACE}}
+
+#endif // __dbusxx_ef__{{FILE_STRING}}__ADAPTOR_MARSHALL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.cpp b/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.cpp
new file mode 100644
index 00000000000..7f16091eefe
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.cpp
@@ -0,0 +1,355 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
+#include <ctemplate/template.h>
+
+#include "generator_utils.h"
+#include "generate_stubs.h"
+
+using namespace ctemplate;
+using namespace std;
+using namespace DBus;
+
+/*! Generate RPC stub code for an XML introspection
+*/
+
+/*! Generate the code for the methods in the introspection file.
+ * Each call to this function can generate code for either the
+ * synchronous, blocking versions of the method invocations, or
+ * for the asynchronous, non-blocking versions.
+ */
+void generate_methods(TemplateDictionary *dict, Xml::Nodes &methods)
+{
+ // this loop generates all methods
+ for (Xml::Nodes::iterator mi = methods.begin(); mi != methods.end(); ++mi)
+ {
+ Xml::Node &method = **mi;
+ Xml::Nodes args = method["arg"];
+ Xml::Nodes args_in = args.select("direction", "in");
+ Xml::Nodes args_out = args.select("direction", "out");
+ string name(method.get("name"));
+
+ TemplateDictionary *sync_method_dict =
+ dict->AddSectionDictionary("FOR_EACH_METHOD");
+ TemplateDictionary *async_method_dict =
+ dict->AddSectionDictionary("FOR_EACH_ASYNC_METHOD");
+ TemplateDictionary *method_dicts[] = {
+ sync_method_dict,
+ async_method_dict
+ };
+ int m;
+ for (m = 0; m < 2; m++)
+ method_dicts[m]->SetValue("METHOD_NAME", legalize(name));
+ if (args_out.size() == 1)
+ sync_method_dict->SetValue("METHOD_RETURN_TYPE",
+ signature_to_type(args_out.front()->get("type")));
+ else
+ sync_method_dict->SetValue("METHOD_RETURN_TYPE", "void");
+
+ // generate all 'in' arguments for a method signature
+ if (args_in.size() > 0)
+ {
+ for (m = 0; m < 2; m++)
+ method_dicts[m]->ShowSection("METHOD_IN_ARGS_SECTION");
+ }
+
+ unsigned int i = 0;
+ TemplateDictionary *arg_dict;
+ TemplateDictionary *adaptor_arg_dict;
+ TemplateDictionary *all_args_dict;
+ for (Xml::Nodes::iterator ai = args_in.begin(); ai != args_in.end(); ++ai, ++i)
+ {
+ Xml::Node &arg = **ai;
+ string arg_type = signature_to_type(arg.get("type"));
+ string arg_decl = "const " + arg_type + "& ";
+ string arg_name = arg.get("name");
+ arg_name = arg_name.empty() ?
+ ("argin" + i) : legalize(arg_name);
+ arg_decl += arg_name;
+ for (m = 0; m < 2; m++)
+ {
+ arg_dict = method_dicts[m]->AddSectionDictionary("METHOD_ARG_LIST");
+
+ arg_dict->SetValue("METHOD_ARG_DECL", arg_decl);
+ arg_dict->SetValue("METHOD_ARG_NAME", arg_name);
+
+ TemplateDictionary *inarg_dict = method_dicts[m]->AddSectionDictionary("FOR_EACH_METHOD_IN_ARG");
+ inarg_dict->SetValue("METHOD_IN_ARG_NAME", arg_name);
+ inarg_dict->SetValue("METHOD_IN_ARG_TYPE", arg_type);
+
+ all_args_dict = method_dicts[m]->AddSectionDictionary("FOR_EACH_METHOD_ARG");
+ all_args_dict->SetValue("METHOD_ARG_NAME", arg_name);
+ all_args_dict->SetValue("METHOD_ARG_SIG", arg.get("type"));
+ all_args_dict->SetValue("METHOD_ARG_IN_OUT", "true");
+ }
+ adaptor_arg_dict = sync_method_dict->AddSectionDictionary("METHOD_ADAPTOR_ARG_LIST");
+ adaptor_arg_dict->SetValue("METHOD_ARG_DECL", arg_decl);
+ adaptor_arg_dict->SetValue("METHOD_ARG_NAME", arg_name);
+ }
+ arg_dict = async_method_dict->AddSectionDictionary("METHOD_ARG_LIST");
+ arg_dict->SetValue("METHOD_ARG_DECL", "void* __data");
+ arg_dict = async_method_dict->AddSectionDictionary("METHOD_ARG_LIST");
+ arg_dict->SetValue("METHOD_ARG_DECL", "int __timeout=-1");
+
+ // generate all 'out' arguments for a method signature
+ if (args_out.size() > 0)
+ {
+ sync_method_dict->SetValue("METHOD_INVOKE_RET", "::DBus::Message __ret = ");
+ for (m = 0; m < 2; m++)
+ method_dicts[m]->ShowSection("METHOD_OUT_ARGS_SECTION");
+ }
+
+ TemplateDictionary *cbarg_dict;
+ TemplateDictionary *outarg_list_dict;
+ i = 0;
+ if (args_out.size() == 1)
+ {
+ TemplateDictionary *outarg_dict
+ = sync_method_dict->AddSectionDictionary("FOR_EACH_METHOD_OUT_ARG");
+ Xml::Node *arg = args_out.front();
+ sync_method_dict->ShowSection("METHOD_RETURN");
+ sync_method_dict->SetValue("METHOD_RETURN_NAME", "__argout");
+ sync_method_dict->SetValue("METHOD_RETURN_ASSIGN", "__argout = ");
+ outarg_dict->SetValue("METHOD_OUT_ARG_NAME", "__argout");
+ outarg_dict->SetValue("METHOD_OUT_ARG_TYPE",
+ signature_to_type(arg->get("type")));
+ outarg_dict->ShowSection("METHOD_OUT_ARG_DECL");
+ all_args_dict = sync_method_dict->AddSectionDictionary("FOR_EACH_METHOD_ARG");
+ all_args_dict->SetValue("METHOD_ARG_NAME", arg->get("name"));
+ all_args_dict->SetValue("METHOD_ARG_SIG", arg->get("type"));
+ all_args_dict->SetValue("METHOD_ARG_IN_OUT", "false");
+ TemplateDictionary *user_arg_dict =
+ async_method_dict->AddSectionDictionary("FOR_EACH_METHOD_USER_OUT_ARG");
+ string arg_name = arg->get("name");
+ arg_name = arg_name.empty() ? "__argout" : legalize(arg_name);
+ user_arg_dict->SetValue("METHOD_OUT_ARG_NAME", arg_name);
+ string arg_sig = signature_to_type(arg->get("type"));
+ user_arg_dict->SetValue("METHOD_OUT_ARG_TYPE", arg_sig);
+ outarg_list_dict = async_method_dict->AddSectionDictionary("METHOD_OUT_ARG_LIST");
+ outarg_list_dict->SetValue("METHOD_OUT_ARG_NAME", arg_name);
+ cbarg_dict = async_method_dict->AddSectionDictionary("METHOD_CALLBACK_ARG_LIST");
+ string const_arg_decl = "const " + arg_sig + "& /*" + arg_name + "*/";
+ cbarg_dict->SetValue("METHOD_CALLBACK_ARG", const_arg_decl);
+ }
+ else
+ {
+ for (Xml::Nodes::iterator ao = args_out.begin(); ao != args_out.end(); ++ao, ++i)
+ {
+ Xml::Node &arg = **ao;
+ string arg_name = arg.get("name");
+ arg_name = arg_name.empty() ?
+ ("__argout" + i) : legalize(arg_name);
+ string arg_sig = signature_to_type(arg.get("type"));
+ string arg_decl = arg_sig + "& " + arg_name;
+ for (m = 0; m < 2; m++)
+ {
+ TemplateDictionary *outarg_dict =
+ method_dicts[m]->AddSectionDictionary("FOR_EACH_METHOD_OUT_ARG");
+
+ outarg_dict->SetValue("METHOD_OUT_ARG_NAME", arg_name);
+ outarg_dict->SetValue("METHOD_OUT_ARG_TYPE", arg_sig);
+
+ TemplateDictionary *user_arg_dict =
+ method_dicts[m]->AddSectionDictionary("FOR_EACH_METHOD_USER_OUT_ARG");
+ user_arg_dict->SetValue("METHOD_OUT_ARG_NAME", arg_name);
+ user_arg_dict->SetValue("METHOD_OUT_ARG_TYPE", arg_sig);
+ outarg_list_dict = method_dicts[m]->AddSectionDictionary("METHOD_OUT_ARG_LIST");
+ outarg_list_dict->SetValue("METHOD_OUT_ARG_NAME", arg_name);
+ all_args_dict = method_dicts[m]->AddSectionDictionary("FOR_EACH_METHOD_ARG");
+ all_args_dict->SetValue("METHOD_ARG_NAME", arg_name);
+ all_args_dict->SetValue("METHOD_ARG_SIG", arg.get("type"));
+ all_args_dict->SetValue("METHOD_ARG_IN_OUT", "false");
+ }
+ adaptor_arg_dict = sync_method_dict->AddSectionDictionary("METHOD_ADAPTOR_ARG_LIST");
+ adaptor_arg_dict->SetValue("METHOD_ARG_DECL", arg_decl);
+ adaptor_arg_dict->SetValue("METHOD_ARG_NAME", arg_name);
+ sync_method_dict->AddSectionDictionary("METHOD_ARG_LIST")->SetValue("METHOD_ARG_DECL", arg_decl);
+ cbarg_dict = async_method_dict->AddSectionDictionary("METHOD_CALLBACK_ARG_LIST");
+ string const_arg_decl = "const " + arg_sig + "& /*" + arg_name + "*/";
+ cbarg_dict->SetValue("METHOD_CALLBACK_ARG", const_arg_decl);
+ }
+ }
+ adaptor_arg_dict = sync_method_dict->AddSectionDictionary("METHOD_ADAPTOR_ARG_LIST");
+ adaptor_arg_dict->SetValue("METHOD_ARG_NAME", "__error");
+ adaptor_arg_dict->SetValue("METHOD_ARG_DECL", "::DBus::Error &error");
+ cbarg_dict = async_method_dict->AddSectionDictionary("METHOD_CALLBACK_ARG_LIST");
+ cbarg_dict->SetValue("METHOD_CALLBACK_ARG", "const ::DBus::Error& /*__error*/, void* /*__data*/");
+ outarg_list_dict = async_method_dict->AddSectionDictionary("METHOD_OUT_ARG_LIST");
+ outarg_list_dict->SetValue("METHOD_OUT_ARG_NAME", "__error, __data");
+ }
+}
+
+void generate_stubs(Xml::Document &doc, const char *filename,
+ const std::vector< std::pair<string, string> > &macros,
+ bool sync_mode, bool async_mode, const char *template_file)
+{
+ TemplateDictionary dict("stubs-glue");
+ string filestring = filename;
+ underscorize(filestring);
+
+ for(vector< pair<string, string> >::const_iterator iter = macros.begin();
+ iter != macros.end();
+ iter++) {
+ dict.SetValue(iter->first, iter->second);
+ }
+ dict.SetValue("FILE_STRING", filestring);
+ dict.SetValue("AUTO_GENERATED_WARNING",
+ "This file was automatically generated by dbusxx-xml2cpp;"
+ " DO NOT EDIT!");
+
+ Xml::Node &root = *(doc.root);
+ Xml::Nodes interfaces = root["interface"];
+
+ // iterate over all interface definitions
+ for (Xml::Nodes::iterator i = interfaces.begin(); i != interfaces.end(); ++i)
+ {
+ Xml::Node &iface = **i;
+ Xml::Nodes methods = iface["method"];
+ Xml::Nodes signals = iface["signal"];
+ Xml::Nodes properties = iface["property"];
+
+ // gets the name of an interface: <interface name="XYZ">
+ string ifacename = iface.get("name");
+
+ // these interface names are skipped.
+ if (ifacename == "org.freedesktop.DBus.Introspectable")
+ {
+ cerr << "skipping interface " << ifacename << endl;
+ continue;
+ }
+
+ TemplateDictionary *if_dict = dict.AddSectionDictionary("FOR_EACH_INTERFACE");
+
+ if_dict->SetValue("INTERFACE_NAME", ifacename);
+ if (sync_mode)
+ if_dict->ShowSection("SYNC_SECTION");
+ if (async_mode)
+ if_dict->ShowSection("ASYNC_SECTION");
+
+ istringstream ss(ifacename);
+ string nspace;
+ // generates all the namespaces defined with <interface name="X.Y.Z">
+ while (ss.str().find('.', ss.tellg()) != string::npos)
+ {
+ getline(ss, nspace, '.');
+ TemplateDictionary *ns_dict = if_dict->AddSectionDictionary("FOR_EACH_NAMESPACE");
+ ns_dict->SetValue("NAMESPACE_NAME", nspace);
+ }
+
+ string ifaceclass;
+
+ getline(ss, ifaceclass);
+
+ if_dict->SetValue("CLASS_NAME", ifaceclass);
+
+ cerr << "generating code for interface " << ifacename << "..." << endl;
+
+ // this loop generates all properties
+ for (Xml::Nodes::iterator pi = properties.begin ();
+ pi != properties.end (); ++pi)
+ {
+ Xml::Node &property = **pi;
+ string prop_name = property.get ("name");
+ string type = property.get("type");
+ string property_access = property.get ("access");
+ TemplateDictionary *prop_dict = if_dict->AddSectionDictionary("FOR_EACH_PROPERTY");
+
+ prop_dict->SetValue("PROP_NAME", legalize(prop_name));
+ prop_dict->SetValue("PROP_SIG", type);
+ prop_dict->SetValue("PROP_TYPE", signature_to_type(type));
+ if (!is_primitive_type(type))
+ prop_dict->ShowSection("PROP_CONST");
+
+ if (property_access == "read" || property_access == "readwrite")
+ {
+ prop_dict->ShowSection("PROPERTY_GETTER");
+ prop_dict->SetValue("PROP_READABLE", "true");
+ }
+ else
+ {
+ prop_dict->SetValue("PROP_READABLE", "false");
+ }
+ if (property_access == "write" || property_access == "readwrite")
+ {
+ prop_dict->ShowSection("PROPERTY_SETTER");
+ prop_dict->SetValue("PROP_WRITEABLE", "true");
+ }
+ else
+ {
+ prop_dict->SetValue("PROP_WRITEABLE", "false");
+ }
+ }
+ generate_methods(if_dict, methods);
+
+ // this loop generates all signals
+ for (Xml::Nodes::iterator si = signals.begin(); si != signals.end(); ++si)
+ {
+ Xml::Node &signal = **si;
+ Xml::Nodes args = signal["arg"];
+
+ TemplateDictionary *sig_dict = if_dict->AddSectionDictionary("FOR_EACH_SIGNAL");
+ sig_dict->SetValue("SIGNAL_NAME", legalize(signal.get("name")));
+
+ // this loop generates all arguments for a signal
+ if (args.size() != 0)
+ sig_dict->ShowSection("SIGNAL_ARGS_SECTION");
+
+ unsigned int i = 0;
+ for (Xml::Nodes::iterator ai = args.begin(); ai != args.end(); ++ai, ++i)
+ {
+ Xml::Node &arg = **ai;
+ TemplateDictionary *arg_dict = sig_dict->AddSectionDictionary("FOR_EACH_SIGNAL_ARG");
+ TemplateDictionary *arg_list_dict = sig_dict->AddSectionDictionary("SIGNAL_ARG_LIST");
+ TemplateDictionary *const_arg_dict = sig_dict->AddSectionDictionary("CONST_SIGNAL_ARG_LIST");
+
+ string arg_decl = signature_to_type(arg.get("type")) + " ";
+ string const_arg_decl = "const " + arg_decl + "&";
+ string arg_name = arg.get("name");
+ arg_name = arg_name.empty() ?
+ ("argin" + i) : legalize(arg_name);
+ arg_decl += arg_name;
+ const_arg_decl += arg_name;
+ arg_dict->SetValue("SIGNAL_ARG_NAME", arg_name);
+ arg_dict->SetValue("SIGNAL_ARG_SIG", arg.get("type"));
+ arg_dict->SetValue("SIGNAL_ARG_DECL", arg_decl);
+ arg_list_dict->SetValue("SIGNAL_ARG_NAME", arg_name);
+ const_arg_dict->SetValue("SIGNAL_ARG_DECL", const_arg_decl);
+ }
+ }
+ }
+
+ ofstream file(filename);
+ if (file.bad())
+ {
+ cerr << "unable to write file " << filename << endl;
+ exit(-1);
+ }
+
+ string output;
+ ExpandTemplate(template_file, STRIP_BLANK_LINES, &dict, &output);
+ file << output;
+ file.close();
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.h b/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.h
new file mode 100644
index 00000000000..a2f83c95e16
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/generate_stubs.h
@@ -0,0 +1,40 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __DBUSXX_TOOLS_GENERATE_STUBS_H
+#define __DBUSXX_TOOLS_GENERATE_STUBS_H
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "xml.h"
+
+void generate_stubs(DBus::Xml::Document &doc,
+ const char *filename,
+ const std::vector< std::pair<std::string, std::string> > &macros,
+ bool sync_mode,
+ bool async_mode,
+ const char *template_file);
+
+#endif//__DBUSXX_TOOLS_GENERATE_STUBS_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.cpp b/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.cpp
new file mode 100644
index 00000000000..6ddd9385f14
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.cpp
@@ -0,0 +1,196 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <iostream>
+#include <cstdlib>
+
+#include <dbus/dbus.h> // for DBUS_TYPE_*
+
+#include "generator_utils.h"
+
+using namespace std;
+
+void underscorize(string &str)
+{
+ for (unsigned int i = 0; i < str.length(); ++i)
+ {
+ if (!isalpha(str[i]) && !isdigit(str[i])) str[i] = '_';
+ }
+}
+
+std::string legalize(const std::string &str)
+{
+ string legal = str;
+ underscorize(legal);
+ // TODO: Check for other C++ keywords, as needed.
+ if (legal == "new")
+ {
+ legal = "_" + legal;
+ }
+ return legal;
+}
+
+string stub_name(string name)
+{
+ underscorize(name);
+
+ return "_" + name + "_stub";
+}
+
+const char *atomic_type_to_string(char t)
+{
+ static struct { char type; const char *name; } atos[] =
+ {
+ { DBUS_TYPE_BYTE, "uint8_t" },
+ { DBUS_TYPE_BOOLEAN, "bool" },
+ { DBUS_TYPE_INT16, "int16_t" },
+ { DBUS_TYPE_UINT16, "uint16_t" },
+ { DBUS_TYPE_INT32, "int32_t" },
+ { DBUS_TYPE_UINT32, "uint32_t" },
+ { DBUS_TYPE_INT64, "int64_t" },
+ { DBUS_TYPE_UINT64, "uint64_t" },
+ { DBUS_TYPE_DOUBLE, "double" },
+ { DBUS_TYPE_STRING, "std::string" },
+ { DBUS_TYPE_UNIX_FD, "::DBus::FileDescriptor" },
+ { DBUS_TYPE_OBJECT_PATH, "::DBus::Path" },
+ { DBUS_TYPE_SIGNATURE, "::DBus::Signature" },
+ { DBUS_TYPE_VARIANT, "::DBus::Variant" },
+ { '\0', "" }
+ };
+ int i;
+
+ for (i = 0; atos[i].type; ++i)
+ {
+ if (atos[i].type == t) break;
+ }
+ return atos[i].name;
+}
+
+void _parse_signature(const string &signature, string &type, unsigned int &i)
+{
+ for (; i < signature.length(); ++i)
+ {
+ switch (signature[i])
+ {
+ case 'a':
+ {
+ switch (signature[++i])
+ {
+ case '{':
+ {
+ type += "std::map< ";
+
+ const char *atom = atomic_type_to_string(signature[++i]);
+ if (!atom)
+ {
+ cerr << "invalid signature" << endl;
+ exit(-1);
+ }
+ type += atom;
+ type += ", ";
+ ++i;
+ break;
+ }
+ default:
+ {
+ type += "std::vector< ";
+ break;
+ }
+ }
+ _parse_signature(signature, type, i);
+ type += " >";
+ continue;
+ }
+ case '(':
+ {
+ type += "::DBus::Struct< ";
+ ++i;
+ _parse_signature(signature, type, i);
+ type += " >";
+ if (signature[i+1])
+ {
+ type += ", ";
+ }
+ continue;
+ }
+ case ')':
+ case '}':
+ {
+ return;
+ }
+ default:
+ {
+ const char *atom = atomic_type_to_string(signature[i]);
+ if (!atom)
+ {
+ cerr << "invalid signature" << endl;
+ exit(-1);
+ }
+ type += atom;
+
+ if (signature[i+1] != ')' && signature[i+1] != '}' && i+1 < signature.length())
+ {
+ type += ", ";
+ }
+ break;
+ }
+ }
+ }
+}
+
+string signature_to_type(const string &signature)
+{
+ string type;
+ unsigned int i = 0;
+ _parse_signature(signature, type, i);
+ return type;
+}
+
+bool is_primitive_type(const string &signature) {
+ unsigned int len = signature.length();
+
+ if (len == 0) {
+ cerr << "invalid signature" << endl;
+ exit(-1);
+ }
+
+ if (len > 1) {
+ return false;
+ }
+
+ switch (signature[0]) {
+ case DBUS_TYPE_BYTE: // uint8_t
+ case DBUS_TYPE_BOOLEAN: // bool
+ case DBUS_TYPE_INT16: // int16_t
+ case DBUS_TYPE_UINT16: // uint16_t
+ case DBUS_TYPE_INT32: // int32_t
+ case DBUS_TYPE_UINT32: // uint32_t
+ case DBUS_TYPE_INT64: // int64_t
+ case DBUS_TYPE_UINT64: // uint64_t
+ case DBUS_TYPE_DOUBLE: // double
+ case DBUS_TYPE_UNIX_FD: // int
+ return true;
+ default:
+ return false;
+ }
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.h b/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.h
new file mode 100644
index 00000000000..95d615d214c
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/generator_utils.h
@@ -0,0 +1,39 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __DBUSXX_TOOLS_GENERATOR_UTILS_H
+#define __DBUSXX_TOOLS_GENERATOR_UTILS_H
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+
+const char *atomic_type_to_string(char t);
+std::string stub_name(std::string name);
+std::string signature_to_type(const std::string &signature);
+bool is_primitive_type(const std::string &signature);
+void _parse_signature(const std::string &signature, std::string &type, unsigned int &i);
+void underscorize(std::string &str);
+std::string legalize(const std::string &str);
+
+#endif//__DBUSXX_TOOLS_GENERATOR_UTILS_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.cpp b/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.cpp
new file mode 100644
index 00000000000..8ce9f3a74c6
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.cpp
@@ -0,0 +1,79 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <cstring>
+#include <signal.h>
+#include <unistd.h>
+#include <iostream>
+#include "introspect.h"
+
+DBus::BusDispatcher dispatcher;
+static bool systembus;
+static char *path;
+static char *service;
+
+void niam(int sig)
+{
+ DBus::Connection conn = systembus ? DBus::Connection::SystemBus() : DBus::Connection::SessionBus();
+
+ IntrospectedObject io(conn, path, service);
+
+ std::cout << io.Introspect();
+
+ dispatcher.leave();
+}
+
+int main(int argc, char ** argv)
+{
+ signal(SIGTERM, niam);
+ signal(SIGINT, niam);
+ signal(SIGALRM, niam);
+
+ if (argc == 1)
+ {
+ std::cerr << std::endl << "Usage: " << argv[0] << " [--system] <object_path> [<destination>]" << std::endl << std::endl;
+ }
+ else
+ {
+ if (strcmp(argv[1], "--system"))
+ {
+ systembus = false;
+ path = argv[1];
+ service = argc > 2 ? argv[2] : 0;
+ }
+ else
+ {
+ systembus = true;
+ path = argv[2];
+ service = argc > 3 ? argv[3] : 0;
+ }
+
+ DBus::default_dispatcher = &dispatcher;
+
+ alarm(1);
+
+ dispatcher.enter();
+ }
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.h b/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.h
new file mode 100644
index 00000000000..1c6e3264140
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/introspect.h
@@ -0,0 +1,44 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_TOOLS_INTROSPECT_H
+#define __DBUSXX_TOOLS_INTROSPECT_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <dbus-c++/dbus.h>
+#include <string>
+
+class IntrospectedObject : public DBus::IntrospectableProxy, public DBus::ObjectProxy
+{
+public:
+
+ IntrospectedObject(DBus::Connection &conn, const char *path, const char *service)
+ : DBus::ObjectProxy(conn, path, service)
+ {}
+};
+
+#endif//__DBUSXX_TOOLS_INTROSPECT_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/proxy-stubs.tpl b/chromium/third_party/cros_dbus_cplusplus/source/tools/proxy-stubs.tpl
new file mode 100644
index 00000000000..4d86643dd88
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/proxy-stubs.tpl
@@ -0,0 +1,232 @@
+/*
+ * {{AUTO_GENERATED_WARNING}}
+ */
+#ifndef __dbusxx__{{FILE_STRING}}__PROXY_MARSHALL_H
+#define __dbusxx__{{FILE_STRING}}__PROXY_MARSHALL_H
+
+#include <dbus-c++/dbus.h>
+#include <cassert>{{BI_NEWLINE}}
+
+{{#FOR_EACH_INTERFACE}}
+{{#FOR_EACH_NAMESPACE}}
+namespace {{NAMESPACE_NAME}} {
+{{/FOR_EACH_NAMESPACE}}
+
+{{BI_NEWLINE}}class {{CLASS_NAME}}_proxy
+ : public ::DBus::InterfaceProxy
+{
+public:
+
+ {{CLASS_NAME}}_proxy()
+ : ::DBus::InterfaceProxy("{{INTERFACE_NAME}}")
+ {
+{{#FOR_EACH_SIGNAL}}
+ connect_signal({{CLASS_NAME}}_proxy, {{SIGNAL_NAME}}, _{{SIGNAL_NAME}}_stub);
+{{/FOR_EACH_SIGNAL}}
+ }{{BI_NEWLINE}}
+
+ /* properties exported by this interface */
+{{#FOR_EACH_PROPERTY}}
+
+ {{#PROPERTY_GETTER}}
+ {{#PROP_CONST}}const {{/PROP_CONST}}{{PROP_TYPE}} {{PROP_NAME}}() {
+ ::DBus::CallMessage __call ;
+ __call.member("Get"); __call.interface("org.freedesktop.DBus.Properties");
+ ::DBus::MessageIter __wi = __call.writer();
+ const std::string interface_name = "{{INTERFACE_NAME}}";
+ const std::string property_name = "{{PROP_NAME}}";
+ __wi << interface_name;
+ __wi << property_name;
+ ::DBus::Message __ret = this->invoke_method (__call);
+ ::DBus::MessageIter __ri = __ret.reader ();
+ ::DBus::Variant argout;
+ __ri >> argout;
+ return argout;
+ }{{BI_NEWLINE}}
+ {{/PROPERTY_GETTER}}
+
+ {{#PROPERTY_SETTER}}
+ void {{PROP_NAME}}(const {{PROP_TYPE}} &input) {
+ ::DBus::CallMessage __call ;
+ __call.member("Set"); __call.interface( "org.freedesktop.DBus.Properties");
+ ::DBus::MessageIter __wi = __call.writer();
+ ::DBus::Variant __value;
+ ::DBus::MessageIter vi = __value.writer ();
+ vi << input;
+ const std::string interface_name = "{{INTERFACE_NAME}}";
+ const std::string property_name = "{{PROP_NAME}}";
+ __wi << interface_name;
+ __wi << property_name;
+ __wi << __value;
+ ::DBus::Message __ret = this->invoke_method (__call);
+ }{{BI_NEWLINE}}
+ {{/PROPERTY_SETTER}}
+
+{{/FOR_EACH_PROPERTY}}
+
+{{#SYNC_SECTION}}
+ /* methods exported by this interface.
+ * these functions will invoke the corresponding methods
+ * on the remote objects.
+ */
+{{#FOR_EACH_METHOD}}
+
+ {{METHOD_RETURN_TYPE}} {{METHOD_NAME}}({{#METHOD_ARG_LIST}}{{METHOD_ARG_DECL}}{{#METHOD_ARG_LIST_separator}}, {{/METHOD_ARG_LIST_separator}}{{/METHOD_ARG_LIST}})
+ {
+ ::DBus::CallMessage __call;
+
+ {{#METHOD_IN_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __call.writer();
+
+ {{#FOR_EACH_METHOD_IN_ARG}}
+ __wi << {{METHOD_IN_ARG_NAME}};
+ {{/FOR_EACH_METHOD_IN_ARG}}
+
+ {{/METHOD_IN_ARGS_SECTION}}
+
+ __call.member("{{METHOD_NAME}}");
+ {{METHOD_INVOKE_RET}}invoke_method(__call);
+
+ {{#METHOD_OUT_ARGS_SECTION}}
+ ::DBus::MessageIter __ri = __ret.reader();
+
+ {{#FOR_EACH_METHOD_OUT_ARG}}
+
+ {{#METHOD_OUT_ARG_DECL}}
+ {{METHOD_OUT_ARG_TYPE}} {{METHOD_OUT_ARG_NAME}};
+ {{/METHOD_OUT_ARG_DECL}}
+
+ __ri >> {{METHOD_OUT_ARG_NAME}};
+ {{/FOR_EACH_METHOD_OUT_ARG}}
+
+ {{/METHOD_OUT_ARGS_SECTION}}
+
+ {{#METHOD_RETURN}}
+ return {{METHOD_RETURN_NAME}};
+ {{/METHOD_RETURN}}
+
+ }{{BI_NEWLINE}}
+{{/FOR_EACH_METHOD}}
+
+{{/SYNC_SECTION}}
+
+{{#ASYNC_SECTION}}
+ /* non-blocking versions of the methods exported by this interface.
+ * these functions will invoke the corresponding methods
+ * on the remote objects.
+ */
+{{#FOR_EACH_ASYNC_METHOD}}
+ void {{METHOD_NAME}}({{#METHOD_ARG_LIST}}{{METHOD_ARG_DECL}}{{#METHOD_ARG_LIST_separator}}, {{/METHOD_ARG_LIST_separator}}{{/METHOD_ARG_LIST}})
+ {
+ ::DBus::CallMessage __call;
+
+ {{#METHOD_IN_ARGS_SECTION}}
+ ::DBus::MessageIter __wi = __call.writer();
+
+ {{#FOR_EACH_METHOD_IN_ARG}}
+ __wi << {{METHOD_IN_ARG_NAME}};
+ {{/FOR_EACH_METHOD_IN_ARG}}
+
+ {{/METHOD_IN_ARGS_SECTION}}
+
+ __call.member("{{METHOD_NAME}}");
+ ::DBus::PendingCall *__pending = invoke_method_async(__call, __timeout);
+ ::DBus::AsyncReplyHandler __handler;
+ __handler = new ::DBus::Callback<{{CLASS_NAME}}_proxy, void, ::DBus::PendingCall *>(this, &{{CLASS_NAME}}_proxy::_{{METHOD_NAME}}Callback_stub);
+ __pending->reply_handler(__handler);
+ __pending->data(__data);
+ }{{BI_NEwLINE}}{{BI_NEWLINE}}
+
+{{/FOR_EACH_ASYNC_METHOD}}
+
+{{/ASYNC_SECTION}}
+
+ /* signal handlers for this interface.
+ * you will have to implement them in your ObjectProxy.
+ */
+
+{{#FOR_EACH_SIGNAL}}
+ virtual void {{SIGNAL_NAME}}({{#CONST_SIGNAL_ARG_LIST}}{{SIGNAL_ARG_DECL}}{{#CONST_SIGNAL_ARG_LIST_separator}}, {{/CONST_SIGNAL_ARG_LIST_separator}}{{/CONST_SIGNAL_ARG_LIST}}) = 0;
+{{/FOR_EACH_SIGNAL}}
+
+{{BI_NEWLINE}}protected:
+
+{{#ASYNC_SECTION}}
+ /* async method reply handlers for this interface.
+ * you will have to implement them in your ObjectProxy.
+ */
+
+{{#FOR_EACH_ASYNC_METHOD}}
+
+ virtual void {{METHOD_NAME}}Callback({{#METHOD_CALLBACK_ARG_LIST}}{{METHOD_CALLBACK_ARG}}{{#METHOD_CALLBACK_ARG_LIST_separator}}, {{/METHOD_CALLBACK_ARG_LIST_separator}}{{/METHOD_CALLBACK_ARG_LIST}})
+ {
+ assert(!"Implement {{METHOD_NAME}}Callback");
+ }{{BI_NEWLINE}}
+
+{{/FOR_EACH_ASYNC_METHOD}}
+
+{{/ASYNC_SECTION}}
+private:
+
+{{#ASYNC_SECTION}}
+ /* unmarshallers (to steal the PendingCall reply and unmarshall args
+ * before invoking the reply callback)
+ */
+{{#FOR_EACH_ASYNC_METHOD}}
+ void _{{METHOD_NAME}}Callback_stub(::DBus::PendingCall *__call)
+ {
+ ::DBus::Message __reply = __call->steal_reply();
+ void *__data = __call->data();
+ remove_pending_call(__call);
+ ::DBus::Error __error(__reply);
+
+ {{#METHOD_OUT_ARGS_SECTION}}
+ ::DBus::MessageIter __ri = __reply.reader();
+
+ {{#FOR_EACH_METHOD_USER_OUT_ARG}}
+ {{METHOD_OUT_ARG_TYPE}} {{METHOD_OUT_ARG_NAME}};
+ {{/FOR_EACH_METHOD_USER_OUT_ARG}}
+
+ if (!__error.is_set()) {
+
+ {{#FOR_EACH_METHOD_USER_OUT_ARG}}
+ __ri >> {{METHOD_OUT_ARG_NAME}};
+ {{/FOR_EACH_METHOD_USER_OUT_ARG}}
+
+ }
+ {{/METHOD_OUT_ARGS_SECTION}}
+
+ {{METHOD_NAME}}Callback({{#METHOD_OUT_ARG_LIST}}{{METHOD_OUT_ARG_NAME}}{{#METHOD_OUT_ARG_LIST_separator}}, {{/METHOD_OUT_ARG_LIST_separator}}{{/METHOD_OUT_ARG_LIST}});
+
+ }{{BI_NEWLINE}}
+{{/FOR_EACH_ASYNC_METHOD}}
+
+{{/ASYNC_SECTION}}
+
+ /* unmarshallers (to unpack the DBus message before
+ * calling the actual signal handler)
+ */
+
+{{#FOR_EACH_SIGNAL}}
+ void _{{SIGNAL_NAME}}_stub(const ::DBus::SignalMessage &__sig)
+ {
+
+ {{#SIGNAL_ARGS_SECTION}}
+ ::DBus::MessageIter __ri = __sig.reader();
+
+ {{#FOR_EACH_SIGNAL_ARG}}
+ {{SIGNAL_ARG_DECL}}; __ri >> {{SIGNAL_ARG_NAME}};
+ {{/FOR_EACH_SIGNAL_ARG}}
+
+ {{/SIGNAL_ARGS_SECTION}}
+
+ {{SIGNAL_NAME}}({{#SIGNAL_ARG_LIST}}{{SIGNAL_ARG_NAME}}{{#SIGNAL_ARG_LIST_separator}}, {{/SIGNAL_ARG_LIST_separator}}{{/SIGNAL_ARG_LIST}});
+ }{{BI_NEWLINE}}
+
+{{/FOR_EACH_SIGNAL}}
+
+};
+{{#FOR_EACH_NAMESPACE}}}{{/FOR_EACH_NAMESPACE}}
+{{/FOR_EACH_INTERFACE}}
+
+#endif // __dbusxx__{{FILE_STRING}}__PROXY_MARSHALL_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.cpp b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.cpp
new file mode 100644
index 00000000000..68ae5a64da6
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.cpp
@@ -0,0 +1,315 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#include "xml.h"
+
+#include <dbus-c++/debug.h>
+
+#include <expat.h>
+
+std::istream &operator >> (std::istream &in, DBus::Xml::Document &doc)
+{
+ std::stringbuf xmlbuf;
+ in.get(xmlbuf, '\0');
+ doc.from_xml(xmlbuf.str());
+
+ return in;
+}
+
+std::ostream &operator << (std::ostream &out, const DBus::Xml::Document &doc)
+{
+ return out << doc.to_xml();
+}
+
+using namespace DBus;
+using namespace DBus::Xml;
+
+Error::Error(const char *error, int line, int column)
+{
+ std::ostringstream estream;
+
+ estream << "line " << line << ", column " << column << ": " << error;
+
+ _error = estream.str();
+}
+
+Node::Node(const char *n, const char ** a)
+: name(n)
+{
+ if (a)
+ for (int i = 0; a[i]; i += 2)
+ {
+ _attrs[a[i]] = a[i+1];
+
+ //debug_log("xml:\t%s = %s", a[i], a[i+1]);
+ }
+}
+
+Nodes Nodes::operator[](const std::string &key)
+{
+ Nodes result;
+
+ for (iterator i = begin(); i != end(); ++i)
+ {
+ Nodes part = (**i)[key];
+
+ result.insert(result.end(), part.begin(), part.end());
+ }
+ return result;
+}
+
+Nodes Nodes::select(const std::string &attr, const std::string &value)
+{
+ Nodes result;
+
+ for (iterator i = begin(); i != end(); ++i)
+ {
+ if ((*i)->get(attr) == value)
+ result.insert(result.end(), *i);
+ }
+ return result;
+}
+
+Nodes Node::operator[](const std::string &key)
+{
+ Nodes result;
+
+ if (key.length() == 0) return result;
+
+ for (Children::iterator i = children.begin(); i != children.end(); ++i)
+ {
+ if (i->name == key)
+ result.push_back(&(*i));
+ }
+ return result;
+}
+
+std::string Node::get(const std::string &attribute)
+{
+ if (_attrs.find(attribute) != _attrs.end())
+ return _attrs[attribute];
+ else
+ return "";
+}
+
+void Node::set(const std::string &attribute, std::string value)
+{
+ if (value.length())
+ _attrs[attribute] = value;
+ else
+ _attrs.erase(value);
+}
+
+std::string Node::to_xml() const
+{
+ std::string xml;
+ int depth = 0;
+
+ _raw_xml(xml, depth);
+
+ return xml;
+}
+
+void Node::_raw_xml(std::string &xml, int &depth) const
+{
+ xml.append(depth *2, ' ');
+ xml.append("<"+name);
+
+ for (Attributes::const_iterator i = _attrs.begin(); i != _attrs.end(); ++i)
+ {
+ xml.append(" "+i->first+"=\""+i->second+"\"");
+ }
+
+ if (cdata.length() == 0 && children.size() == 0)
+ {
+ xml.append("/>\n");
+ }
+ else
+ {
+ xml.append(">");
+
+ if (cdata.length())
+ {
+ xml.append(cdata);
+ }
+
+ if (children.size())
+ {
+ xml.append("\n");
+ depth++;
+
+ for (Children::const_iterator i = children.begin(); i != children.end(); ++i)
+ {
+ i->_raw_xml(xml, depth);
+ }
+
+ depth--;
+ xml.append(depth *2, ' ');
+ }
+ xml.append("</"+name+">\n");
+ }
+}
+
+Document::Document()
+: root(0), _depth(0)
+{
+}
+
+Document::Document(const std::string &xml)
+: root(0), _depth(0)
+{
+ from_xml(xml);
+}
+
+Document::~Document()
+{
+ delete root;
+}
+
+struct Document::Expat
+{
+ static void start_doctype_decl_handler(
+ void *data, const XML_Char *name, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset
+ );
+ static void end_doctype_decl_handler(void *data);
+ static void start_element_handler(void *data, const XML_Char *name, const XML_Char **atts);
+ static void character_data_handler(void *data, const XML_Char *chars, int len);
+ static void end_element_handler(void *data, const XML_Char *name);
+};
+
+void Document::from_xml(const std::string &xml)
+{
+ _depth = 0;
+ delete root;
+ root = 0;
+
+ XML_Parser parser = XML_ParserCreate("UTF-8");
+
+ XML_SetUserData(parser, this);
+
+ XML_SetDoctypeDeclHandler(
+ parser,
+ Document::Expat::start_doctype_decl_handler,
+ Document::Expat::end_doctype_decl_handler
+ );
+
+ XML_SetElementHandler(
+ parser,
+ Document::Expat::start_element_handler,
+ Document::Expat::end_element_handler
+ );
+
+ XML_SetCharacterDataHandler(
+ parser,
+ Document::Expat::character_data_handler
+ );
+
+ XML_Status status = XML_Parse(parser, xml.c_str(), xml.length(), true);
+
+ if (status == XML_STATUS_ERROR)
+ {
+ const char *error = XML_ErrorString(XML_GetErrorCode(parser));
+ int line = XML_GetCurrentLineNumber(parser);
+ int column = XML_GetCurrentColumnNumber(parser);
+
+ XML_ParserFree(parser);
+
+ throw Error(error, line, column);
+ }
+ else
+ {
+ XML_ParserFree(parser);
+ }
+}
+
+std::string Document::to_xml() const
+{
+ return root->to_xml();
+}
+
+void Document::Expat::start_doctype_decl_handler(
+ void *data, const XML_Char *name, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset
+)
+{
+}
+
+void Document::Expat::end_doctype_decl_handler(void *data)
+{
+}
+
+void Document::Expat::start_element_handler(void *data, const XML_Char *name, const XML_Char **atts)
+{
+ Document *doc = (Document *)data;
+
+ //debug_log("xml:%d -> %s", doc->_depth, name);
+
+ if (!doc->root)
+ {
+ doc->root = new Node(name, atts);
+ }
+ else
+ {
+ Node::Children *cld = &(doc->root->children);
+
+ for (int i = 1; i < doc->_depth; ++i)
+ {
+ cld = &(cld->back().children);
+ }
+ cld->push_back(Node(name, atts));
+
+ //std::cerr << doc->to_xml() << std::endl;
+ }
+ doc->_depth++;
+}
+
+void Document::Expat::character_data_handler(void *data, const XML_Char *chars, int len)
+{
+ Document *doc = (Document *)data;
+
+ Node *nod = doc->root;
+
+ for (int i = 1; i < doc->_depth; ++i)
+ {
+ nod = &(nod->children.back());
+ }
+ int x, y;
+
+ x = 0;
+ y = len-1;
+
+ while (isspace(chars[y]) && y > 0) --y;
+ while (isspace(chars[x]) && x < y) ++x;
+
+ nod->cdata = std::string(chars, x, y+1);
+}
+
+void Document::Expat::end_element_handler(void *data, const XML_Char *name)
+{
+ Document *doc = (Document *)data;
+
+ //debug_log("xml:%d <- %s", doc->_depth, name);
+
+ doc->_depth--;
+}
+
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.h b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.h
new file mode 100644
index 00000000000..6a8e69c19f2
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml.h
@@ -0,0 +1,142 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_XML_H
+#define __DBUSXX_XML_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <exception>
+#include <string>
+#include <vector>
+#include <map>
+#include <iostream>
+#include <sstream>
+
+namespace DBus {
+
+namespace Xml {
+
+class Error : public std::exception
+{
+public:
+
+ Error(const char *error, int line, int column);
+
+ ~Error() throw()
+ {}
+
+ const char *what() const throw()
+ {
+ return _error.c_str();
+ }
+
+private:
+
+ std::string _error;
+};
+
+class Node;
+
+class Nodes : public std::vector<Node *>
+{
+public:
+
+ Nodes operator[](const std::string &key);
+
+ Nodes select(const std::string &attr, const std::string &value);
+};
+
+class Node
+{
+public:
+
+ typedef std::map<std::string, std::string> Attributes;
+
+ typedef std::vector<Node> Children;
+
+ std::string name;
+ std::string cdata;
+ Children children;
+
+ Node(std::string &n, Attributes &a)
+ : name(n), _attrs(a)
+ {}
+
+ Node(const char *n, const char ** a = NULL);
+
+ Nodes operator[](const std::string &key);
+
+ std::string get(const std::string &attribute);
+
+ void set(const std::string &attribute, std::string value);
+
+ std::string to_xml() const;
+
+ Node &add(Node child)
+ {
+ children.push_back(child);
+ return children.back();
+ }
+
+private:
+
+ void _raw_xml(std::string &xml, int &depth) const;
+
+ Attributes _attrs;
+};
+
+class Document
+{
+public:
+
+ struct Expat;
+
+ Node *root;
+
+ Document();
+
+ Document(const std::string &xml);
+
+ ~Document();
+
+ void from_xml(const std::string &xml);
+
+ std::string to_xml() const;
+
+private:
+
+ int _depth;
+};
+
+} /* namespace Xml */
+
+} /* namespace DBus */
+
+std::istream &operator >> (std::istream &, DBus::Xml::Document &);
+std::ostream &operator << (std::ostream &, DBus::Xml::Document &);
+
+#endif//__DBUSXX_XML_H
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.cpp b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.cpp
new file mode 100644
index 00000000000..dbf8da4bb2b
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.cpp
@@ -0,0 +1,185 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <ctemplate/template.h>
+
+#include <dbus/dbus.h>
+
+#include <cstdlib>
+#include <cstring>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "xml2cpp.h"
+#include "generate_stubs.h"
+
+using namespace ctemplate;
+using namespace std;
+using namespace DBus;
+
+//typedef map<string,string> TypeCache;
+
+void usage(char *argv0)
+{
+ char *prog = strrchr(argv0, '/');
+ if (prog == NULL)
+ prog = argv0;
+ else
+ ++prog;
+ cerr << endl << "Usage: " << endl;
+ cerr << " " << prog << " <xmlfile> --proxy=<outfile.h> [ --proxy-template=<template.tpl> ] [ --templatedir=<template-dir> ] [ --[no]sync ] [ --[no]async ]" << endl << endl;
+ cerr << " --OR--" << endl << endl;
+ cerr << " " << prog << " <xmlfile> --adaptor=<outfile.h> [ --adaptor-template=<template.tpl> ] [ --templatedir=<template-dir> ]" << endl;
+ cerr << endl << "Flags which can be repeated:" << endl;
+ cerr << " --define macroname value" << endl;
+ exit(-1);
+}
+
+/*int char_to_atomic_type(char t)
+{
+ if (strchr("ybnqiuxtdsgavre", t))
+ return t;
+
+ return DBUS_TYPE_INVALID;
+}*/
+
+
+
+/*bool is_atomic_type(const string &type)
+{
+ return type.length() == 1 && char_to_atomic_type(type[0]) != DBUS_TYPE_INVALID;
+}*/
+
+
+int main(int argc, char ** argv)
+{
+ if (argc < 2)
+ {
+ usage(argv[0]);
+ }
+
+ bool proxy_mode, adaptor_mode, async_proxy_mode, sync_proxy_mode;
+ char *proxy, *adaptor;
+ const char *proxy_template = "proxy-stubs.tpl";
+ const char *adaptor_template = "adaptor-stubs.tpl";
+ std::vector< pair<string, string> > macros;
+
+ sync_proxy_mode = true;
+ async_proxy_mode = false;
+ proxy_mode = false;
+ proxy = 0;
+
+ adaptor_mode = false;
+ adaptor = 0;
+
+ for (int a = 1; a < argc; ++a)
+ {
+ if (!strncmp(argv[a], "--proxy=", 8))
+ {
+ proxy_mode = true;
+ proxy = argv[a] + 8;
+ }
+ else if (!strncmp(argv[a], "--adaptor=", 10))
+ {
+ adaptor_mode = true;
+ adaptor = argv[a] + 10;
+ }
+ else if (!strncmp(argv[a], "--proxy-template=", 17))
+ {
+ proxy_template = argv[a] + 17;
+ }
+ else if (!strncmp(argv[a], "--adaptor-template=", 19))
+ {
+ adaptor_template = argv[a] + 19;
+ }
+ else if (!strncmp(argv[a], "--templatedir=", 14))
+ {
+ Template::AddAlternateTemplateRootDirectory(argv[a] + 14);
+ }
+ else if (!strcmp(argv[a], "--async"))
+ {
+ async_proxy_mode = true;
+ }
+ else if (!strcmp(argv[a], "--sync"))
+ {
+ sync_proxy_mode = true;
+ }
+ else if (!strcmp(argv[a], "--noasync"))
+ {
+ async_proxy_mode = false;
+ }
+ else if (!strcmp(argv[a], "--define") && (a + 2) < argc)
+ {
+ const char *name = argv[++a];
+ const char *value = argv[++a];
+ macros.push_back(pair<string, string>(name, value));
+ }
+ else if (!strcmp(argv[a], "--nosync"))
+ {
+ sync_proxy_mode = false;
+ }
+ }
+ Template::AddAlternateTemplateRootDirectory(DATADIR);
+
+ if ((!proxy_mode && !adaptor_mode) || (proxy_mode && adaptor_mode))
+ usage(argv[0]);
+
+ ifstream xmlfile(argv[1]);
+
+ if (xmlfile.bad())
+ {
+ cerr << "unable to open file " << argv[1] << endl;
+ return -1;
+ }
+
+ Xml::Document doc;
+
+ try
+ {
+ xmlfile >> doc;
+ //cout << doc.to_xml();
+ }
+ catch(Xml::Error &e)
+ {
+ cerr << "error parsing " << argv[1] << ": " << e.what() << endl;
+ return -1;
+ }
+
+ if (!doc.root)
+ {
+ cerr << "empty document" << endl;
+ return -1;
+ }
+
+ if (proxy_mode)
+ generate_stubs(doc, proxy, macros, sync_proxy_mode, async_proxy_mode, proxy_template);
+ else if (adaptor_mode)
+ generate_stubs(doc, adaptor, macros, true, true, adaptor_template);
+
+ return 0;
+}
diff --git a/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.h b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.h
new file mode 100644
index 00000000000..84f53feacf4
--- /dev/null
+++ b/chromium/third_party/cros_dbus_cplusplus/source/tools/xml2cpp.h
@@ -0,0 +1,37 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __DBUSXX_TOOLS_XML2CPP_H
+#define __DBUSXX_TOOLS_XML2CPP_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <dbus-c++/dbus.h>
+#include <dbus/dbus.h>
+
+#include "xml.h"
+
+#endif//__DBUSXX_TOOLS_XML2CPP_H