Sergey Poromov | b42c6ac | 2021-01-27 13:56:31 +0100 | [diff] [blame] | 1 | // 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 Fan | 713061e | 2021-03-08 15:45:12 +0900 | [diff] [blame] | 9 | #include <base/check.h> |
Sergey Poromov | b42c6ac | 2021-01-27 13:56:31 +0100 | [diff] [blame] | 10 | #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 | |
| 16 | namespace dlp { |
| 17 | |
| 18 | namespace { |
| 19 | const char kObjectServicePath[] = "/org/chromium/Dlp/ObjectManager"; |
| 20 | } // namespace |
| 21 | |
| 22 | DlpDaemon::DlpDaemon() |
| 23 | : DBusServiceDaemon(kDlpServiceName, kObjectServicePath) {} |
| 24 | DlpDaemon::~DlpDaemon() = default; |
| 25 | |
| 26 | void 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 |