blob: 9f1362114e5c35c0e43081da26715ce6536ef13c [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/dbus/dbus_helper.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chromeos/cryptohome/system_salt_getter.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/dbus/system_clock/system_clock_client.h"
#include "chromeos/tpm/install_attributes.h"
namespace chromeos {
void InitializeDBus() {
SystemSaltGetter::Initialize();
// Initialize DBusThreadManager for the browser.
DBusThreadManager::Initialize(DBusThreadManager::kAll);
// Initialize Chrome dbus clients.
dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus();
PowerManagerClient::Initialize(bus);
SystemClockClient::Initialize(bus);
// Initialize the device settings service so that we'll take actions per
// signals sent from the session manager. This needs to happen before
// g_browser_process initializes BrowserPolicyConnector.
DeviceSettingsService::Initialize();
InstallAttributes::Initialize();
}
void ShutdownDBus() {
// NOTE: These must only be called if InitializeDBus() was called.
PowerManagerClient::Shutdown();
SystemClockClient::Shutdown();
DBusThreadManager::Shutdown();
SystemSaltGetter::Shutdown();
}
} // namespace chromeos