#ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_
#define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_X11_H_
#include <X11/Xlib.h>
#include <set>
#include "base/message_loop/message_pump_dispatcher.h"
#include "chrome/browser/extensions/global_shortcut_listener.h"
#if defined(TOOLKIT_GTK)
#include <gtk/gtk.h>
#include "ui/base/gtk/gtk_signal.h"
#endif
namespace extensions {
class GlobalShortcutListenerX11
:
#if !defined(TOOLKIT_GTK)
public base::MessagePumpDispatcher,
#endif
public GlobalShortcutListener {
public:
GlobalShortcutListenerX11();
virtual ~GlobalShortcutListenerX11();
#if !defined(TOOLKIT_GTK)
virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE;
#endif
private:
virtual void StartListening() OVERRIDE;
virtual void StopListening() OVERRIDE;
virtual bool RegisterAcceleratorImpl(
const ui::Accelerator& accelerator) OVERRIDE;
virtual void UnregisterAcceleratorImpl(
const ui::Accelerator& accelerator) OVERRIDE;
#if defined(TOOLKIT_GTK)
CHROMEG_CALLBACK_1(GlobalShortcutListenerX11, GdkFilterReturn,
OnXEvent, GdkXEvent*, GdkEvent*);
#endif
void OnXKeyPressEvent(::XEvent* x_event);
bool is_listening_;
::Display* x_display_;
::Window x_root_window_;
typedef std::set<ui::Accelerator> RegisteredHotKeys;
RegisteredHotKeys registered_hot_keys_;
DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerX11);
};
}
#endif