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

Side by Side Diff: ui/aura/mus/user_activity_forwarder.cc

Issue 2639703004: mus: Forward user activity from window server to detector. (Closed)
Patch Set: address jamescook@'s comments Created 3 years, 11 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 | « ui/aura/mus/user_activity_forwarder.h ('k') | ui/aura/mus/user_activity_forwarder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include <cstdint>
9
10 #include "ui/base/user_activity/user_activity_detector.h"
11
12 namespace aura {
13
14 UserActivityForwarder::UserActivityForwarder(
15 ui::mojom::UserActivityMonitorPtr monitor,
16 ui::UserActivityDetector* detector)
17 : monitor_(std::move(monitor)), binding_(this), detector_(detector) {
18 DCHECK(detector_);
19
20 // Round UserActivityDetector's notification interval up to the nearest
21 // second (the granularity exposed by UserActivityMonitor).
22 const uint32_t kNotifyIntervalSec = static_cast<uint32_t>(
23 ceil(ui::UserActivityDetector::kNotifyIntervalMs / 1000.0));
24 monitor_->AddUserActivityObserver(kNotifyIntervalSec,
25 binding_.CreateInterfacePtrAndBind());
26 }
27
28 UserActivityForwarder::~UserActivityForwarder() {}
29
30 void UserActivityForwarder::OnUserActivity() {
31 detector_->HandleExternalUserActivity();
32 }
33
34 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/user_activity_forwarder.h ('k') | ui/aura/mus/user_activity_forwarder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698