| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/api/bluetooth/bluetooth_manifest_data.h" | 5 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" |
| 6 | 6 |
| 7 #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" | 7 #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" |
| 8 #include "extensions/common/manifest_constants.h" | 8 #include "extensions/common/manifest_constants.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 bool BluetoothManifestData::CheckLowEnergyPermitted( | 42 bool BluetoothManifestData::CheckLowEnergyPermitted( |
| 43 const Extension* extension) { | 43 const Extension* extension) { |
| 44 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); | 44 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); |
| 45 return data && data->permission()->CheckLowEnergyPermitted(extension); | 45 return data && data->permission()->CheckLowEnergyPermitted(extension); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 bool BluetoothManifestData::CheckPeripheralPermitted( |
| 50 const Extension* extension) { |
| 51 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); |
| 52 return data && data->permission()->CheckLowEnergyPermitted(extension) && |
| 53 data->permission()->CheckPeripheralPermitted(extension); |
| 54 } |
| 55 |
| 56 // static |
| 49 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( | 57 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( |
| 50 const base::Value& value, | 58 const base::Value& value, |
| 51 base::string16* error) { | 59 base::string16* error) { |
| 52 scoped_ptr<BluetoothManifestPermission> permission = | 60 scoped_ptr<BluetoothManifestPermission> permission = |
| 53 BluetoothManifestPermission::FromValue(value, error); | 61 BluetoothManifestPermission::FromValue(value, error); |
| 54 if (!permission) | 62 if (!permission) |
| 55 return scoped_ptr<BluetoothManifestData>(); | 63 return scoped_ptr<BluetoothManifestData>(); |
| 56 | 64 |
| 57 return scoped_ptr<BluetoothManifestData>( | 65 return scoped_ptr<BluetoothManifestData>( |
| 58 new BluetoothManifestData(permission.Pass())).Pass(); | 66 new BluetoothManifestData(permission.Pass())).Pass(); |
| 59 } | 67 } |
| 60 | 68 |
| 61 BluetoothPermissionRequest::BluetoothPermissionRequest( | 69 BluetoothPermissionRequest::BluetoothPermissionRequest( |
| 62 const std::string& uuid) | 70 const std::string& uuid) |
| 63 : uuid(uuid) {} | 71 : uuid(uuid) {} |
| 64 | 72 |
| 65 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} | 73 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} |
| 66 | 74 |
| 67 } // namespace extensions | 75 } // namespace extensions |
| OLD | NEW |