| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/native_web_keyboard_event.h" | 8 #include "base/basictypes.h" |
| 9 #include "ui/views/view.h" | 9 |
| 10 namespace content { |
| 11 struct NativeWebKeyboardEvent; |
| 12 } |
| 10 | 13 |
| 11 namespace views { | 14 namespace views { |
| 12 class FocusManager; | 15 class FocusManager; |
| 13 } // namespace views | 16 } |
| 14 | 17 |
| 15 // This class handles unhandled keyboard messages coming back from the renderer | 18 // This class handles unhandled keyboard messages coming back from the renderer |
| 16 // process. | 19 // process. |
| 17 class UnhandledKeyboardEventHandler { | 20 class UnhandledKeyboardEventHandler { |
| 18 public: | 21 public: |
| 19 UnhandledKeyboardEventHandler(); | 22 UnhandledKeyboardEventHandler(); |
| 20 ~UnhandledKeyboardEventHandler(); | 23 ~UnhandledKeyboardEventHandler(); |
| 21 | 24 |
| 22 void HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event, | 25 void HandleKeyboardEvent(const content::NativeWebKeyboardEvent& event, |
| 23 views::FocusManager* focus_manager); | 26 views::FocusManager* focus_manager); |
| 24 | 27 |
| 25 private: | 28 private: |
| 26 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 27 // Whether to ignore the next Char keyboard event. | 30 // Whether to ignore the next Char keyboard event. |
| 28 // If a RawKeyDown event was handled as a shortcut key, then we're done | 31 // If a RawKeyDown event was handled as a shortcut key, then we're done |
| 29 // handling it and should eat any Char event that the translate phase may | 32 // handling it and should eat any Char event that the translate phase may |
| 30 // have produced from it. (Handling this event may cause undesirable effects, | 33 // have produced from it. (Handling this event may cause undesirable effects, |
| 31 // such as a beep if DefWindowProc() has no default handling for the given | 34 // such as a beep if DefWindowProc() has no default handling for the given |
| 32 // Char.) | 35 // Char.) |
| 33 bool ignore_next_char_event_; | 36 bool ignore_next_char_event_; |
| 34 #endif | 37 #endif |
| 35 | 38 |
| 36 DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler); | 39 DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler); |
| 37 }; | 40 }; |
| 38 | 41 |
| 39 #endif // CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ | 42 #endif // CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_ |
| OLD | NEW |