summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/permissions/permissions_api_helpers.h
blob: 158ca0445124a994f7576bc6e78c8ad377f35b29 (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
// Copyright (c) 2012 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.

#ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_HELPERS_H_
#define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_HELPERS_H_
#pragma once

#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/memory/ref_counted.h"

namespace base {
class DictionaryValue;
}

class ExtensionPermissionSet;

namespace extensions {

namespace api {
namespace permissions {
struct Permissions;
}
}

namespace permissions_api_helpers {

// Converts the permission |set| to a permissions object.
scoped_ptr<api::permissions::Permissions> PackPermissionSet(
    const ExtensionPermissionSet* set);

// Creates a permission set from |permissions|. Returns NULL if the permissions
// cannot be converted to a permission set, in which case |error| will be set.
scoped_refptr<ExtensionPermissionSet> UnpackPermissionSet(
    const api::permissions::Permissions& permissions, std::string* error);

}  // namespace permissions_api_helpers
}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_HELPERS_H_