1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65

ash / dbus / ash_dbus_services.cc [blame]

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/dbus/ash_dbus_services.h"

#include "ash/constants/ash_features.h"
#include "ash/dbus/display_service_provider.h"
#include "ash/dbus/gesture_properties_service_provider.h"
#include "ash/dbus/liveness_service_provider.h"
#include "ash/dbus/privacy_screen_service_provider.h"
#include "ash/dbus/url_handler_service_provider.h"
#include "ash/dbus/user_authentication_service_provider.h"
#include "base/feature_list.h"
#include "chromeos/ash/components/dbus/services/cros_dbus_service.h"
#include "dbus/object_path.h"
#include "third_party/cros_system_api/dbus/service_constants.h"

namespace ash {

AshDBusServices::AshDBusServices(dbus::Bus* system_bus) {
  display_service_ =
      CrosDBusService::Create(system_bus, chromeos::kDisplayServiceName,
                              dbus::ObjectPath(chromeos::kDisplayServicePath),
                              CrosDBusService::CreateServiceProviderList(
                                  std::make_unique<DisplayServiceProvider>()));
  if (base::FeatureList::IsEnabled(features::kGesturePropertiesDBusService)) {
    gesture_properties_service_ = CrosDBusService::Create(
        system_bus, chromeos::kGesturePropertiesServiceName,
        dbus::ObjectPath(chromeos::kGesturePropertiesServicePath),
        CrosDBusService::CreateServiceProviderList(
            std::make_unique<GesturePropertiesServiceProvider>()));
  }
  liveness_service_ =
      CrosDBusService::Create(system_bus, chromeos::kLivenessServiceName,
                              dbus::ObjectPath(chromeos::kLivenessServicePath),
                              CrosDBusService::CreateServiceProviderList(
                                  std::make_unique<LivenessServiceProvider>()));
  privacy_screen_service_ = CrosDBusService::Create(
      system_bus, privacy_screen::kPrivacyScreenServiceName,
      dbus::ObjectPath(privacy_screen::kPrivacyScreenServicePath),
      CrosDBusService::CreateServiceProviderList(
          std::make_unique<PrivacyScreenServiceProvider>()));
  url_handler_service_ = CrosDBusService::Create(
      system_bus, chromeos::kUrlHandlerServiceName,
      dbus::ObjectPath(chromeos::kUrlHandlerServicePath),
      CrosDBusService::CreateServiceProviderList(
          std::make_unique<UrlHandlerServiceProvider>()));
  user_authentication_service_ = CrosDBusService::Create(
      system_bus, chromeos::kUserAuthenticationServiceName,
      dbus::ObjectPath(chromeos::kUserAuthenticationServicePath),
      CrosDBusService::CreateServiceProviderList(
          std::make_unique<UserAuthenticationServiceProvider>()));
}

AshDBusServices::~AshDBusServices() {
  display_service_.reset();
  gesture_properties_service_.reset();
  liveness_service_.reset();
  privacy_screen_service_.reset();
  url_handler_service_.reset();
  user_authentication_service_.reset();
}

}  // namespace ash