blob: 99c0b6daa11e6fdac2ff700e31952dc4733dc22d [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
Qijiang Fan713061e2021-03-08 15:45:12 +09009#include <base/check.h>
Andreea Costinas942284d2020-01-28 16:28:40 +010010#include <brillo/dbus/dbus_object.h>
11#include <dbus/system_proxy/dbus-constants.h>
12
13#include "system-proxy/system_proxy_adaptor.h"
14
15namespace system_proxy {
16
17namespace {
18const char kObjectServicePath[] = "/org/chromium/SystemProxy/ObjectManager";
19} // namespace
20
21SystemProxyDaemon::SystemProxyDaemon()
22 : DBusServiceDaemon(kSystemProxyServiceName, kObjectServicePath) {}
23SystemProxyDaemon::~SystemProxyDaemon() = default;
24
25void SystemProxyDaemon::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::SystemProxyAdaptor::GetObjectPath());
30 DCHECK(!adaptor_);
31 adaptor_ = std::make_unique<SystemProxyAdaptor>(std::move(dbus_object));
32 adaptor_->RegisterAsync(
33 sequencer->GetHandler("RegisterAsync() failed", true));
34}
35} // namespace system_proxy