Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/common/system/chromeos/power/dual_role_notification.h" | 5 #include "ash/common/system/chromeos/power/dual_role_notification.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "ash/common/system/chromeos/power/power_status.h" | 9 #include "ash/common/system/chromeos/power/power_status.h" |
| 10 #include "ash/common/system/system_notifier.h" | 10 #include "ash/common/system/system_notifier.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 const char kDualRoleNotificationId[] = "dual-role"; | 30 const char kDualRoleNotificationId[] = "dual-role"; |
| 31 | 31 |
| 32 // Opens power settings on click. | 32 // Opens power settings on click. |
| 33 class DualRoleNotificationDelegate | 33 class DualRoleNotificationDelegate |
| 34 : public message_center::NotificationDelegate { | 34 : public message_center::NotificationDelegate { |
| 35 public: | 35 public: |
| 36 DualRoleNotificationDelegate() {} | 36 DualRoleNotificationDelegate() {} |
| 37 | 37 |
| 38 // Overridden from message_center::NotificationDelegate. | 38 // Overridden from message_center::NotificationDelegate. |
| 39 void Click() override { | 39 void Click() override { |
| 40 WmShell::Get()->system_tray_delegate()->ShowPowerSettings(); | 40 if (PowerStatus::Get()->IsBatteryPresent()) |
|
James Cook
2016/09/27 23:23:13
I'm unsure if we still need this check (I moved it
michaelpg
2016/09/28 23:09:15
We shouldn't show the *notification* if there isn'
James Cook
2016/09/29 15:28:29
Removed the if().
| |
| 41 WmShell::Get()->system_tray_delegate()->ShowPowerSettings(); | |
| 41 } | 42 } |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 ~DualRoleNotificationDelegate() override {} | 45 ~DualRoleNotificationDelegate() override {} |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(DualRoleNotificationDelegate); | 47 DISALLOW_COPY_AND_ASSIGN(DualRoleNotificationDelegate); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace | 50 } // namespace |
| 50 | 51 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 base::string16(), GURL(), | 149 base::string16(), GURL(), |
| 149 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 150 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 150 system_notifier::kNotifierDualRole), | 151 system_notifier::kNotifierDualRole), |
| 151 message_center::RichNotificationData(), | 152 message_center::RichNotificationData(), |
| 152 new DualRoleNotificationDelegate)); | 153 new DualRoleNotificationDelegate)); |
| 153 notification->set_priority(message_center::MIN_PRIORITY); | 154 notification->set_priority(message_center::MIN_PRIORITY); |
| 154 return notification; | 155 return notification; |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |