OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ |
6 #define ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ | 6 #define ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ |
7 | 7 |
8 #include "ash/system/chromeos/power/power_status.h" | 8 #include "ash/system/chromeos/power/power_status.h" |
9 #include "ash/system/tray/system_tray_item.h" | 9 #include "ash/system/tray/system_tray_item.h" |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 static const int kLowPowerPercentage; | 51 static const int kLowPowerPercentage; |
52 static const int kNoWarningPercentage; | 52 static const int kNoWarningPercentage; |
53 | 53 |
54 TrayPower(SystemTray* system_tray, | 54 TrayPower(SystemTray* system_tray, |
55 message_center::MessageCenter* message_center); | 55 message_center::MessageCenter* message_center); |
56 virtual ~TrayPower(); | 56 virtual ~TrayPower(); |
57 | 57 |
58 private: | 58 private: |
59 friend class TrayPowerTest; | 59 friend class TrayPowerTest; |
60 | 60 |
61 enum ExternalPowerSupply{ | |
62 UNKNOWN_CHARGER, | |
63 MAINS_CHARGER, | |
64 USB_CHARGER, | |
65 ORIGINAL_SPRING_CHARGER, | |
Daniel Erat
2013/12/10 00:08:58
i think that the terminology here is getting confu
jennyz
2013/12/10 19:14:11
Done.
| |
66 SAFE_SPRING_CHARGER, | |
67 NUM_EXTERNAL_POWER_SUPPLY, | |
xiyuan
2013/12/10 00:21:19
From what I learned from isherman@ on another CL,
jennyz
2013/12/10 19:14:11
The last enum value is already the count, renamed
| |
68 }; | |
69 | |
61 // Overridden from SystemTrayItem. | 70 // Overridden from SystemTrayItem. |
62 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; | 71 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; |
63 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 72 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
64 virtual views::View* CreateNotificationView( | 73 virtual views::View* CreateNotificationView( |
65 user::LoginStatus status) OVERRIDE; | 74 user::LoginStatus status) OVERRIDE; |
66 virtual void DestroyTrayView() OVERRIDE; | 75 virtual void DestroyTrayView() OVERRIDE; |
67 virtual void DestroyDefaultView() OVERRIDE; | 76 virtual void DestroyDefaultView() OVERRIDE; |
68 virtual void DestroyNotificationView() OVERRIDE; | 77 virtual void DestroyNotificationView() OVERRIDE; |
69 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; | 78 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; |
70 virtual void UpdateAfterShelfAlignmentChange( | 79 virtual void UpdateAfterShelfAlignmentChange( |
71 ShelfAlignment alignment) OVERRIDE; | 80 ShelfAlignment alignment) OVERRIDE; |
72 | 81 |
73 // Overridden from PowerStatus::Observer. | 82 // Overridden from PowerStatus::Observer. |
74 virtual void OnPowerStatusChanged() OVERRIDE; | 83 virtual void OnPowerStatusChanged() OVERRIDE; |
75 | 84 |
76 // Show a notification that a low-power USB charger has been connected. | 85 // Show a notification that a low-power USB charger has been connected. |
77 // Returns true if a notification was shown or explicitly hidden. | 86 // Returns true if a notification was shown or explicitly hidden. |
78 bool MaybeShowUsbChargerNotification(); | 87 bool MaybeShowUsbChargerNotification(); |
79 | 88 |
80 // Sets |notification_state_|. Returns true if a notification should be shown. | 89 // Sets |notification_state_|. Returns true if a notification should be shown. |
81 bool UpdateNotificationState(); | 90 bool UpdateNotificationState(); |
82 bool UpdateNotificationStateForRemainingTime(); | 91 bool UpdateNotificationStateForRemainingTime(); |
83 bool UpdateNotificationStateForRemainingPercentage(); | 92 bool UpdateNotificationStateForRemainingPercentage(); |
84 | 93 |
94 // Records the external power supply type in UMA. | |
95 void RecordExternalPowerSupply(); | |
Daniel Erat
2013/12/10 00:08:58
nit: rename to something like RecordChargerType()?
jennyz
2013/12/10 19:14:11
Done.
| |
96 | |
85 message_center::MessageCenter* message_center_; // Not owned. | 97 message_center::MessageCenter* message_center_; // Not owned. |
86 tray::PowerTrayView* power_tray_; | 98 tray::PowerTrayView* power_tray_; |
87 tray::PowerNotificationView* notification_view_; | 99 tray::PowerNotificationView* notification_view_; |
88 NotificationState notification_state_; | 100 NotificationState notification_state_; |
89 | 101 |
90 // Was a USB charger connected the last time OnPowerStatusChanged() was | 102 // Was a USB charger connected the last time OnPowerStatusChanged() was |
91 // called? | 103 // called? |
92 bool usb_charger_was_connected_; | 104 bool usb_charger_was_connected_; |
93 | 105 |
106 bool is_line_power_connected_; | |
Daniel Erat
2013/12/10 00:08:58
add a comment describing what this is and match th
jennyz
2013/12/10 19:14:11
Done.
| |
107 | |
94 DISALLOW_COPY_AND_ASSIGN(TrayPower); | 108 DISALLOW_COPY_AND_ASSIGN(TrayPower); |
95 }; | 109 }; |
96 | 110 |
97 } // namespace internal | 111 } // namespace internal |
98 } // namespace ash | 112 } // namespace ash |
99 | 113 |
100 #endif // ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ | 114 #endif // ASH_SYSTEM_CHROMEOS_POWER_TRAY_POWER_H_ |
OLD | NEW |