blob: 8f8bba1a04af06dcb9c632c8bb99926c8333abcd [file] [log] [blame]
Sergey Poromovb42c6ac2021-01-27 13:56:31 +01001// Copyright 2021 The Chromium OS Authors. 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 "dlp/dlp_daemon.h"
6
7#include <utility>
8
9#include <brillo/dbus/async_event_sequencer.h>
10#include <brillo/dbus/dbus_object.h>
11#include <dbus/dlp/dbus-constants.h>
12
13#include "dlp/dlp_adaptor.h"
14
15namespace dlp {
16
17namespace {
18const char kObjectServicePath[] = "/org/chromium/Dlp/ObjectManager";
19} // namespace
20
21DlpDaemon::DlpDaemon()
22 : DBusServiceDaemon(kDlpServiceName, kObjectServicePath) {}
23DlpDaemon::~DlpDaemon() = default;
24
25void DlpDaemon::RegisterDBusObjectsAsync(
26 brillo::dbus_utils::AsyncEventSequencer* sequencer) {
27 auto dbus_object = std::make_unique<brillo::dbus_utils::DBusObject>(
28 object_manager_.get(), object_manager_->GetBus(),
29 org::chromium::DlpAdaptor::GetObjectPath());
30 DCHECK(!adaptor_);
31 adaptor_ = std::make_unique<DlpAdaptor>(std::move(dbus_object));
32 adaptor_->RegisterAsync(
33 sequencer->GetHandler("RegisterAsync() failed", true));
34}
35
36} // namespace dlp