summaryrefslogtreecommitdiffstats
path: root/ash/event_rewriter_delegate.h
blob: c54c9a37078667a19368dad11c5bc125b9e5c50d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_EVENT_REWRITER_DELEGATE_H_
#define ASH_EVENT_REWRITER_DELEGATE_H_

namespace ui {
class KeyEvent;
class LocatedEvent;
}  // namespace aura

namespace ash {

// Delegate for rewriting or filtering an event.
class EventRewriterDelegate {
 public:
  enum Action {
    ACTION_REWRITE_EVENT,
    ACTION_DROP_EVENT,
  };

  virtual ~EventRewriterDelegate() {}

  // A derived class can do either of the following:
  // 1) Just return ACTION_DROP_EVENT to drop the |event|.
  // 2) Rewrite the |event| and return ACTION_REWRITE_EVENT.
  virtual Action RewriteOrFilterKeyEvent(ui::KeyEvent* event) = 0;
  virtual Action RewriteOrFilterLocatedEvent(ui::LocatedEvent* event) = 0;
};

}  // namespace ash

#endif  // ASH_EVENT_REWRITER_DELEGATE_H_