OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/ws/user_activity_monitor.h" | 5 #include "services/ui/ws/user_activity_monitor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
9 | 10 |
10 namespace ui { | 11 namespace ui { |
11 namespace ws { | 12 namespace ws { |
12 | 13 |
13 UserActivityMonitor::UserActivityMonitor(std::unique_ptr<base::TickClock> clock) | 14 UserActivityMonitor::UserActivityMonitor(std::unique_ptr<base::TickClock> clock) |
14 : now_clock_(std::move(clock)) { | 15 : now_clock_(std::move(clock)) { |
15 if (!now_clock_) | 16 if (!now_clock_) |
16 now_clock_ = base::WrapUnique(new base::DefaultTickClock); | 17 now_clock_ = base::WrapUnique(new base::DefaultTickClock); |
17 last_activity_ = now_clock_->NowTicks(); | 18 last_activity_ = now_clock_->NowTicks(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 idle_observers_.erase(std::remove_if( | 126 idle_observers_.erase(std::remove_if( |
126 idle_observers_.begin(), idle_observers_.end(), | 127 idle_observers_.begin(), idle_observers_.end(), |
127 [observer]( | 128 [observer]( |
128 const std::pair<IdleObserverInfo, mojom::UserIdleObserverPtr>& pair) { | 129 const std::pair<IdleObserverInfo, mojom::UserIdleObserverPtr>& pair) { |
129 return pair.second.get() == observer; | 130 return pair.second.get() == observer; |
130 })); | 131 })); |
131 } | 132 } |
132 | 133 |
133 } // namespace ws | 134 } // namespace ws |
134 } // namespace ui | 135 } // namespace ui |
OLD | NEW |