summaryrefslogtreecommitdiffstats
path: root/ash/keyboard_uma_event_filter.h
blob: a52cf357180e2acad782fa3fa5bcb7c834ef7cc1 (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
// 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/macros.h"
#include "base/time/time.h"
#include "ui/events/event_handler.h"

namespace ash {

// 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();
  ~KeyboardUMAEventFilter() override;

  // ui::EventHandler overrides:
  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 ash

#endif  // ASH_KEYBOARD_UMA_EVENT_FILTER_H_