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 25 matching lines...) Expand all Loading... |
36 using device::BluetoothDevice; | 36 using device::BluetoothDevice; |
37 using device::BluetoothServiceRecord; | 37 using device::BluetoothServiceRecord; |
38 using device::BluetoothSocket; | 38 using device::BluetoothSocket; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 extensions::ExtensionBluetoothEventRouter* GetEventRouter(Profile* profile) { | 42 extensions::ExtensionBluetoothEventRouter* GetEventRouter(Profile* profile) { |
43 return extensions::BluetoothAPI::Get(profile)->bluetooth_event_router(); | 43 return extensions::BluetoothAPI::Get(profile)->bluetooth_event_router(); |
44 } | 44 } |
45 | 45 |
46 const BluetoothAdapter* GetAdapter(Profile* profile) { | 46 scoped_refptr<const BluetoothAdapter> GetAdapter(Profile* profile) { |
47 return GetEventRouter(profile)->adapter(); | 47 return GetEventRouter(profile)->adapter(); |
48 } | 48 } |
49 | 49 |
50 BluetoothAdapter* GetMutableAdapter(Profile* profile) { | 50 scoped_refptr<BluetoothAdapter> GetMutableAdapter(Profile* profile) { |
51 return GetEventRouter(profile)->GetMutableAdapter(); | 51 return GetEventRouter(profile)->GetMutableAdapter(); |
52 } | 52 } |
53 | 53 |
54 bool IsBluetoothSupported(Profile* profile) { | 54 bool IsBluetoothSupported(Profile* profile) { |
55 return GetAdapter(profile) != NULL; | 55 return GetAdapter(profile) != NULL; |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 namespace { | 60 namespace { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { | 619 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { |
620 GetMutableAdapter(profile())->SetDiscovering(false, | 620 GetMutableAdapter(profile())->SetDiscovering(false, |
621 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 621 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
622 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 622 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
623 } | 623 } |
624 return true; | 624 return true; |
625 } | 625 } |
626 | 626 |
627 } // namespace api | 627 } // namespace api |
628 } // namespace extensions | 628 } // namespace extensions |
OLD | NEW |