| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/idle_detector.h" | 5 #include "chrome/browser/chromeos/idle_detector.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/user_activity_detector.h" | |
| 9 #include "base/bind.h" | 8 #include "base/bind.h" |
| 10 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/wm/core/user_activity_detector.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 IdleDetector::IdleDetector(const base::Closure& on_active_callback, | 14 IdleDetector::IdleDetector(const base::Closure& on_active_callback, |
| 15 const base::Closure& on_idle_callback) | 15 const base::Closure& on_idle_callback) |
| 16 : active_callback_(on_active_callback), idle_callback_(on_idle_callback) {} | 16 : active_callback_(on_active_callback), idle_callback_(on_idle_callback) {} |
| 17 | 17 |
| 18 IdleDetector::~IdleDetector() { | 18 IdleDetector::~IdleDetector() { |
| 19 if (ash::Shell::HasInstance() && | 19 if (ash::Shell::HasInstance() && |
| 20 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) | 20 ash::Shell::GetInstance()->user_activity_detector()->HasObserver(this)) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 void IdleDetector::ResetTimer() { | 37 void IdleDetector::ResetTimer() { |
| 38 if (timer_.IsRunning()) | 38 if (timer_.IsRunning()) |
| 39 timer_.Reset(); | 39 timer_.Reset(); |
| 40 else | 40 else |
| 41 timer_.Start(FROM_HERE, timeout_, idle_callback_); | 41 timer_.Start(FROM_HERE, timeout_, idle_callback_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace chromeos | 44 } // namespace chromeos |
| OLD | NEW |