Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / tools / linux / dbus_connection.cc
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "xwalk/application/tools/linux/dbus_connection.h"
6
7 GDBusConnection* get_session_bus_connection(GError** error) {
8 #if defined(OS_TIZEN_MOBILE)
9   // In Tizen the session bus is created in /run/user/app/dbus/user_bus_socket
10   // but this information isn't set in DBUS_SESSION_BUS_ADDRESS, neither when
11   // logging via 'sdb shell' and changing user to 'app', nor when an application
12   // is launched.
13   return g_dbus_connection_new_for_address_sync(
14       "unix:path=/run/user/app/dbus/user_bus_socket",
15       GDBusConnectionFlags(G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT
16                            | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),
17       NULL, NULL, error);
18 #else
19   return g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, error);
20 #endif
21 }