Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / extensions / permissions / bluetooth_permission_data.h
blob25413d4c082da9b1ba50ed0238a63451bbba4613
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_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/common/permissions/api_permission.h"
13 namespace base {
15 class Value;
17 } // namespace base
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 {
24 public:
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_; }
48 private:
49 std::string uuid_;
52 } // namespace extensions
54 #endif // CHROME_COMMON_EXTENSIONS_PERMISSIONS_BLUETOOTH_PERMISSION_DATA_H_