| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/power/peripheral_battery_observer.h" | 5 #include "chrome/browser/chromeos/power/peripheral_battery_observer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/strings/grit/ash_strings.h" | 10 #include "ash/strings/grit/ash_strings.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 return false; | 209 return false; |
| 210 | 210 |
| 211 NotificationUIManager* notification_manager = | 211 NotificationUIManager* notification_manager = |
| 212 g_browser_process->notification_ui_manager(); | 212 g_browser_process->notification_ui_manager(); |
| 213 | 213 |
| 214 base::string16 string_text = l10n_util::GetStringFUTF16Int( | 214 base::string16 string_text = l10n_util::GetStringFUTF16Int( |
| 215 IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT, | 215 IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT, |
| 216 battery.level); | 216 battery.level); |
| 217 | 217 |
| 218 Notification notification( | 218 Notification notification( |
| 219 // TODO(mukai): add SYSTEM priority and use here. | 219 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 220 GURL(kNotificationOriginUrl), | 220 GURL(kNotificationOriginUrl), |
| 221 base::UTF8ToUTF16(battery.name), |
| 222 string_text, |
| 221 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 223 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 222 IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW), | 224 IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW), |
| 223 base::UTF8ToUTF16(battery.name), | |
| 224 string_text, | |
| 225 blink::WebTextDirectionDefault, | 225 blink::WebTextDirectionDefault, |
| 226 message_center::NotifierId(GURL(kNotificationOriginUrl)), |
| 226 base::string16(), | 227 base::string16(), |
| 227 base::UTF8ToUTF16(address), | 228 base::UTF8ToUTF16(address), |
| 229 message_center::RichNotificationData(), |
| 228 new PeripheralBatteryNotificationDelegate(address)); | 230 new PeripheralBatteryNotificationDelegate(address)); |
| 229 | 231 |
| 232 notification.set_priority(message_center::SYSTEM_PRIORITY); |
| 233 |
| 230 notification_manager->Add( | 234 notification_manager->Add( |
| 231 notification, | 235 notification, |
| 232 ProfileManager::GetPrimaryUserProfile()); | 236 ProfileManager::GetPrimaryUserProfile()); |
| 233 | 237 |
| 234 return true; | 238 return true; |
| 235 } | 239 } |
| 236 | 240 |
| 237 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { | 241 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { |
| 238 g_browser_process->notification_ui_manager()->CancelById(address); | 242 g_browser_process->notification_ui_manager()->CancelById(address); |
| 239 } | 243 } |
| 240 | 244 |
| 241 } // namespace chromeos | 245 } // namespace chromeos |
| OLD | NEW |