• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2012 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[
6  {
7    "namespace": "permissions",
8    "description": "Use the <code>chrome.permissions</code> API to request <a href=\"#manifest\">declared optional permissions</a> at run time rather than install time, so users understand why the permissions are needed and grant only those that are necessary.",
9    "types": [
10      {
11        "id": "Permissions",
12        "type": "object",
13        "properties": {
14          "permissions": {
15            "type": "array",
16            "items": {"type": "string"},
17            "optional": true,
18            "description": "List of named permissions (does not include hosts or origins)."
19          },
20          "origins": {
21            "type": "array",
22            "items": {"type": "string"},
23            "optional": true,
24            "description": "List of origin permissions."
25          }
26        }
27      }
28    ],
29    "events": [
30      {
31        "name": "onAdded",
32        "type": "function",
33        "description": "Fired when the extension acquires new permissions.",
34        "parameters": [
35          {
36            "$ref": "Permissions",
37            "name": "permissions",
38            "description": "The newly acquired permissions."
39          }
40        ]
41      },
42      {
43        "name": "onRemoved",
44        "type": "function",
45        "description": "Fired when access to permissions has been removed from the extension.",
46        "parameters": [
47          {
48            "$ref": "Permissions",
49            "name": "permissions",
50            "description": "The permissions that have been removed."
51          }
52        ]
53      }
54     ],
55    "functions": [
56      {
57        "name": "getAll",
58        "type": "function",
59        "description": "Gets the extension's current set of permissions.",
60        "parameters": [
61          {
62            "name": "callback",
63            "type": "function",
64            "parameters": [
65               {
66                "name": "permissions",
67                "$ref": "Permissions",
68                "description": "The extension's active permissions."
69              }
70            ]
71          }
72        ]
73      },
74      {
75        "name": "contains",
76        "type": "function",
77        "description": "Checks if the extension has the specified permissions.",
78        "parameters": [
79          {
80            "name": "permissions",
81            "$ref": "Permissions"
82          },
83          {
84            "name": "callback",
85            "type": "function",
86            "parameters": [
87              {
88                "name": "result",
89                "type": "boolean",
90                "description": "True if the extension has the specified permissions."
91              }
92            ]
93          }
94        ]
95      },
96      {
97        "name": "request",
98        "type": "function",
99        "description": "Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, $ref:runtime.lastError will be set.",
100        "parameters": [
101          {
102            "name": "permissions",
103            "$ref": "Permissions"
104          },
105          {
106            "name": "callback",
107            "type": "function",
108            "optional": true,
109            "parameters": [
110              {
111                "name": "granted",
112                "type": "boolean",
113                "description": "True if the user granted the specified permissions."
114              }
115            ]
116          }
117        ]
118      },
119      {
120        "name": "remove",
121        "type": "function",
122        "description": "Removes access to the specified permissions. If there are any problems removing the permissions, $ref:runtime.lastError will be set.",
123        "parameters": [
124          {
125            "name": "permissions",
126            "$ref": "Permissions"
127          },
128          {
129            "name": "callback",
130            "type": "function",
131            "optional": true,
132            "parameters": [
133              {
134                "name": "removed",
135                "type": "boolean",
136                "description": "True if the permissions were removed."
137              }
138            ]
139          }
140        ]
141      }
142    ]
143  }
144]
145