| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LOW_BATTERY_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOW_BATTERY_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOW_BATTERY_OBSERVER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOW_BATTERY_OBSERVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 10 #include "base/time.h" | 11 #include "base/time.h" |
| 11 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 12 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 12 #include "chrome/browser/chromeos/notifications/system_notification.h" | 13 #include "chrome/browser/chromeos/notifications/system_notification.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 | 18 |
| 18 // The low battery observer displays a system notification when the battery | 19 // The low battery observer displays a system notification when the battery |
| 19 // is low. | 20 // is low. |
| 20 | 21 |
| 21 class LowBatteryObserver : public PowerManagerClient::Observer { | 22 class LowBatteryObserver : public PowerManagerClient::Observer { |
| 22 public: | 23 public: |
| 23 explicit LowBatteryObserver(Profile* profile); | 24 explicit LowBatteryObserver(Profile* profile); |
| 24 virtual ~LowBatteryObserver(); | 25 virtual ~LowBatteryObserver(); |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 virtual void PowerChanged(const PowerSupplyStatus& power_status); | 28 virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE; |
| 28 | 29 |
| 29 void Show(base::TimeDelta remaining, bool urgent); | 30 void Show(base::TimeDelta remaining, bool urgent); |
| 30 void Hide(); | 31 void Hide(); |
| 31 | 32 |
| 32 SystemNotification notification_; | 33 SystemNotification notification_; |
| 33 int remaining_; // Last displayed remaining time in minutes | 34 int remaining_; // Last displayed remaining time in minutes |
| 34 | 35 |
| 35 DISALLOW_COPY_AND_ASSIGN(LowBatteryObserver); | 36 DISALLOW_COPY_AND_ASSIGN(LowBatteryObserver); |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 } // namespace chromeos | 39 } // namespace chromeos |
| 39 | 40 |
| 40 #endif // CHROME_BROWSER_CHROMEOS_LOW_BATTERY_OBSERVER_H_ | 41 #endif // CHROME_BROWSER_CHROMEOS_LOW_BATTERY_OBSERVER_H_ |
| OLD | NEW |