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.
5 // developerPrivate API.
6 // This is a private API exposing developing and debugging functionalities for
7 // apps and extensions.
8 namespace developerPrivate
{
18 dictionary ItemInspectView
{
19 // path to the inspect page.
22 // For lazy background pages, the value is -1.
23 long render_process_id
;
27 boolean generatedBackgroundPage
;
30 dictionary InstallWarning
{
38 DOMString description
;
41 DOMString? disabled_reason
;
44 boolean allow_activity
;
45 boolean allow_file_access
;
46 boolean wants_file_access
;
47 boolean incognito_enabled
;
51 boolean allow_incognito
;
54 // Path of an unpacked extension.
57 // Options settings page for the item.
58 DOMString? options_url
;
59 DOMString? app_launch_url
;
60 DOMString? homepage_url
;
61 DOMString? update_url
;
62 InstallWarning
[] install_warnings
;
63 any
[] manifest_errors
;
65 boolean offline_enabled
;
67 // All views of the current extension.
68 ItemInspectView
[] views
;
71 dictionary InspectOptions
{
72 DOMString extension_id
;
73 DOMString render_process_id
;
74 DOMString render_view_id
;
78 dictionary ReloadOptions
{
79 // If false, an alert dialog will show in the event of a reload error.
84 dictionary LoadUnpackedOptions
{
85 // If false, an alert dialog will show in the event of a reload error.
111 // New window / view opened.
113 // window / view closed.
118 dictionary PackDirectoryResponse
{
119 // The response message of success or error.
122 // Unpacked items's path.
125 // Permanent key path.
132 dictionary ProjectInfo
{
136 dictionary EventData
{
137 EventType event_type
;
141 dictionary RequestFileSourceProperties
{
142 // The ID of the extension owning the file.
143 DOMString extensionId
;
145 // The path of the file, relative to the extension; e.g., manifest.json,
146 // script.js, or main.html.
147 DOMString pathSuffix
;
149 // The error message which was thrown as a result of the error in the file.
152 // The key in the manifest which caused the error (e.g., "permissions").
153 // (Required for "manifest.json" files)
154 DOMString? manifestKey
;
156 // The specific portion of the manifest key which caused the error (e.g.,
157 // "foo" in the "permissions" key). (Optional for "manifest.json" file).
158 DOMString? manifestSpecific
;
160 // The line number which caused the error (optional for non-manifest files).
164 dictionary RequestFileSourceResponse
{
165 // The region of the code which threw the error, and should be highlighted.
168 // The region before the "highlight" portion.
169 // If the region which threw the error was not found, the full contents of
170 // the file will be in the "beforeHighlight" section.
171 DOMString beforeHighlight
;
173 // The region after the "highlight" portion.
174 DOMString afterHighlight
;
176 // A title for the file in the form '<extension name>: <file name>'.
179 // The error message.
183 dictionary OpenDevToolsProperties
{
184 // The ID of the render view in which the error occurred.
187 // The ID of the process in which the error occurred.
188 long renderProcessId
;
190 // The URL in which the error occurred.
193 // The line to focus the devtools at.
196 // The column to focus the devtools at.
200 callback VoidCallback
= void ();
201 callback BooleanCallback
= void (boolean result
);
202 callback ItemsInfoCallback
= void (ItemInfo
[] result
);
203 callback GetProjectsInfoCallback
= void (ProjectInfo
[] result
);
204 callback PathCallback
= void (DOMString path
);
205 callback PackCallback
= void (PackDirectoryResponse response
);
206 callback VoidCallback
= void();
207 callback RequestFileSourceCallback
=
208 void (RequestFileSourceResponse response
);
210 interface Functions
{
211 // Runs auto update for extensions and apps immediately.
212 // |callback| : Called with the boolean result, true if autoUpdate is
214 static
void autoUpdate
(optional BooleanCallback
callback);
216 // Returns information of all the extensions and apps installed.
217 // |includeDisabled| : include disabled items.
218 // |includeTerminated| : include terminated items.
219 // |callback| : Called with items info.
220 static
void getItemsInfo
(boolean includeDisabled
,
221 boolean includeTerminated
,
222 ItemsInfoCallback
callback);
224 // Opens a permissions dialog.
225 // |extensionId| : The id of the extension to show permissions for.
226 static
void showPermissionsDialog
(DOMString extensionId
,
227 optional VoidCallback
callback);
229 // Opens a developer tools inspection window.
230 // |options| : The details about the inspection.
231 static
void inspect
(InspectOptions options
,
232 optional VoidCallback
callback);
234 // Enables / Disables file access for an extension.
235 // |extensionId| : The id of the extension to set file access for.
236 // |allow| : Whether or not to allow file access for the extension.
237 static
void allowFileAccess
(DOMString extensionId
,
239 optional VoidCallback
callback);
241 // Reloads a given extension.
242 // |extensionId| : The id of the extension to reload.
243 // |options| : Additional configuration parameters.
244 static
void reload
(DOMString extensionId
,
245 optional ReloadOptions options
,
246 optional VoidCallback
callback);
248 // Allows / Disallows an extension to run in incognito mode.
249 // |extensionId| : The id of the extension.
250 // |allow| : Whether or not the extension should be allowed incognito.
251 static
void allowIncognito
(DOMString extensionId
,
253 optional VoidCallback
callback);
255 // Loads a user-selected unpacked item.
256 // |options| : Additional configuration parameters.
257 static
void loadUnpacked
(optional LoadUnpackedOptions options
,
258 optional VoidCallback
callback);
260 // Loads an extension / app.
261 // |directory| : The directory to load the extension from.
262 static
void loadDirectory
(
263 [instanceOf
=DirectoryEntry
] object directory
,
264 PathCallback
callback);
266 // Open Dialog to browse to an entry.
267 // |selectType| : Select a file or a folder.
268 // |fileType| : Required file type. For example, pem type is for private
269 // key and load type is for an unpacked item.
270 // |callback| : called with selected item's path.
271 static
void choosePath
(SelectType selectType
,
273 PathCallback
callback);
275 // Pack an extension.
276 // |rootPath| : The path of the extension.
277 // |privateKeyPath| : The path of the private key, if one is given.
278 // |flags| : Special flags to apply to the loading process, if any.
279 // |callback| : called with the success result string.
280 static
void packDirectory
(DOMString path
,
281 optional DOMString privateKeyPath
,
283 optional PackCallback
callback);
285 // Returns true if the profile is managed.
286 static
void isProfileManaged
(BooleanCallback
callback);
288 // Reads and returns the contents of a file related to an extension which
290 static
void requestFileSource
(RequestFileSourceProperties properties
,
291 RequestFileSourceCallback
callback);
293 // Open the developer tools to focus on a particular error.
294 static
void openDevTools
(OpenDevToolsProperties properties
);
298 // Fired when a item state is changed.
299 static
void onItemStateChanged
(EventData response
);