| 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 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 13 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 14 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
| 14 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | 15 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | 16 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class DictionaryValue; | 19 class DictionaryValue; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace chromeos { | 22 namespace chromeos { |
| 22 namespace options { | 23 namespace options { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // | 82 // |
| 82 // This method will be called when the Bluetooth daemon requires that the | 83 // This method will be called when the Bluetooth daemon requires that the |
| 83 // user enter the Passkey |passkey| into the device |device| so that it | 84 // user enter the Passkey |passkey| into the device |device| so that it |
| 84 // may be authenticated, the UI will display the passkey with accompanying | 85 // may be authenticated, the UI will display the passkey with accompanying |
| 85 // instructions. | 86 // instructions. |
| 86 // | 87 // |
| 87 // This is used for Bluetooth 2.1 and later devices that support input | 88 // This is used for Bluetooth 2.1 and later devices that support input |
| 88 // but not display, such as keyboards. The Passkey is a numeric in the | 89 // but not display, such as keyboards. The Passkey is a numeric in the |
| 89 // range 0-999999 and should be always presented zero-padded to six | 90 // range 0-999999 and should be always presented zero-padded to six |
| 90 // digits. | 91 // digits. |
| 91 virtual void DisplayPasskey(BluetoothDevice* device, | 92 virtual void DisplayPasskey(BluetoothDevice* device, uint32 passkey) OVERRIDE; |
| 92 uint32 passkey) OVERRIDE; | |
| 93 | 93 |
| 94 // BluetoothDevice::PairingDelegate override. | 94 // BluetoothDevice::PairingDelegate override. |
| 95 // | 95 // |
| 96 // This method will be called when the Bluetooth daemon requires that the | 96 // This method will be called when the Bluetooth daemon requires that the |
| 97 // user confirm that the Passkey |passkey| is displayed on the screen | 97 // user confirm that the Passkey |passkey| is displayed on the screen |
| 98 // of the device |device| so that it may be authenticated, the UI will | 98 // of the device |device| so that it may be authenticated, the UI will |
| 99 // display the passkey with accompanying instructions. | 99 // display the passkey with accompanying instructions. |
| 100 // | 100 // |
| 101 // This is used for Bluetooth 2.1 and later devices that support display, | 101 // This is used for Bluetooth 2.1 and later devices that support display, |
| 102 // such as other computers or phones. The Passkey is a numeric in the | 102 // such as other computers or phones. The Passkey is a numeric in the |
| 103 // range 0-999999 and should be always present zero-padded to six | 103 // range 0-999999 and should be always present zero-padded to six |
| 104 // digits. | 104 // digits. |
| 105 virtual void ConfirmPasskey(BluetoothDevice* device, | 105 virtual void ConfirmPasskey(BluetoothDevice* device, uint32 passkey) OVERRIDE; |
| 106 uint32 passkey) OVERRIDE; | |
| 107 | 106 |
| 108 // BluetoothDevice::PairingDelegate override. | 107 // BluetoothDevice::PairingDelegate override. |
| 109 // | 108 // |
| 110 // This method will be called when any previous DisplayPinCode(), | 109 // This method will be called when any previous DisplayPinCode(), |
| 111 // DisplayPasskey() or ConfirmPasskey() request should be concluded | 110 // DisplayPasskey() or ConfirmPasskey() request should be concluded |
| 112 // and removed from the user. | 111 // and removed from the user. |
| 113 virtual void DismissDisplayOrConfirm() OVERRIDE; | 112 virtual void DismissDisplayOrConfirm() OVERRIDE; |
| 114 | 113 |
| 115 // Displays a Bluetooth error. | 114 // Displays a Bluetooth error. |
| 116 // |error| maps to a localized resource for the error message. | 115 // |error| maps to a localized resource for the error message. |
| 117 // |address| is the address of the Bluetooth device. May be an empty | 116 // |address| is the address of the Bluetooth device. May be an empty |
| 118 // string if the error is not specific to a single device. | 117 // string if the error is not specific to a single device. |
| 119 void ReportError(const std::string& error, const std::string& address); | 118 void ReportError(const std::string& error, const std::string& address); |
| 120 | 119 |
| 121 // BluetoothAdapter::Observer implementation. | 120 // BluetoothAdapter::Observer implementation. |
| 122 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, | 121 virtual void AdapterPresentChanged(BluetoothAdapter* adapter, |
| 123 bool present) OVERRIDE; | 122 bool present) OVERRIDE; |
| 124 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter, | 123 virtual void AdapterPoweredChanged(BluetoothAdapter* adapter, |
| 125 bool powered) OVERRIDE; | 124 bool powered) OVERRIDE; |
| 126 virtual void DeviceAdded(BluetoothAdapter* adapter, | 125 virtual void DeviceAdded(BluetoothAdapter* adapter, |
| 127 BluetoothDevice* device) OVERRIDE; | 126 BluetoothDevice* device) OVERRIDE; |
| 128 virtual void DeviceChanged(BluetoothAdapter* adapter, | 127 virtual void DeviceChanged(BluetoothAdapter* adapter, |
| 129 BluetoothDevice* device) OVERRIDE; | 128 BluetoothDevice* device) OVERRIDE; |
| 130 virtual void DeviceRemoved(BluetoothAdapter* adapter, | 129 virtual void DeviceRemoved(BluetoothAdapter* adapter, |
| 131 BluetoothDevice* device) OVERRIDE; | 130 BluetoothDevice* device) OVERRIDE; |
| 132 | 131 |
| 133 private: | 132 private: |
| 134 // Called by BluetoothAdapter in response to a failure to change the | 133 // Called by BluetoothAdapter in response to a failure to change the power |
| 135 // power status of the adapter. | 134 // status of the adapter. |
| 136 void EnableChangeError(); | 135 void EnableChangeError(); |
| 137 | 136 |
| 138 // Called by BluetoothAdapter in response to a failure to set the adapter | 137 // Called by BluetoothAdapter in response to a failure to set the adapter into |
| 139 // into discovery mode. | 138 // discovery mode. |
| 140 void FindDevicesError(); | 139 void FindDevicesError(); |
| 141 | 140 |
| 142 // Called by BluetoothAdapter in response to a failure to remove the adapter | 141 // Called by BluetoothAdapter in response to a failure to remove the adapter |
| 143 // from discovery mode. | 142 // from discovery mode. |
| 144 void StopDiscoveryError(); | 143 void StopDiscoveryError(); |
| 145 | 144 |
| 146 // Called by BluetoothDevice in response to a failure to connect to the | 145 // Called by BluetoothDevice in response to a failure to connect to the device |
| 147 // device with bluetooth address |address|. | 146 // with bluetooth address |address|. |
| 148 void ConnectError(const std::string& address); | 147 void ConnectError(const std::string& address); |
| 149 | 148 |
| 150 // Called by BluetoothDevice in response to a failure to disconnect the | 149 // Called by BluetoothDevice in response to a failure to disconnect the device |
| 151 // device with bluetooth address |address|. | 150 // with bluetooth address |address|. |
| 152 void DisconnectError(const std::string& address); | 151 void DisconnectError(const std::string& address); |
| 153 | 152 |
| 154 // Called by BluetoothDevice in response to a failure to disconnect and | 153 // Called by BluetoothDevice in response to a failure to disconnect and unpair |
| 155 // unpair the device with bluetooth address |address|. | 154 // the device with bluetooth address |address|. |
| 156 void ForgetError(const std::string& address); | 155 void ForgetError(const std::string& address); |
| 157 | 156 |
| 158 // Called when the 'Enable bluetooth' checkbox value is changed. | 157 // Called when the 'Enable bluetooth' checkbox value is changed. |
| 159 // |args| will contain the checkbox checked state as a string | 158 // |args| will contain the checkbox checked state as a string |
| 160 // ("true" or "false"). | 159 // ("true" or "false"). |
| 161 void EnableChangeCallback(const base::ListValue* args); | 160 void EnableChangeCallback(const base::ListValue* args); |
| 162 | 161 |
| 163 // Called when the 'Find Devices' button is pressed from the Bluetooth | 162 // Called when the 'Find Devices' button is pressed from the Bluetooth |
| 164 // ssettings. | 163 // ssettings. |
| 165 // |args| will be an empty list. | 164 // |args| will be an empty list. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 189 // than this object does. | 188 // than this object does. |
| 190 base::WeakPtrFactory<BluetoothOptionsHandler> weak_ptr_factory_; | 189 base::WeakPtrFactory<BluetoothOptionsHandler> weak_ptr_factory_; |
| 191 | 190 |
| 192 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler); | 191 DISALLOW_COPY_AND_ASSIGN(BluetoothOptionsHandler); |
| 193 }; | 192 }; |
| 194 | 193 |
| 195 } // namespace options | 194 } // namespace options |
| 196 } // namespace chromeos | 195 } // namespace chromeos |
| 197 | 196 |
| 198 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ | 197 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_BLUETOOTH_OPTIONS_HANDLER_H_ |
| OLD | NEW |