| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 567 |
| 568 bool BluetoothStartDiscoveryFunction::RunImpl() { | 568 bool BluetoothStartDiscoveryFunction::RunImpl() { |
| 569 if (!IsBluetoothSupported(profile())) { | 569 if (!IsBluetoothSupported(profile())) { |
| 570 SetError(kPlatformNotSupported); | 570 SetError(kPlatformNotSupported); |
| 571 return false; | 571 return false; |
| 572 } | 572 } |
| 573 | 573 |
| 574 GetEventRouter(profile())->SetSendDiscoveryEvents(true); | 574 GetEventRouter(profile())->SetSendDiscoveryEvents(true); |
| 575 | 575 |
| 576 // If the adapter is already discovering, there is nothing else to do. | 576 // If the adapter is already discovering, there is nothing else to do. |
| 577 if (GetMutableAdapter(profile())->IsDiscovering()) { | 577 if (GetAdapter(profile())->IsDiscovering()) { |
| 578 SendResponse(true); | 578 SendResponse(true); |
| 579 return true; | 579 return true; |
| 580 } | 580 } |
| 581 | 581 |
| 582 GetMutableAdapter(profile())->SetDiscovering(true, | 582 GetMutableAdapter(profile())->SetDiscovering(true, |
| 583 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), | 583 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), |
| 584 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); | 584 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); |
| 585 return true; | 585 return true; |
| 586 } | 586 } |
| 587 | 587 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 604 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { | 604 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { |
| 605 GetMutableAdapter(profile())->SetDiscovering(false, | 605 GetMutableAdapter(profile())->SetDiscovering(false, |
| 606 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 606 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
| 607 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 607 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
| 608 } | 608 } |
| 609 return true; | 609 return true; |
| 610 } | 610 } |
| 611 | 611 |
| 612 } // namespace api | 612 } // namespace api |
| 613 } // namespace extensions | 613 } // namespace extensions |
| OLD | NEW |