| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accessibility_delegate.h" | 9 #include "ash/accessibility_delegate.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 bool TrayPower::MaybeShowUsbChargerNotification() { | 215 bool TrayPower::MaybeShowUsbChargerNotification() { |
| 216 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 216 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 217 const PowerStatus& status = *PowerStatus::Get(); | 217 const PowerStatus& status = *PowerStatus::Get(); |
| 218 | 218 |
| 219 bool usb_charger_is_connected = status.IsUsbChargerConnected(); | 219 bool usb_charger_is_connected = status.IsUsbChargerConnected(); |
| 220 | 220 |
| 221 // Check for a USB charger being connected. | 221 // Check for a USB charger being connected. |
| 222 if (usb_charger_is_connected && !usb_charger_was_connected_ && | 222 if (usb_charger_is_connected && !usb_charger_was_connected_ && |
| 223 !usb_notification_dismissed_) { | 223 !usb_notification_dismissed_) { |
| 224 scoped_ptr<Notification> notification(new Notification( | 224 std::unique_ptr<Notification> notification(new Notification( |
| 225 message_center::NOTIFICATION_TYPE_SIMPLE, kUsbNotificationId, | 225 message_center::NOTIFICATION_TYPE_SIMPLE, kUsbNotificationId, |
| 226 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE), | 226 rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_TITLE), |
| 227 ash::SubstituteChromeOSDeviceType( | 227 ash::SubstituteChromeOSDeviceType( |
| 228 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT), | 228 IDS_ASH_STATUS_TRAY_LOW_POWER_CHARGER_MESSAGE_SHORT), |
| 229 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), | 229 rb.GetImageNamed(IDR_AURA_NOTIFICATION_LOW_POWER_CHARGER), |
| 230 base::string16(), GURL(), | 230 base::string16(), GURL(), |
| 231 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 231 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 232 system_notifier::kNotifierPower), | 232 system_notifier::kNotifierPower), |
| 233 message_center::RichNotificationData(), | 233 message_center::RichNotificationData(), |
| 234 new UsbNotificationDelegate(this))); | 234 new UsbNotificationDelegate(this))); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 347 } |
| 348 NOTREACHED(); | 348 NOTREACHED(); |
| 349 return false; | 349 return false; |
| 350 } | 350 } |
| 351 | 351 |
| 352 void TrayPower::NotifyUsbNotificationClosedByUser() { | 352 void TrayPower::NotifyUsbNotificationClosedByUser() { |
| 353 usb_notification_dismissed_ = true; | 353 usb_notification_dismissed_ = true; |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace ash | 356 } // namespace ash |
| OLD | NEW |