Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / bluetooth / bluetooth_manifest_data.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_
6 #define CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_
7
8 #include <vector>
9
10 #include "base/strings/string16.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h"
13
14 namespace extensions {
15 class BluetoothManifestPermission;
16 struct BluetoothPermissionRequest;
17 }
18
19 namespace extensions {
20
21 // The parsed form of the "bluetooth" manifest entry.
22 class BluetoothManifestData : public Extension::ManifestData {
23  public:
24   explicit BluetoothManifestData(
25       scoped_ptr<BluetoothManifestPermission> permission);
26   virtual ~BluetoothManifestData();
27
28   // Gets the BluetoothManifestData for |extension|, or NULL if none was
29   // specified.
30   static BluetoothManifestData* Get(const Extension* extension);
31
32   static bool CheckRequest(const Extension* extension,
33                            const BluetoothPermissionRequest& request);
34
35   // Tries to construct the info based on |value|, as it would have appeared in
36   // the manifest. Sets |error| and returns an empty scoped_ptr on failure.
37   static scoped_ptr<BluetoothManifestData> FromValue(const base::Value& value,
38                                                      base::string16* error);
39
40   const BluetoothManifestPermission* permission() const {
41     return permission_.get();
42   }
43
44  private:
45   scoped_ptr<BluetoothManifestPermission> permission_;
46 };
47
48 // Used for checking bluetooth permission.
49 struct BluetoothPermissionRequest {
50   explicit BluetoothPermissionRequest(const std::string& profile_uuid);
51   ~BluetoothPermissionRequest();
52
53   std::string profile_uuid;
54 };
55
56 }  // namespace extensions
57
58 #endif  // CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_DATA_H_