Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2957)

Unified Diff: chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.cc

Issue 9312001: Add bluetooth callbacks for fetching paired devices and stopping device discovery. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/bluetooth_options_handler2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698