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.
5 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/common/permissions/api_permission.h"
19 namespace extensions
{
21 // A pattern that can be used to match a Bluetooth profile permission, must be
22 // of a format that can be passed to device::bluetooth_utils::CanonoicalUuid().
23 class BluetoothPermissionData
{
25 BluetoothPermissionData();
26 explicit BluetoothPermissionData(const std::string
& uuid
);
28 // Check if |param| (which must be a BluetoothPermission::CheckParam)
29 // matches the uuid of this object.
30 bool Check(const APIPermission::CheckParam
* param
) const;
32 // Convert |this| into a base::Value.
33 scoped_ptr
<base::Value
> ToValue() const;
35 // Populate |this| from a base::Value.
36 bool FromValue(const base::Value
* value
);
38 bool operator<(const BluetoothPermissionData
& rhs
) const;
39 bool operator==(const BluetoothPermissionData
& rhs
) const;
41 // The uuid |this| matches against.
42 const std::string
& uuid() const { return uuid_
; }
44 // This accessor is provided for IPC_STRUCT_TRAITS_MEMBER. Please
45 // think twice before using it for anything else.
46 std::string
& uuid() { return uuid_
; }
52 } // namespace extensions
54 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_