blob: 91ef2e4b694bc0a13c637bea77790532b0f35f1b [file] [log] [blame]
Andreea Costinas942284d2020-01-28 16:28:40 +01001// Copyright 2020 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 "system-proxy/system_proxy_daemon.h"
6
7#include <utility>
8
9#include <brillo/dbus/dbus_object.h>
10#include <dbus/system_proxy/dbus-constants.h>
11
12#include "system-proxy/system_proxy_adaptor.h"
13
14namespace system_proxy {
15
16namespace {
17const char kObjectServicePath[] = "/org/chromium/SystemProxy/ObjectManager";
18} // namespace
19
20SystemProxyDaemon::SystemProxyDaemon()
21 : DBusServiceDaemon(kSystemProxyServiceName, kObjectServicePath) {}
22SystemProxyDaemon::~SystemProxyDaemon() = default;
23
24void SystemProxyDaemon::RegisterDBusObjectsAsync(
25 brillo::dbus_utils::AsyncEventSequencer* sequencer) {
26 auto dbus_object = std::make_unique<brillo::dbus_utils::DBusObject>(
27 object_manager_.get(), object_manager_->GetBus(),
28 org::chromium::SystemProxyAdaptor::GetObjectPath());
29 DCHECK(!adaptor_);
30 adaptor_ = std::make_unique<SystemProxyAdaptor>(std::move(dbus_object));
31 adaptor_->RegisterAsync(
32 sequencer->GetHandler("RegisterAsync() failed", true));
33}
34} // namespace system_proxy