| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 void Stop(); | 37 void Stop(); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // Defines the delete on exit Singleton traits we like. Best to have this | 40 // Defines the delete on exit Singleton traits we like. Best to have this |
| 41 // and const/dest private as recommended for Singletons. | 41 // and const/dest private as recommended for Singletons. |
| 42 friend struct DefaultSingletonTraits<SystemKeyEventListener>; | 42 friend struct DefaultSingletonTraits<SystemKeyEventListener>; |
| 43 | 43 |
| 44 SystemKeyEventListener(); | 44 SystemKeyEventListener(); |
| 45 virtual ~SystemKeyEventListener(); | 45 virtual ~SystemKeyEventListener(); |
| 46 | 46 |
| 47 #if defined(TOUCH_UI) |
| 48 // MessageLoopForUI::Observer overrides. |
| 49 virtual EventStatus WillProcessXEvent(XEvent* xevent) OVERRIDE; |
| 50 #else |
| 47 // This event filter intercepts events before they reach GDK, allowing us to | 51 // This event filter intercepts events before they reach GDK, allowing us to |
| 48 // check for system level keyboard events regardless of which window has | 52 // check for system level keyboard events regardless of which window has |
| 49 // focus. | 53 // focus. |
| 50 static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent, | 54 static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent, |
| 51 GdkEvent* gevent, | 55 GdkEvent* gevent, |
| 52 gpointer data); | 56 gpointer data); |
| 53 | 57 |
| 58 // MessageLoopForUI::Observer overrides. |
| 59 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {} |
| 60 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE {} |
| 61 #endif |
| 62 |
| 54 // Tell X we are interested in the specified key/mask combination. | 63 // Tell X we are interested in the specified key/mask combination. |
| 55 // Capslock and Numlock are always ignored. | 64 // Capslock and Numlock are always ignored. |
| 56 void GrabKey(int32 key, uint32 mask); | 65 void GrabKey(int32 key, uint32 mask); |
| 57 | 66 |
| 58 void OnVolumeMute(); | 67 void OnVolumeMute(); |
| 59 void OnVolumeDown(); | 68 void OnVolumeDown(); |
| 60 void OnVolumeUp(); | 69 void OnVolumeUp(); |
| 61 | 70 |
| 62 // MessageLoopForUI::Observer overrides. | 71 // Returns true if the event was processed, false otherwise. |
| 63 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {} | 72 virtual bool ProcessedXEvent(XEvent* xevent); |
| 64 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE {} | |
| 65 virtual bool WillProcessXEvent(XEvent* xevent) | |
| 66 #if defined(TOUCH_UI) | |
| 67 OVERRIDE | |
| 68 #endif | |
| 69 ; | |
| 70 | 73 |
| 71 int32 key_volume_mute_; | 74 int32 key_volume_mute_; |
| 72 int32 key_volume_down_; | 75 int32 key_volume_down_; |
| 73 int32 key_volume_up_; | 76 int32 key_volume_up_; |
| 74 int32 key_f8_; | 77 int32 key_f8_; |
| 75 int32 key_f9_; | 78 int32 key_f9_; |
| 76 int32 key_f10_; | 79 int32 key_f10_; |
| 77 | 80 |
| 78 bool stopped_; | 81 bool stopped_; |
| 79 | 82 |
| 80 // AudioHandler is a Singleton class we are just caching a pointer to here, | 83 // AudioHandler is a Singleton class we are just caching a pointer to here, |
| 81 // and we do not own the pointer. | 84 // and we do not own the pointer. |
| 82 AudioHandler* const audio_handler_; | 85 AudioHandler* const audio_handler_; |
| 83 | 86 |
| 84 DISALLOW_COPY_AND_ASSIGN(SystemKeyEventListener); | 87 DISALLOW_COPY_AND_ASSIGN(SystemKeyEventListener); |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 } // namespace chromeos | 90 } // namespace chromeos |
| 88 | 91 |
| 89 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_KEY_EVENT_LISTENER_H_ |
| 90 | 93 |
| OLD | NEW |