blob: 744f225b20038ff408aec5415b8861deef6f8dc5 [file] [log] [blame]
// Copyright 2020 The Chromium OS 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 "pciguard/event_handler.h"
#include <session_manager/dbus-proxies.h>
#include <memory>
#include <string>
namespace pciguard {
// A class for monitoring events from the session manager. It is a dumb class
// and contains the boiler plate code to forward the session events to the
// event_handler class.
class SessionMonitor {
explicit SessionMonitor(scoped_refptr<dbus::Bus> bus,
EventHandler* ev_handler);
SessionMonitor(const SessionMonitor&) = delete;
SessionMonitor& operator=(const SessionMonitor&) = delete;
~SessionMonitor() = default;
// Handles the ScreenIsLocked DBus signal.
void OnScreenIsLocked();
// Handles the ScreenIsUnlocked DBus signal.
void OnScreenIsUnlocked();
// Handles the SessionStateChanged DBus signal.
void OnSessionStateChanged(const std::string& state);
org::chromium::SessionManagerInterfaceProxy proxy_;
EventHandler* event_handler_;
base::WeakPtrFactory<SessionMonitor> weak_ptr_factory_;
} // namespace pciguard