OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/aura/mus/user_activity_forwarder.h" | |
6 | |
7 #include <cmath> | |
8 | |
9 #include "ui/base/user_activity/user_activity_detector.h" | |
10 | |
11 namespace aura { | |
12 | |
13 UserActivityForwarder::UserActivityForwarder( | |
14 ui::mojom::UserActivityMonitorPtr monitor, | |
15 ui::UserActivityDetector* detector) | |
16 : monitor_(std::move(monitor)), binding_(this), detector_(detector) { | |
17 DCHECK(detector_); | |
18 | |
19 // Round UserActivityDetector's notification interval up to the nearest | |
20 // second (the granularity exposed by UserActivityMonitor). | |
21 const uint32_t kNotifyIntervalSec = static_cast<uint32_t>( | |
James Cook
2017/01/20 03:38:49
nit: #include <stdint.h> for uint32_t ?
Daniel Erat
2017/01/20 16:49:45
Done.
| |
22 ceil(ui::UserActivityDetector::kNotifyIntervalMs / 1000.0)); | |
23 monitor_->AddUserActivityObserver(kNotifyIntervalSec, | |
24 binding_.CreateInterfacePtrAndBind()); | |
25 } | |
26 | |
27 UserActivityForwarder::~UserActivityForwarder() {} | |
28 | |
29 void UserActivityForwarder::OnUserActivity() { | |
30 detector_->HandleExternalUserActivity(); | |
31 } | |
32 | |
33 } // namespace aura | |
OLD | NEW |