Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.cc

Issue 325893002: Bluetooth: add socket & low_energy manifest check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add permission denied tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" 5 #include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h"
6 6
7 #include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h " 7 #include "chrome/common/extensions/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 14 matching lines...) Expand all
25 25
26 // static 26 // static
27 bool BluetoothManifestData::CheckRequest( 27 bool BluetoothManifestData::CheckRequest(
28 const Extension* extension, 28 const Extension* extension,
29 const BluetoothPermissionRequest& request) { 29 const BluetoothPermissionRequest& request) {
30 const BluetoothManifestData* data = BluetoothManifestData::Get(extension); 30 const BluetoothManifestData* data = BluetoothManifestData::Get(extension);
31 return data && data->permission()->CheckRequest(extension, request); 31 return data && data->permission()->CheckRequest(extension, request);
32 } 32 }
33 33
34 // static 34 // static
35 bool BluetoothManifestData::CheckSocketPermitted(
36 const Extension* extension) {
37 const BluetoothManifestData* data = BluetoothManifestData::Get(extension);
38 return data && data->permission()->CheckSocketPermitted(extension);
39 }
40
41 // static
42 bool BluetoothManifestData::CheckLowEnergyPermitted(
43 const Extension* extension) {
44 const BluetoothManifestData* data = BluetoothManifestData::Get(extension);
45 return data && data->permission()->CheckLowEnergyPermitted(extension);
46 }
47
48 // static
35 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( 49 scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue(
36 const base::Value& value, 50 const base::Value& value,
37 base::string16* error) { 51 base::string16* error) {
38 scoped_ptr<BluetoothManifestPermission> permission = 52 scoped_ptr<BluetoothManifestPermission> permission =
39 BluetoothManifestPermission::FromValue(value, error); 53 BluetoothManifestPermission::FromValue(value, error);
40 if (!permission) 54 if (!permission)
41 return scoped_ptr<BluetoothManifestData>(); 55 return scoped_ptr<BluetoothManifestData>();
42 56
43 return scoped_ptr<BluetoothManifestData>( 57 return scoped_ptr<BluetoothManifestData>(
44 new BluetoothManifestData(permission.Pass())).Pass(); 58 new BluetoothManifestData(permission.Pass())).Pass();
45 } 59 }
46 60
47 BluetoothPermissionRequest::BluetoothPermissionRequest( 61 BluetoothPermissionRequest::BluetoothPermissionRequest(
48 const std::string& uuid) 62 const std::string& uuid)
49 : uuid(uuid) {} 63 : uuid(uuid) {}
50 64
51 BluetoothPermissionRequest::~BluetoothPermissionRequest() {} 65 BluetoothPermissionRequest::~BluetoothPermissionRequest() {}
52 66
53 } // namespace extensions 67 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698