Chromium Code Reviews| Index: chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc |
| diff --git a/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc |
| index 2b6caaa1f6a77e3fcb273cf7515d6fac225d3200..8ef81d695d5abc62d8a0682af0f97c9600df167f 100644 |
| --- a/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc |
| +++ b/chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc |
| @@ -164,6 +164,13 @@ void BluetoothOptionsHandler::RegisterMessages() { |
| web_ui()->RegisterMessageCallback("updateBluetoothDevice", |
| base::Bind(&BluetoothOptionsHandler::UpdateDeviceCallback, |
| base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback("stopBluetoothDeviceDiscovery", |
| + base::Bind(&BluetoothOptionsHandler::StopDiscoveryCallback, |
| + base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback("getPairedBluetoothDevices", |
| + base::Bind(&BluetoothOptionsHandler::GetPairedDevicesCallback, |
| + base::Unretained(this))); |
| + |
| } |
| void BluetoothOptionsHandler::EnableChangeCallback( |
| @@ -222,6 +229,33 @@ void BluetoothOptionsHandler::UpdateDeviceCallback( |
| } |
| } |
| +void BluetoothOptionsHandler::StopDiscoveryCallback( |
| + const ListValue* args) { |
| + DVLOG(2) << "Stop searching for Bluetooth devices"; |
|
James Hawkins
2012/01/31 18:14:27
Did you intend to leave these logging statements i
kevers
2012/01/31 18:20:31
Intend to pull most of the logging out. I should
|
| + chromeos::BluetoothManager* bluetooth_manager = |
| + chromeos::BluetoothManager::GetInstance(); |
| + DCHECK(bluetooth_manager); |
| + |
| + chromeos::BluetoothAdapter* default_adapter = |
| + bluetooth_manager->DefaultAdapter(); |
| + |
| + ValidateDefaultAdapter(default_adapter); |
| + |
| + if (default_adapter == NULL) { |
| + VLOG(1) << "DiscoveryEnded: no default adapter"; |
| + return; |
| + } |
| + |
| + default_adapter->StopDiscovery(); |
| +} |
| + |
| +void BluetoothOptionsHandler::GetPairedDevicesCallback( |
| + const ListValue* args) { |
| + // TODO(keybuk): Iterate over list of paired devices calling |
| + // SetDeviceNotification for each device. |
| + DVLOG(2) << "Get paired Bluetooth devices"; |
| +} |
| + |
| void BluetoothOptionsHandler::SendDeviceNotification( |
| chromeos::BluetoothDevice* device, |
| base::DictionaryValue* params) { |
| @@ -327,27 +361,6 @@ void BluetoothOptionsHandler::DiscoveryStarted(const std::string& adapter_id) { |
| void BluetoothOptionsHandler::DiscoveryEnded(const std::string& adapter_id) { |
| VLOG(2) << "Discovery ended on " << adapter_id; |
| - |
| - // Stop the discovery session. |
| - // TODO(vlaviano): We may want to expose DeviceDisappeared, remove the |
| - // "Find devices" button, and let the discovery session continue throughout |
| - // the time that the page is visible rather than just doing a single discovery |
| - // cycle in response to a button click. |
| - chromeos::BluetoothManager* bluetooth_manager = |
| - chromeos::BluetoothManager::GetInstance(); |
| - DCHECK(bluetooth_manager); |
| - |
| - chromeos::BluetoothAdapter* default_adapter = |
| - bluetooth_manager->DefaultAdapter(); |
| - |
| - ValidateDefaultAdapter(default_adapter); |
| - |
| - if (default_adapter == NULL) { |
| - VLOG(1) << "DiscoveryEnded: no default adapter"; |
| - return; |
| - } |
| - |
| - default_adapter->StopDiscovery(); |
| } |
| void BluetoothOptionsHandler::DeviceFound(const std::string& adapter_id, |