blob: e2b9cf382c80fde6f94a10d9750bcb87e9b83579 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_handler.h"
#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h"
#include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
namespace extensions {
BluetoothManifestHandler::BluetoothManifestHandler() {}
BluetoothManifestHandler::~BluetoothManifestHandler() {}
bool BluetoothManifestHandler::Parse(Extension* extension,
base::string16* error) {
const base::Value* bluetooth = NULL;
CHECK(extension->manifest()->Get(manifest_keys::kBluetooth, &bluetooth));
scoped_ptr<BluetoothManifestData> data =
BluetoothManifestData::FromValue(*bluetooth, error);
if (!data)
return false;
extension->SetManifestData(manifest_keys::kBluetooth, data.release());
return true;
}
ManifestPermission* BluetoothManifestHandler::CreatePermission() {
return new BluetoothManifestPermission();
}
ManifestPermission* BluetoothManifestHandler::CreateInitialRequiredPermission(
const Extension* extension) {
BluetoothManifestData* data = BluetoothManifestData::Get(extension);
if (data)
return data->permission()->Clone();
return NULL;
}
const std::vector<std::string> BluetoothManifestHandler::Keys() const {
return SingleKey(manifest_keys::kBluetooth);
}
} // namespace extensions
|