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 #include "ash/system/chromeos/power/tray_power.h" | 5 #include "ash/system/chromeos/power/tray_power.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
8 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
9 #include "ash/shell.h" | 11 #include "ash/shell.h" |
10 #include "ash/system/chromeos/devicetype_utils.h" | 12 #include "ash/system/chromeos/devicetype_utils.h" |
11 #include "ash/system/chromeos/power/battery_notification.h" | 13 #include "ash/system/chromeos/power/battery_notification.h" |
12 #include "ash/system/chromeos/power/dual_role_notification.h" | 14 #include "ash/system/chromeos/power/dual_role_notification.h" |
13 #include "ash/system/date/date_view.h" | 15 #include "ash/system/date/date_view.h" |
14 #include "ash/system/system_notifier.h" | 16 #include "ash/system/system_notifier.h" |
15 #include "ash/system/tray/system_tray_delegate.h" | 17 #include "ash/system/tray/system_tray_delegate.h" |
16 #include "ash/system/tray/tray_constants.h" | 18 #include "ash/system/tray/tray_constants.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 message_center::NOTIFICATION_TYPE_SIMPLE, kUsbNotificationId, | 225 message_center::NOTIFICATION_TYPE_SIMPLE, kUsbNotificationId, |
224 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE), | 226 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE), |
225 ash::SubstituteChromeOSDeviceType( | 227 ash::SubstituteChromeOSDeviceType( |
226 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT), | 228 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT), |
227 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), | 229 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), |
228 base::string16(), GURL(), | 230 base::string16(), GURL(), |
229 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 231 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
230 system_notifier::kNotifierPower), | 232 system_notifier::kNotifierPower), |
231 message_center::RichNotificationData(), | 233 message_center::RichNotificationData(), |
232 new UsbNotificationDelegate(this))); | 234 new UsbNotificationDelegate(this))); |
233 message_center_->AddNotification(notification.Pass()); | 235 message_center_->AddNotification(std::move(notification)); |
234 return true; | 236 return true; |
235 } else if (!usb_charger_is_connected && usb_charger_was_connected_) { | 237 } else if (!usb_charger_is_connected && usb_charger_was_connected_) { |
236 // USB charger was unplugged or was identified as a different type while | 238 // USB charger was unplugged or was identified as a different type while |
237 // the USB charger notification was showing. | 239 // the USB charger notification was showing. |
238 message_center_->RemoveNotification(kUsbNotificationId, false); | 240 message_center_->RemoveNotification(kUsbNotificationId, false); |
239 if (!status.IsLinePowerConnected()) | 241 if (!status.IsLinePowerConnected()) |
240 usb_notification_dismissed_ = false; | 242 usb_notification_dismissed_ = false; |
241 return true; | 243 return true; |
242 } | 244 } |
243 return false; | 245 return false; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 347 } |
346 NOTREACHED(); | 348 NOTREACHED(); |
347 return false; | 349 return false; |
348 } | 350 } |
349 | 351 |
350 void TrayPower::NotifyUsbNotificationClosedByUser() { | 352 void TrayPower::NotifyUsbNotificationClosedByUser() { |
351 usb_notification_dismissed_ = true; | 353 usb_notification_dismissed_ = true; |
352 } | 354 } |
353 | 355 |
354 } // namespace ash | 356 } // namespace ash |
OLD | NEW |