OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bluetooth/bluetooth_notification_controller.h" | 5 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" |
6 | 6 |
7 #include "ash/system/system_notifier.h" | 7 #include "ash/system/system_notifier.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 290 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
291 | 291 |
292 scoped_ptr<Notification> notification(new Notification( | 292 scoped_ptr<Notification> notification(new Notification( |
293 message_center::NOTIFICATION_TYPE_SIMPLE, | 293 message_center::NOTIFICATION_TYPE_SIMPLE, |
294 kBluetoothDeviceDiscoverableNotificationId, | 294 kBluetoothDeviceDiscoverableNotificationId, |
295 base::string16() /* title */, | 295 base::string16() /* title */, |
296 l10n_util::GetStringFUTF16( | 296 l10n_util::GetStringFUTF16( |
297 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERABLE, | 297 IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERABLE, |
298 base::UTF8ToUTF16(adapter_->GetName()), | 298 base::UTF8ToUTF16(adapter_->GetName()), |
299 base::UTF8ToUTF16(adapter_->GetAddress())), | 299 base::UTF8ToUTF16(adapter_->GetAddress())), |
300 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH), | 300 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_BLUETOOTH), |
301 base::string16() /* display source */, | 301 base::string16() /* display source */, |
302 message_center::NotifierId( | 302 message_center::NotifierId( |
303 message_center::NotifierId::SYSTEM_COMPONENT, | 303 message_center::NotifierId::SYSTEM_COMPONENT, |
304 system_notifier::kNotifierBluetooth), | 304 system_notifier::kNotifierBluetooth), |
305 optional, | 305 optional, |
306 NULL)); | 306 NULL)); |
307 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 307 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
308 } | 308 } |
309 | 309 |
310 void BluetoothNotificationController::NotifyPairing( | 310 void BluetoothNotificationController::NotifyPairing( |
(...skipping 10 matching lines...) Expand all Loading... |
321 IDS_ASH_STATUS_TRAY_BLUETOOTH_REJECT))); | 321 IDS_ASH_STATUS_TRAY_BLUETOOTH_REJECT))); |
322 } | 322 } |
323 | 323 |
324 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 324 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
325 | 325 |
326 scoped_ptr<Notification> notification(new Notification( | 326 scoped_ptr<Notification> notification(new Notification( |
327 message_center::NOTIFICATION_TYPE_SIMPLE, | 327 message_center::NOTIFICATION_TYPE_SIMPLE, |
328 kBluetoothDevicePairingNotificationId, | 328 kBluetoothDevicePairingNotificationId, |
329 base::string16() /* title */, | 329 base::string16() /* title */, |
330 message, | 330 message, |
331 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH), | 331 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_BLUETOOTH), |
332 base::string16() /* display source */, | 332 base::string16() /* display source */, |
333 message_center::NotifierId( | 333 message_center::NotifierId( |
334 message_center::NotifierId::SYSTEM_COMPONENT, | 334 message_center::NotifierId::SYSTEM_COMPONENT, |
335 system_notifier::kNotifierBluetooth), | 335 system_notifier::kNotifierBluetooth), |
336 optional, | 336 optional, |
337 new BluetoothPairingNotificationDelegate(adapter_, | 337 new BluetoothPairingNotificationDelegate(adapter_, |
338 device->GetAddress()))); | 338 device->GetAddress()))); |
339 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 339 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
340 } | 340 } |
341 | 341 |
342 void BluetoothNotificationController::NotifyPairedDevice( | 342 void BluetoothNotificationController::NotifyPairedDevice( |
343 BluetoothDevice* device) { | 343 BluetoothDevice* device) { |
344 // Remove the currently presented pairing notification; since only one | 344 // Remove the currently presented pairing notification; since only one |
345 // pairing request is queued at a time, this is guaranteed to be the device | 345 // pairing request is queued at a time, this is guaranteed to be the device |
346 // that just became paired. | 346 // that just became paired. |
347 message_center::MessageCenter::Get()->RemoveNotification( | 347 message_center::MessageCenter::Get()->RemoveNotification( |
348 kBluetoothDevicePairingNotificationId, false /* by_user */); | 348 kBluetoothDevicePairingNotificationId, false /* by_user */); |
349 | 349 |
350 message_center::RichNotificationData optional; | 350 message_center::RichNotificationData optional; |
351 | 351 |
352 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 352 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
353 | 353 |
354 scoped_ptr<Notification> notification(new Notification( | 354 scoped_ptr<Notification> notification(new Notification( |
355 message_center::NOTIFICATION_TYPE_SIMPLE, | 355 message_center::NOTIFICATION_TYPE_SIMPLE, |
356 kBluetoothDevicePairedNotificationId, | 356 kBluetoothDevicePairedNotificationId, |
357 base::string16() /* title */, | 357 base::string16() /* title */, |
358 l10n_util::GetStringFUTF16( | 358 l10n_util::GetStringFUTF16( |
359 IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIRED, device->GetName()), | 359 IDS_ASH_STATUS_TRAY_BLUETOOTH_PAIRED, device->GetName()), |
360 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH), | 360 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_BLUETOOTH), |
361 base::string16() /* display source */, | 361 base::string16() /* display source */, |
362 message_center::NotifierId( | 362 message_center::NotifierId( |
363 message_center::NotifierId::SYSTEM_COMPONENT, | 363 message_center::NotifierId::SYSTEM_COMPONENT, |
364 system_notifier::kNotifierBluetooth), | 364 system_notifier::kNotifierBluetooth), |
365 optional, | 365 optional, |
366 NULL)); | 366 NULL)); |
367 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 367 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
368 } | 368 } |
369 | 369 |
370 } // namespace ash | 370 } // namespace ash |
OLD | NEW |