1// Copyright (c) 2006-2010 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.
4
5#ifndef CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
6#define CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
7#pragma once
8
9#include "views/view.h"
10#include "content/common/native_web_keyboard_event.h"
11
12namespace views {
13class FocusManager;
14}  // namespace views
15
16// This class handles unhandled keyboard messages coming back from the renderer
17// process.
18class UnhandledKeyboardEventHandler {
19 public:
20  UnhandledKeyboardEventHandler();
21  ~UnhandledKeyboardEventHandler();
22
23  void HandleKeyboardEvent(const NativeWebKeyboardEvent& event,
24                           views::FocusManager* focus_manager);
25
26 private:
27  // Whether to ignore the next Char keyboard event.
28  // 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
30  // 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
32  // Char.)
33  bool ignore_next_char_event_;
34
35  DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler);
36};
37
38#endif  // CHROME_BROWSER_UI_VIEWS_UNHANDLED_KEYBOARD_EVENT_HANDLER_H_
39