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.
5 #include "xwalk/dbus/dbus_manager.h"
9 #include "base/strings/stringprintf.h"
10 #include "base/threading/thread.h"
15 DBusManager::DBusManager() {}
17 DBusManager::~DBusManager() {
19 session_bus_->ShutdownOnDBusThreadAndBlock();
22 scoped_refptr<dbus::Bus> DBusManager::session_bus() {
24 base::Thread::Options thread_options;
25 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
26 std::string thread_name = "Crosswalk D-Bus thread";
27 dbus_thread_.reset(new base::Thread(thread_name.c_str()));
28 dbus_thread_->StartWithOptions(thread_options);
30 dbus::Bus::Options options;
31 options.dbus_task_runner = dbus_thread_->message_loop_proxy();
33 session_bus_ = new dbus::Bus(options);