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..bffe86e298f472908a9ec6f7d7b26c30e837d889 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,31 @@ void BluetoothOptionsHandler::UpdateDeviceCallback( |
} |
} |
+void BluetoothOptionsHandler::StopDiscoveryCallback( |
+ const ListValue* args) { |
+ 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. |
+} |
+ |
void BluetoothOptionsHandler::SendDeviceNotification( |
chromeos::BluetoothDevice* device, |
base::DictionaryValue* params) { |
@@ -327,27 +359,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, |