OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" |
| 6 |
| 7 #include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h
" |
| 8 #include "extensions/common/manifest_constants.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 BluetoothManifestData::BluetoothManifestData( |
| 13 scoped_ptr<BluetoothManifestPermission> permission) |
| 14 : permission_(permission.Pass()) { |
| 15 DCHECK(permission_); |
| 16 } |
| 17 |
| 18 BluetoothManifestData::~BluetoothManifestData() {} |
| 19 |
| 20 // static |
| 21 BluetoothManifestData* BluetoothManifestData::Get(const Extension* extension) { |
| 22 return static_cast<BluetoothManifestData*>( |
| 23 extension->GetManifestData(manifest_keys::kBluetooth)); |
| 24 } |
| 25 |
| 26 // static |
| 27 bool BluetoothManifestData::CheckRequest( |
| 28 const Extension* extension, |
| 29 const BluetoothPermissionRequest& request) { |
| 30 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); |
| 31 return data && data->permission()->CheckRequest(extension, request); |
| 32 } |
| 33 |
| 34 // static |
| 35 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( |
| 36 const base::Value& value, |
| 37 base::string16* error) { |
| 38 scoped_ptr<BluetoothManifestPermission> permission = |
| 39 BluetoothManifestPermission::FromValue(value, error); |
| 40 if (!permission) |
| 41 return scoped_ptr<BluetoothManifestData>(); |
| 42 |
| 43 return scoped_ptr<BluetoothManifestData>( |
| 44 new BluetoothManifestData(permission.Pass())).Pass(); |
| 45 } |
| 46 |
| 47 BluetoothPermissionRequest::BluetoothPermissionRequest( |
| 48 const std::string& profile_uuid) |
| 49 : profile_uuid(profile_uuid) {} |
| 50 |
| 51 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} |
| 52 |
| 53 } // namespace extensions |
OLD | NEW |