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( | |
22 const Extension* extension) { | |
23 return static_cast<BluetoothManifestData*>( | |
24 extension->GetManifestData(manifest_keys::kBluetooth)); | |
25 } | |
26 | |
27 // static | |
28 bool BluetoothManifestData::CheckRequest( | |
29 const Extension* extension, | |
30 const BluetoothPermissionRequest& request) { | |
31 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); | |
32 if (data) | |
33 return data->permission()->CheckRequest(extension, request); | |
34 | |
35 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.
| |
36 } | |
37 | |
38 // static | |
39 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( | |
40 const base::Value& value, | |
41 base::string16* error) { | |
42 scoped_ptr<BluetoothManifestPermission> permission = | |
43 BluetoothManifestPermission::FromValue(value, error); | |
44 if (!permission) | |
45 return scoped_ptr<BluetoothManifestData>(); | |
46 | |
47 return scoped_ptr<BluetoothManifestData>( | |
48 new BluetoothManifestData(permission.Pass())).Pass(); | |
49 } | |
50 | |
51 BluetoothPermissionRequest::BluetoothPermissionRequest( | |
52 const std::string& profile_uuid) | |
53 : profile_uuid(profile_uuid) {} | |
54 | |
55 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} | |
56 | |
57 } // namespace extensions | |
OLD | NEW |