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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" | 9 #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" |
10 #include "extensions/common/manifest_constants.h" | 10 #include "extensions/common/manifest_constants.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 BluetoothManifestData::BluetoothManifestData( | 14 BluetoothManifestData::BluetoothManifestData( |
15 scoped_ptr<BluetoothManifestPermission> permission) | 15 std::unique_ptr<BluetoothManifestPermission> permission) |
16 : permission_(std::move(permission)) { | 16 : permission_(std::move(permission)) { |
17 DCHECK(permission_); | 17 DCHECK(permission_); |
18 } | 18 } |
19 | 19 |
20 BluetoothManifestData::~BluetoothManifestData() {} | 20 BluetoothManifestData::~BluetoothManifestData() {} |
21 | 21 |
22 // static | 22 // static |
23 BluetoothManifestData* BluetoothManifestData::Get(const Extension* extension) { | 23 BluetoothManifestData* BluetoothManifestData::Get(const Extension* extension) { |
24 return static_cast<BluetoothManifestData*>( | 24 return static_cast<BluetoothManifestData*>( |
25 extension->GetManifestData(manifest_keys::kBluetooth)); | 25 extension->GetManifestData(manifest_keys::kBluetooth)); |
(...skipping 23 matching lines...) Expand all Loading... |
49 | 49 |
50 // static | 50 // static |
51 bool BluetoothManifestData::CheckPeripheralPermitted( | 51 bool BluetoothManifestData::CheckPeripheralPermitted( |
52 const Extension* extension) { | 52 const Extension* extension) { |
53 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); | 53 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); |
54 return data && data->permission()->CheckLowEnergyPermitted(extension) && | 54 return data && data->permission()->CheckLowEnergyPermitted(extension) && |
55 data->permission()->CheckPeripheralPermitted(extension); | 55 data->permission()->CheckPeripheralPermitted(extension); |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( | 59 std::unique_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( |
60 const base::Value& value, | 60 const base::Value& value, |
61 base::string16* error) { | 61 base::string16* error) { |
62 scoped_ptr<BluetoothManifestPermission> permission = | 62 std::unique_ptr<BluetoothManifestPermission> permission = |
63 BluetoothManifestPermission::FromValue(value, error); | 63 BluetoothManifestPermission::FromValue(value, error); |
64 if (!permission) | 64 if (!permission) |
65 return scoped_ptr<BluetoothManifestData>(); | 65 return std::unique_ptr<BluetoothManifestData>(); |
66 | 66 |
67 return scoped_ptr<BluetoothManifestData>( | 67 return std::unique_ptr<BluetoothManifestData>( |
68 new BluetoothManifestData(std::move(permission))); | 68 new BluetoothManifestData(std::move(permission))); |
69 } | 69 } |
70 | 70 |
71 BluetoothPermissionRequest::BluetoothPermissionRequest( | 71 BluetoothPermissionRequest::BluetoothPermissionRequest( |
72 const std::string& uuid) | 72 const std::string& uuid) |
73 : uuid(uuid) {} | 73 : uuid(uuid) {} |
74 | 74 |
75 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} | 75 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} |
76 | 76 |
77 } // namespace extensions | 77 } // namespace extensions |
OLD | NEW |