blob: 66d839392dd7fe31a24a65af0fb6984fb8964aee [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
Qijiang Fan713061e2021-03-08 15:45:12 +09009#include <base/check.h>
Sergey Poromovb42c6ac2021-01-27 13:56:31 +010010#include <brillo/dbus/async_event_sequencer.h>
11#include <brillo/dbus/dbus_object.h>
12#include <dbus/dlp/dbus-constants.h>
13
14#include "dlp/dlp_adaptor.h"
15
16namespace dlp {
17
18namespace {
19const char kObjectServicePath[] = "/org/chromium/Dlp/ObjectManager";
20} // namespace
21
22DlpDaemon::DlpDaemon()
23 : DBusServiceDaemon(kDlpServiceName, kObjectServicePath) {}
24DlpDaemon::~DlpDaemon() = default;
25
26void DlpDaemon::RegisterDBusObjectsAsync(
27 brillo::dbus_utils::AsyncEventSequencer* sequencer) {
28 auto dbus_object = std::make_unique<brillo::dbus_utils::DBusObject>(
29 object_manager_.get(), object_manager_->GetBus(),
30 org::chromium::DlpAdaptor::GetObjectPath());
31 DCHECK(!adaptor_);
32 adaptor_ = std::make_unique<DlpAdaptor>(std::move(dbus_object));
33 adaptor_->RegisterAsync(
34 sequencer->GetHandler("RegisterAsync() failed", true));
35}
36
37} // namespace dlp