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
ash / system / tray / time_to_click_recorder.cc [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/tray/time_to_click_recorder.h"
#include "ui/events/event.h"
#include "ui/views/view.h"
namespace ash {
TimeToClickRecorder::TimeToClickRecorder(Delegate* delegate,
views::View* target_view)
: delegate_(delegate) {
target_view->AddPreTargetHandler(this);
}
void TimeToClickRecorder::OnEvent(ui::Event* event) {
// Ignore if the event is neither click nor tap.
if (event->type() != ui::EventType::kMousePressed &&
event->type() != ui::EventType::kGestureTap) {
return;
}
delegate_->RecordTimeToClick();
}
} // namespace ash