| Index: device/bluetooth/bluetooth_adapter_win.cc | 
| diff --git a/device/bluetooth/bluetooth_adapter_win.cc b/device/bluetooth/bluetooth_adapter_win.cc | 
| index 97eca65763bbdb2245bc9a84cf82ced50b7ab675..2fe1f58d906aa209ac231be3c6138294856380cb 100644 | 
| --- a/device/bluetooth/bluetooth_adapter_win.cc | 
| +++ b/device/bluetooth/bluetooth_adapter_win.cc | 
| @@ -6,11 +6,27 @@ | 
|  | 
| #include "device/bluetooth/bluetooth_adapter_win.h" | 
|  | 
| +#include <BluetoothAPIs.h> | 
| #include <string> | 
| +#include "base/bind.h" | 
| #include "base/logging.h" | 
| +#include "base/message_loop.h" | 
| +#include "base/stringprintf.h" | 
| +#include "base/sys_string_conversions.h" | 
| + | 
| +# pragma comment(lib, "Bthprops.lib") | 
| + | 
| +namespace { | 
| + | 
| +const BLUETOOTH_FIND_RADIO_PARAMS bluetooth_adapter_param = | 
| +    { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; | 
| + | 
| +}  // namespace | 
|  | 
| namespace device { | 
|  | 
| +const int BluetoothAdapterWin::kPollIntervalMs = 500; | 
| + | 
| BluetoothAdapterWin::BluetoothAdapterWin() | 
| : BluetoothAdapter(), | 
| ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 
| @@ -28,8 +44,7 @@ void BluetoothAdapterWin::RemoveObserver(BluetoothAdapter::Observer* observer) { | 
| } | 
|  | 
| bool BluetoothAdapterWin::IsPresent() const { | 
| -  NOTIMPLEMENTED(); | 
| -  return false; | 
| +  return !address_.empty(); | 
| } | 
|  | 
| bool BluetoothAdapterWin::IsPowered() const { | 
| @@ -78,4 +93,40 @@ void BluetoothAdapterWin::ReadLocalOutOfBandPairingData( | 
| NOTIMPLEMENTED(); | 
| } | 
|  | 
| +void BluetoothAdapterWin::UpdateAdapterState() { | 
| +  HBLUETOOTH_RADIO_FIND bluetooth_adapter_handle = NULL; | 
| +  BLUETOOTH_RADIO_INFO bluetooth_adapter_info = | 
| +      { sizeof(BLUETOOTH_RADIO_INFO), 0 }; | 
| +  BluetoothFindFirstRadio(&bluetooth_adapter_param, &bluetooth_adapter_handle); | 
| +  if (bluetooth_adapter_handle && | 
| +      ERROR_SUCCESS == BluetoothGetRadioInfo(bluetooth_adapter_handle, | 
| +                                             &bluetooth_adapter_info)) { | 
| +    name_ = base::SysWideToUTF8(bluetooth_adapter_info.szName); | 
| +    address_ = base::StringPrintf("%02X:%02X:%02X:%02X:%02X:%02X", | 
| +        bluetooth_adapter_info.address.rgBytes[5], | 
| +        bluetooth_adapter_info.address.rgBytes[4], | 
| +        bluetooth_adapter_info.address.rgBytes[3], | 
| +        bluetooth_adapter_info.address.rgBytes[2], | 
| +        bluetooth_adapter_info.address.rgBytes[1], | 
| +        bluetooth_adapter_info.address.rgBytes[0]); | 
| +  } else { | 
| +    name_.clear(); | 
| +    address_.clear(); | 
| +  } | 
| +} | 
| + | 
| +void BluetoothAdapterWin::TrackDefaultAdapter() { | 
| +  PollAdapterState(); | 
| +} | 
| + | 
| +void BluetoothAdapterWin::PollAdapterState() { | 
| +  UpdateAdapterState(); | 
| + | 
| +  MessageLoop::current()->PostDelayedTask( | 
| +      FROM_HERE, | 
| +      base::Bind(&BluetoothAdapterWin::PollAdapterState, | 
| +                 weak_ptr_factory_.GetWeakPtr()), | 
| +      base::TimeDelta::FromMilliseconds(kPollIntervalMs)); | 
| +} | 
| + | 
| }  // namespace device | 
|  |