1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_EVENTS_SYSTEM_KEY_EVENT_LISTENER_H_
6 #define CHROME_BROWSER_CHROMEOS_EVENTS_SYSTEM_KEY_EVENT_LISTENER_H_
8 #include "base/memory/singleton.h"
9 #include "ui/events/platform/platform_event_observer.h"
11 typedef union _XEvent XEvent;
15 class SystemKeyEventListener : public ui::PlatformEventObserver {
17 static void Initialize();
18 static void Shutdown();
19 // GetInstance returns NULL if not initialized or if already shutdown.
20 static SystemKeyEventListener* GetInstance();
25 // Defines the delete on exit Singleton traits we like. Best to have this
26 // and const/dest private as recommended for Singletons.
27 friend struct DefaultSingletonTraits<SystemKeyEventListener>;
28 friend class SystemKeyEventListenerTest;
30 SystemKeyEventListener();
31 virtual ~SystemKeyEventListener();
33 // ui::PlatformEventObserver:
34 virtual void WillProcessEvent(const ui::PlatformEvent& event) override;
35 virtual void DidProcessEvent(const ui::PlatformEvent& event) override;
37 void ProcessedXEvent(XEvent* xevent);
41 // Base X ID for events from the XKB extension.
44 DISALLOW_COPY_AND_ASSIGN(SystemKeyEventListener);
47 } // namespace chromeos
49 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_SYSTEM_KEY_EVENT_LISTENER_H_