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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT, | 207 IDS_ASH_LOW_PERIPHERAL_BATTERY_NOTIFICATION_TEXT, |
208 battery.level); | 208 battery.level); |
209 | 209 |
210 Notification notification( | 210 Notification notification( |
211 message_center::NOTIFICATION_TYPE_SIMPLE, | 211 message_center::NOTIFICATION_TYPE_SIMPLE, |
212 GURL(kNotificationOriginUrl), | 212 GURL(kNotificationOriginUrl), |
213 base::UTF8ToUTF16(battery.name), | 213 base::UTF8ToUTF16(battery.name), |
214 string_text, | 214 string_text, |
215 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 215 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
216 IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW), | 216 IDR_NOTIFICATION_PERIPHERAL_BATTERY_LOW), |
217 blink::WebTextDirectionDefault, | |
218 message_center::NotifierId(GURL(kNotificationOriginUrl)), | 217 message_center::NotifierId(GURL(kNotificationOriginUrl)), |
219 base::string16(), | 218 base::string16(), |
220 base::UTF8ToUTF16(address), | 219 base::UTF8ToUTF16(address), |
221 message_center::RichNotificationData(), | 220 message_center::RichNotificationData(), |
222 new PeripheralBatteryNotificationDelegate(address)); | 221 new PeripheralBatteryNotificationDelegate(address)); |
223 | 222 |
224 notification.set_priority(message_center::SYSTEM_PRIORITY); | 223 notification.set_priority(message_center::SYSTEM_PRIORITY); |
225 | 224 |
226 notification_profile_ = ProfileManager::GetPrimaryUserProfile(); | 225 notification_profile_ = ProfileManager::GetPrimaryUserProfile(); |
227 notification_manager->Add(notification, notification_profile_); | 226 notification_manager->Add(notification, notification_profile_); |
228 | 227 |
229 return true; | 228 return true; |
230 } | 229 } |
231 | 230 |
232 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { | 231 void PeripheralBatteryObserver::CancelNotification(const std::string& address) { |
233 // If last_used_profile_ is NULL then no notification has been posted yet. | 232 // If last_used_profile_ is NULL then no notification has been posted yet. |
234 if (notification_profile_) { | 233 if (notification_profile_) { |
235 g_browser_process->notification_ui_manager()->CancelById( | 234 g_browser_process->notification_ui_manager()->CancelById( |
236 address, NotificationUIManager::GetProfileID(notification_profile_)); | 235 address, NotificationUIManager::GetProfileID(notification_profile_)); |
237 } | 236 } |
238 } | 237 } |
239 | 238 |
240 } // namespace chromeos | 239 } // namespace chromeos |
OLD | NEW |