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"
10 #include "base/strings/stringprintf.h"
11 #include "base/threading/thread.h"
16 DBusManager::DBusManager() {}
18 DBusManager::~DBusManager() {
20 session_bus_->ShutdownOnDBusThreadAndBlock();
23 scoped_refptr<dbus::Bus> DBusManager::session_bus() {
25 base::Thread::Options thread_options;
26 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
27 std::string thread_name = "Crosswalk D-Bus thread";
28 dbus_thread_.reset(new base::Thread(thread_name.c_str()));
29 dbus_thread_->StartWithOptions(thread_options);
31 dbus::Bus::Options options;
32 options.dbus_task_runner = dbus_thread_->message_loop_proxy();
34 session_bus_ = new dbus::Bus(options);