blob: 543467b608ee841d2ace82a084fb72654a6fe593 [file] [log] [blame]
// Copyright 2016 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ARC_OBB_MOUNTER_SERVICE_H_
#define ARC_OBB_MOUNTER_SERVICE_H_
#include <base/macros.h>
#include <base/memory/weak_ptr.h>
#include <dbus/exported_object.h>
namespace dbus {
class Bus;
class MethodCall;
} // namespace dbus
namespace arc {
namespace obb_mounter {
// This class handles incoming D-Bus method calls.
class Service {
public:
Service();
~Service();
// Exports D-Bus methods via the given bus and requests the ownership of the
// service name.
bool Initialize(scoped_refptr<dbus::Bus> bus);
private:
// D-Bus method call handlers:
void MountObb(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void UnmountObb(dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
scoped_refptr<dbus::Bus> bus_;
dbus::ExportedObject* exported_object_ = nullptr;
base::WeakPtrFactory<Service> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(Service);
};
} // namespace obb_mounter
} // namespace arc
#endif // ARC_OBB_MOUNTER_SERVICE_H_