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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 : public message_center::NotificationDelegate { | 52 : public message_center::NotificationDelegate { |
53 public: | 53 public: |
54 BluetoothPairingNotificationDelegate(scoped_refptr<BluetoothAdapter> adapter, | 54 BluetoothPairingNotificationDelegate(scoped_refptr<BluetoothAdapter> adapter, |
55 const std::string& address); | 55 const std::string& address); |
56 | 56 |
57 protected: | 57 protected: |
58 virtual ~BluetoothPairingNotificationDelegate(); | 58 virtual ~BluetoothPairingNotificationDelegate(); |
59 | 59 |
60 // message_center::NotificationDelegate overrides. | 60 // message_center::NotificationDelegate overrides. |
61 virtual void Display() override; | 61 virtual void Display() override; |
62 virtual void Error() override; | |
63 virtual void Close(bool by_user) override; | 62 virtual void Close(bool by_user) override; |
64 virtual bool HasClickedListener() override; | 63 virtual bool HasClickedListener() override; |
65 virtual void Click() override; | 64 virtual void Click() override; |
66 virtual void ButtonClick(int button_index) override; | 65 virtual void ButtonClick(int button_index) override; |
67 | 66 |
68 private: | 67 private: |
69 // Buttons that appear in notifications. | 68 // Buttons that appear in notifications. |
70 enum Button { | 69 enum Button { |
71 BUTTON_ACCEPT, | 70 BUTTON_ACCEPT, |
72 BUTTON_REJECT | 71 BUTTON_REJECT |
(...skipping 16 matching lines...) Expand all Loading... |
89 : adapter_(adapter), | 88 : adapter_(adapter), |
90 address_(address) { | 89 address_(address) { |
91 } | 90 } |
92 | 91 |
93 BluetoothPairingNotificationDelegate::~BluetoothPairingNotificationDelegate() { | 92 BluetoothPairingNotificationDelegate::~BluetoothPairingNotificationDelegate() { |
94 } | 93 } |
95 | 94 |
96 void BluetoothPairingNotificationDelegate::Display() { | 95 void BluetoothPairingNotificationDelegate::Display() { |
97 } | 96 } |
98 | 97 |
99 void BluetoothPairingNotificationDelegate::Error() { | |
100 } | |
101 | |
102 void BluetoothPairingNotificationDelegate::Close(bool by_user) { | 98 void BluetoothPairingNotificationDelegate::Close(bool by_user) { |
103 VLOG(1) << "Pairing notification closed. by_user = " << by_user; | 99 VLOG(1) << "Pairing notification closed. by_user = " << by_user; |
104 // Ignore notification closes generated as a result of pairing completion. | 100 // Ignore notification closes generated as a result of pairing completion. |
105 if (!by_user) | 101 if (!by_user) |
106 return; | 102 return; |
107 | 103 |
108 // Cancel the pairing of the device, if the object still exists. | 104 // Cancel the pairing of the device, if the object still exists. |
109 BluetoothDevice* device = adapter_->GetDevice(address_); | 105 BluetoothDevice* device = adapter_->GetDevice(address_); |
110 if (device) | 106 if (device) |
111 device->CancelPairing(); | 107 device->CancelPairing(); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 base::string16() /* display source */, | 357 base::string16() /* display source */, |
362 message_center::NotifierId( | 358 message_center::NotifierId( |
363 message_center::NotifierId::SYSTEM_COMPONENT, | 359 message_center::NotifierId::SYSTEM_COMPONENT, |
364 system_notifier::kNotifierBluetooth), | 360 system_notifier::kNotifierBluetooth), |
365 optional, | 361 optional, |
366 NULL)); | 362 NULL)); |
367 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 363 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
368 } | 364 } |
369 | 365 |
370 } // namespace ash | 366 } // namespace ash |
OLD | NEW |