| 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/system/chromeos/power/battery_notification.h" | 5 #include "ash/system/chromeos/power/battery_notification.h" |
| 6 | 6 |
| 7 #include "ash/system/chromeos/power/power_status.h" | 7 #include "ash/system/chromeos/power/power_status.h" |
| 8 #include "ash/system/system_notifier.h" | 8 #include "ash/system/system_notifier.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 notification->SetSystemPriority(); | 87 notification->SetSystemPriority(); |
| 88 return notification; | 88 return notification; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 BatteryNotification::BatteryNotification( | 93 BatteryNotification::BatteryNotification( |
| 94 MessageCenter* message_center, | 94 MessageCenter* message_center, |
| 95 TrayPower::NotificationState notification_state) | 95 TrayPower::NotificationState notification_state) |
| 96 : message_center_(message_center) { | 96 : message_center_(message_center) { |
| 97 message_center_->AddNotification( | 97 message_center_->AddNotification(CreateNotification(notification_state)); |
| 98 CreateNotification(notification_state).Pass()); | |
| 99 } | 98 } |
| 100 | 99 |
| 101 BatteryNotification::~BatteryNotification() { | 100 BatteryNotification::~BatteryNotification() { |
| 102 if (message_center_->FindVisibleNotificationById(kBatteryNotificationId)) | 101 if (message_center_->FindVisibleNotificationById(kBatteryNotificationId)) |
| 103 message_center_->RemoveNotification(kBatteryNotificationId, false); | 102 message_center_->RemoveNotification(kBatteryNotificationId, false); |
| 104 } | 103 } |
| 105 | 104 |
| 106 void BatteryNotification::Update( | 105 void BatteryNotification::Update( |
| 107 TrayPower::NotificationState notification_state) { | 106 TrayPower::NotificationState notification_state) { |
| 108 if (message_center_->FindVisibleNotificationById(kBatteryNotificationId)) { | 107 if (message_center_->FindVisibleNotificationById(kBatteryNotificationId)) { |
| 109 message_center_->UpdateNotification( | 108 message_center_->UpdateNotification(kBatteryNotificationId, |
| 110 kBatteryNotificationId, CreateNotification(notification_state).Pass()); | 109 CreateNotification(notification_state)); |
| 111 } | 110 } |
| 112 } | 111 } |
| 113 | 112 |
| 114 } // namespace ash | 113 } // namespace ash |
| OLD | NEW |