1 // Copyright 2013 The Chromium 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.
5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_POWER_EVENT_OBSERVER_H_
6 #define ASH_SYSTEM_CHROMEOS_POWER_POWER_EVENT_OBSERVER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "chromeos/dbus/power_manager_client.h"
13 #include "chromeos/dbus/session_manager_client.h"
17 // A class that observes power-management-related events.
18 class ASH_EXPORT PowerEventObserver
19 : public chromeos::PowerManagerClient::Observer,
20 public chromeos::SessionManagerClient::Observer {
22 // This class registers/unregisters itself as an observer in ctor/dtor.
24 virtual ~PowerEventObserver();
26 // chromeos::PowerManagerClient::Observer overrides:
27 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE;
28 virtual void SuspendImminent() OVERRIDE;
29 virtual void SuspendDone(const base::TimeDelta& sleep_duration) OVERRIDE;
31 // chromeos::SessionManagerClient::Observer overrides.
32 virtual void ScreenIsLocked() OVERRIDE;
33 virtual void ScreenIsUnlocked() OVERRIDE;
35 // Is the screen currently locked?
38 // If set, called when the lock screen has been shown to confirm that the
39 // system is ready to be suspended.
40 base::Closure screen_lock_callback_;
43 DISALLOW_COPY_AND_ASSIGN(PowerEventObserver);
46 } // namespace chromeos
48 #endif // ASH_SYSTEM_CHROMEOS_POWER_POWER_EVENT_OBSERVER_H_