summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/accessibility/system_event_observer.h
blob: 4102b034d93b3237cab856e4e8b763d976460d3c (plain)
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
// Copyright (c) 2011 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.

#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SYSTEM_EVENT_OBSERVER_H_
#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SYSTEM_EVENT_OBSERVER_H_
#pragma once

#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"

namespace chromeos {
namespace accessibility {

// A singleton class to observe system events like wake up from sleep and
// screen unlock.
class SystemEventObserver : public PowerManagerClient::Observer,
                            public ScreenLockLibrary::Observer {
 public:
  virtual ~SystemEventObserver();

  // PowerManagerClient::Observer override.
  virtual void SystemResumed() OVERRIDE;

  // ScreenLockLibrary::Observer override.
  virtual void LockScreen(ScreenLockLibrary* screen_lock_library) OVERRIDE;

  // ScreenLockLibrary::Observer override.
  virtual void UnlockScreen(ScreenLockLibrary* screen_lock_library) OVERRIDE;

  // ScreenLockLibrary::Observer override.
  virtual void UnlockScreenFailed(ScreenLockLibrary* screen_lock_library)
      OVERRIDE;

  // Creates the global SystemEventObserver instance.
  static void Initialize();

  // Returns a pointer to the global SystemEventObserver instance.
  // Initialize() should already have been called.
  static SystemEventObserver* GetInstance();

  // Destroys the global SystemEventObserver Instance.
  static void Shutdown();

 private:
  SystemEventObserver();

  DISALLOW_COPY_AND_ASSIGN(SystemEventObserver);
};

}  // namespace accessibility
}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SYSTEM_EVENT_OBSERVER_H_