Chromium Code Reviews| Index: chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc |
| diff --git a/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc b/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9586ea9a7e0747bd5811a6c13242b18192f45ab0 |
| --- /dev/null |
| +++ b/chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" |
| + |
| +#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h" |
| +#include "extensions/common/manifest_constants.h" |
| + |
| +namespace extensions { |
| + |
| +BluetoothManifestData::BluetoothManifestData( |
| + scoped_ptr<BluetoothManifestPermission> permission) |
| + : permission_(permission.Pass()) { |
| + DCHECK(permission_); |
| +} |
| + |
| +BluetoothManifestData::~BluetoothManifestData() {} |
| + |
| +// static |
| +BluetoothManifestData* BluetoothManifestData::Get( |
| + const Extension* extension) { |
| + return static_cast<BluetoothManifestData*>( |
| + extension->GetManifestData(manifest_keys::kBluetooth)); |
| +} |
| + |
| +// static |
| +bool BluetoothManifestData::CheckRequest( |
| + const Extension* extension, |
| + const BluetoothPermissionRequest& request) { |
| + const BluetoothManifestData* data = BluetoothManifestData::Get(extension); |
| + if (data) |
| + return data->permission()->CheckRequest(extension, request); |
| + |
| + return false; |
|
not at google - send to devlin
2014/01/23 20:29:12
just
return data && data->permission()->CheckRequ
rpaquay
2014/01/24 16:58:23
Done.
|
| +} |
| + |
| +// static |
| +scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( |
| + const base::Value& value, |
| + base::string16* error) { |
| + scoped_ptr<BluetoothManifestPermission> permission = |
| + BluetoothManifestPermission::FromValue(value, error); |
| + if (!permission) |
| + return scoped_ptr<BluetoothManifestData>(); |
| + |
| + return scoped_ptr<BluetoothManifestData>( |
| + new BluetoothManifestData(permission.Pass())).Pass(); |
| +} |
| + |
| +BluetoothPermissionRequest::BluetoothPermissionRequest( |
| + const std::string& profile_uuid) |
| + : profile_uuid(profile_uuid) {} |
| + |
| +BluetoothPermissionRequest::~BluetoothPermissionRequest() {} |
| + |
| +} // namespace extensions |