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 #ifndef CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_ | |
6 #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "extensions/common/permissions/api_permission.h" | |
12 | |
13 namespace base { | |
14 | |
15 class Value; | |
16 | |
17 } // namespace base | |
18 | |
19 namespace extensions { | |
20 | |
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 { | |
24 public: | |
25 BluetoothPermissionData(); | |
26 explicit BluetoothPermissionData(const std::string& uuid); | |
27 | |
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; | |
31 | |
32 // Convert |this| into a base::Value. | |
33 scoped_ptr<base::Value> ToValue() const; | |
34 | |
35 // Populate |this| from a base::Value. | |
36 bool FromValue(const base::Value* value); | |
37 | |
38 bool operator<(const BluetoothPermissionData& rhs) const; | |
39 bool operator==(const BluetoothPermissionData& rhs) const; | |
40 | |
41 // The uuid |this| matches against. | |
42 const std::string& uuid() const { return uuid_; } | |
43 | |
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_; } | |
47 | |
48 private: | |
49 std::string uuid_; | |
50 }; | |
51 | |
52 } // namespace extensions | |
53 | |
54 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_ | |
OLD | NEW |