| 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 #ifndef UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ | 5 #ifndef UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ |
| 6 #define UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ | 6 #define UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "ui/base/user_activity/user_activity_observer.h" | 11 #include "ui/base/user_activity/user_activity_observer.h" |
| 12 #include "ui/chromeos/ui_chromeos_export.h" | 12 #include "ui/chromeos/ui_chromeos_export.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 class UserActivityDetector; | 16 class UserActivityDetector; |
| 17 | 17 |
| 18 // Notifies the power manager when the user is active. | 18 // Notifies the power manager via D-Bus when the user is active. |
| 19 class UI_CHROMEOS_EXPORT UserActivityPowerManagerNotifier | 19 class UI_CHROMEOS_EXPORT UserActivityPowerManagerNotifier |
| 20 : public UserActivityObserver { | 20 : public UserActivityObserver { |
| 21 public: | 21 public: |
| 22 // Registers and unregisters itself as an observer of |detector| on |
| 23 // construction and destruction. |
| 22 explicit UserActivityPowerManagerNotifier(UserActivityDetector* detector); | 24 explicit UserActivityPowerManagerNotifier(UserActivityDetector* detector); |
| 23 ~UserActivityPowerManagerNotifier() override; | 25 ~UserActivityPowerManagerNotifier() override; |
| 24 | 26 |
| 25 // UserActivityObserver implementation. | 27 // UserActivityObserver implementation. |
| 26 void OnUserActivity(const Event* event) override; | 28 void OnUserActivity(const Event* event) override; |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 UserActivityDetector* detector_; // not owned | 31 UserActivityDetector* detector_; // not owned |
| 30 | 32 |
| 31 // Last time that the power manager was notified. | 33 // Last time that the power manager was notified. |
| 32 base::TimeTicks last_notify_time_; | 34 base::TimeTicks last_notify_time_; |
| 33 | 35 |
| 34 DISALLOW_COPY_AND_ASSIGN(UserActivityPowerManagerNotifier); | 36 DISALLOW_COPY_AND_ASSIGN(UserActivityPowerManagerNotifier); |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 } // namespace ui | 39 } // namespace ui |
| 38 | 40 |
| 39 #endif // UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ | 41 #endif // UI_CHROMEOS_USER_ACTIVITY_POWER_MANAGER_NOTIFIER_H_ |
| OLD | NEW |