Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: ash/keyboard_uma_event_filter.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/ime/input_method_event_handler.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "ash/keyboard_uma_event_filter.h" 5 #include "ash/keyboard_uma_event_filter.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 9
10 namespace { 10 namespace {
11 11
12 // This threshold is used to drop keystrokes that are more than some time apart. 12 // This threshold is used to drop keystrokes that are more than some time apart.
13 // These keystrokes are dropped to avoid recording outliers, as well as pauses 13 // These keystrokes are dropped to avoid recording outliers, as well as pauses
14 // between actual segments of typing. 14 // between actual segments of typing.
15 const int kKeystrokeThresholdInSeconds = 5; 15 const int kKeystrokeThresholdInSeconds = 5;
16
17 } 16 }
18 17
19 namespace ash { 18 namespace ash {
20 19
21 KeyboardUMAEventFilter::KeyboardUMAEventFilter() {} 20 KeyboardUMAEventFilter::KeyboardUMAEventFilter() {}
22 21
23 KeyboardUMAEventFilter::~KeyboardUMAEventFilter() {} 22 KeyboardUMAEventFilter::~KeyboardUMAEventFilter() {}
24 23
25 void KeyboardUMAEventFilter::OnKeyEvent(ui::KeyEvent* event) { 24 void KeyboardUMAEventFilter::OnKeyEvent(ui::KeyEvent* event) {
26 // This is a rough approximation, so assume that each key release is the 25 // This is a rough approximation, so assume that each key release is the
(...skipping 13 matching lines...) Expand all
40 } 39 }
41 40
42 base::TimeDelta delta = event->time_stamp() - last_keystroke_time_; 41 base::TimeDelta delta = event->time_stamp() - last_keystroke_time_;
43 if (delta < base::TimeDelta::FromSeconds(kKeystrokeThresholdInSeconds)) 42 if (delta < base::TimeDelta::FromSeconds(kKeystrokeThresholdInSeconds))
44 UMA_HISTOGRAM_TIMES("Keyboard.KeystrokeDeltas", delta); 43 UMA_HISTOGRAM_TIMES("Keyboard.KeystrokeDeltas", delta);
45 44
46 last_keystroke_time_ = event->time_stamp(); 45 last_keystroke_time_ = event->time_stamp();
47 } 46 }
48 47
49 } // namespace ash 48 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime/input_method_event_handler.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698