| 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 CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATION_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATION_H
_ |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATION_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATION_H
_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "chromeos/dbus/power_manager_client.h" | 12 #include "chromeos/dbus/power_manager_client.h" |
| 13 #include "ui/base/user_activity/user_activity_observer.h" | 13 #include "ui/base/user_activity/user_activity_observer.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 class IdleAppNameNotificationView; | 17 class IdleAppNameNotificationView; |
| 18 | 18 |
| 19 class KioskModeIdleAppNameNotification : public ui::UserActivityObserver, | 19 class KioskModeIdleAppNameNotification : public ui::UserActivityObserver, |
| 20 public PowerManagerClient::Observer { | 20 public PowerManagerClient::Observer { |
| 21 public: | 21 public: |
| 22 static void Initialize(); | 22 static void Initialize(); |
| 23 | 23 |
| 24 static void Shutdown(); | 24 static void Shutdown(); |
| 25 | 25 |
| 26 KioskModeIdleAppNameNotification(); | 26 KioskModeIdleAppNameNotification(); |
| 27 virtual ~KioskModeIdleAppNameNotification(); | 27 ~KioskModeIdleAppNameNotification() override; |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // Initialize idle app message when KioskModeHelper is initialized. | 30 // Initialize idle app message when KioskModeHelper is initialized. |
| 31 void Setup(); | 31 void Setup(); |
| 32 | 32 |
| 33 // ui::UserActivityObserver overrides: | 33 // ui::UserActivityObserver overrides: |
| 34 virtual void OnUserActivity(const ui::Event* event) override; | 34 void OnUserActivity(const ui::Event* event) override; |
| 35 | 35 |
| 36 // PowerManagerClient::Observer overrides: | 36 // PowerManagerClient::Observer overrides: |
| 37 virtual void SuspendDone(const base::TimeDelta& sleep_duration) override; | 37 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 38 | 38 |
| 39 // Begins listening for user activity and calls ResetTimer(). | 39 // Begins listening for user activity and calls ResetTimer(). |
| 40 void Start(); | 40 void Start(); |
| 41 | 41 |
| 42 // Resets |timer_| to fire when the application idle message should be shown. | 42 // Resets |timer_| to fire when the application idle message should be shown. |
| 43 void ResetTimer(); | 43 void ResetTimer(); |
| 44 | 44 |
| 45 // Invoked by |timer_| to display the application idle message. | 45 // Invoked by |timer_| to display the application idle message. |
| 46 void OnTimeout(); | 46 void OnTimeout(); |
| 47 | 47 |
| 48 base::OneShotTimer<KioskModeIdleAppNameNotification> timer_; | 48 base::OneShotTimer<KioskModeIdleAppNameNotification> timer_; |
| 49 | 49 |
| 50 // If set the notification should get shown upon next user activity. | 50 // If set the notification should get shown upon next user activity. |
| 51 bool show_notification_upon_next_user_activity_; | 51 bool show_notification_upon_next_user_activity_; |
| 52 | 52 |
| 53 // The notification object which owns and shows the notification. | 53 // The notification object which owns and shows the notification. |
| 54 scoped_ptr<IdleAppNameNotificationView> notification_; | 54 scoped_ptr<IdleAppNameNotificationView> notification_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(KioskModeIdleAppNameNotification); | 56 DISALLOW_COPY_AND_ASSIGN(KioskModeIdleAppNameNotification); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace chromeos | 59 } // namespace chromeos |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATIO
N_H_ | 61 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_MODE_IDLE_APP_NAME_NOTIFICATIO
N_H_ |
| OLD | NEW |