| 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 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (callbacks_pending_ == -1) | 192 if (callbacks_pending_ == -1) |
| 193 FinishDeviceSearch(); | 193 FinishDeviceSearch(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void BluetoothGetDevicesFunction::FinishDeviceSearch() { | 196 void BluetoothGetDevicesFunction::FinishDeviceSearch() { |
| 197 scoped_ptr<base::ListValue> args(new base::ListValue()); | 197 scoped_ptr<base::ListValue> args(new base::ListValue()); |
| 198 scoped_ptr<base::DictionaryValue> info(new base::DictionaryValue()); | 198 scoped_ptr<base::DictionaryValue> info(new base::DictionaryValue()); |
| 199 info->SetInteger("expectedEventCount", device_events_sent_); | 199 info->SetInteger("expectedEventCount", device_events_sent_); |
| 200 args->Append(info.release()); | 200 args->Append(info.release()); |
| 201 | 201 |
| 202 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 203 extensions::event_names::kBluetoothOnDeviceSearchFinished, args.Pass())); |
| 202 extensions::ExtensionSystem::Get(profile())->event_router()-> | 204 extensions::ExtensionSystem::Get(profile())->event_router()-> |
| 203 DispatchEventToRenderers( | 205 BroadcastEvent(event.Pass()); |
| 204 extensions::event_names::kBluetoothOnDeviceSearchFinished, | |
| 205 args.Pass(), | |
| 206 NULL, | |
| 207 GURL()); | |
| 208 | 206 |
| 209 SendResponse(true); | 207 SendResponse(true); |
| 210 } | 208 } |
| 211 | 209 |
| 212 bool BluetoothGetDevicesFunction::RunImpl() { | 210 bool BluetoothGetDevicesFunction::RunImpl() { |
| 213 if (!IsBluetoothSupported(profile())) { | 211 if (!IsBluetoothSupported(profile())) { |
| 214 SetError(kPlatformNotSupported); | 212 SetError(kPlatformNotSupported); |
| 215 return false; | 213 return false; |
| 216 } | 214 } |
| 217 | 215 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { | 651 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { |
| 654 GetMutableAdapter(profile())->SetDiscovering(false, | 652 GetMutableAdapter(profile())->SetDiscovering(false, |
| 655 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 653 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
| 656 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 654 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
| 657 } | 655 } |
| 658 return true; | 656 return true; |
| 659 } | 657 } |
| 660 | 658 |
| 661 } // namespace api | 659 } // namespace api |
| 662 } // namespace extensions | 660 } // namespace extensions |
| OLD | NEW |