summaryrefslogtreecommitdiff
path: root/chromium/ash/keyboard_uma_event_filter.h
blob: b25f2f934e0b63d6c1208463f0c6529d33d3c88d (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
35
36
// Copyright 2013 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_KEYBOARD_UMA_EVENT_FILTER_H_
#define ASH_KEYBOARD_UMA_EVENT_FILTER_H_

#include "base/compiler_specific.h"
#include "base/time/time.h"
#include "ui/events/event_handler.h"

namespace ash {
namespace internal {

// EventFilter for tracking keyboard-related metrics, which intercepts events
// before they are processed by the usual path and logs metrics about the
// events.
class KeyboardUMAEventFilter : public ui::EventHandler {
 public:
  KeyboardUMAEventFilter();
  virtual ~KeyboardUMAEventFilter();

  // ui::EventHandler overrides:
  virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;

 private:
  // The timestamp of the last character keystroke.
  base::TimeDelta last_keystroke_time_;

  DISALLOW_COPY_AND_ASSIGN(KeyboardUMAEventFilter);
};

}  // namespace internal
}  // namespace ash

#endif  // ASH_KEYBOARD_UMA_EVENT_FILTER_H_