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
{
10 // DEPRECATED: Prefer ExtensionType.
19 // DEPRECATED: Prefer ExtensionView.
20 dictionary ItemInspectView
{
21 // path to the inspect page.
24 // For lazy background pages, the value is -1.
25 long render_process_id
;
29 boolean generatedBackgroundPage
;
32 // DEPRECATED: Use OpenDevTools.
33 dictionary InspectOptions
{
34 DOMString extension_id
;
35 (DOMString or
long) render_process_id
;
36 (DOMString or
long) render_view_id
;
40 dictionary InstallWarning
{
57 // "Unknown" includes crx's installed from chrome://extensions.
64 EXTENSION_BACKGROUND_PAGE
,
90 dictionary AccessModifier
{
95 dictionary StackFrame
{
99 DOMString functionName
;
102 dictionary ManifestError
{
104 DOMString extensionId
;
105 boolean fromIncognito
;
109 DOMString manifestKey
;
110 DOMString? manifestSpecific
;
113 dictionary RuntimeError
{
115 DOMString extensionId
;
116 boolean fromIncognito
;
121 DOMString contextUrl
;
124 long renderProcessId
;
126 StackFrame
[] stackTrace
;
129 dictionary DisableReasons
{
130 boolean suspiciousInstall
;
131 boolean corruptInstall
;
132 boolean updateRequired
;
135 dictionary OptionsPage
{
140 dictionary HomePage
{
145 dictionary ExtensionView
{
147 long renderProcessId
;
153 dictionary ExtensionInfo
{
154 boolean actionButtonHidden
;
155 DOMString? blacklistText
;
156 DOMString
[] dependentExtensions
;
157 DOMString description
;
158 DisableReasons disableReasons
;
159 AccessModifier errorCollection
;
160 AccessModifier fileAccess
;
164 AccessModifier incognitoAccess
;
165 boolean installedByCustodian
;
166 DOMString
[] installWarnings
;
167 DOMString? launchUrl
;
169 DOMString? locationText
;
170 ManifestError
[] manifestErrors
;
171 boolean mustRemainInstalled
;
173 boolean offlineEnabled
;
174 OptionsPage? optionsPage
;
176 DOMString? policyText
;
177 DOMString? prettifiedPath
;
178 AccessModifier runOnAllUrls
;
179 RuntimeError
[] runtimeErrors
;
180 DOMString
[] runtimeWarnings
;
181 ExtensionState state
;
184 boolean userMayModify
;
186 ExtensionView
[] views
;
189 dictionary ProfileInfo
{
190 boolean appInfoDialogEnabled
;
191 boolean canLoadUnpacked
;
192 boolean inDeveloperMode
;
193 boolean isIncognitoAvailable
;
194 boolean isSupervised
;
197 // DEPRECATED: Prefer ExtensionInfo.
198 dictionary ItemInfo
{
202 DOMString description
;
207 boolean allow_activity
;
208 boolean allow_file_access
;
209 boolean wants_file_access
;
210 boolean incognito_enabled
;
212 boolean allow_reload
;
214 boolean allow_incognito
;
217 // Path of an unpacked extension.
220 // Options settings page for the item.
221 DOMString? options_url
;
222 DOMString? app_launch_url
;
223 DOMString? homepage_url
;
224 DOMString? update_url
;
225 InstallWarning
[] install_warnings
;
226 any
[] manifest_errors
;
227 any
[] runtime_errors
;
228 boolean offline_enabled
;
230 // All views of the current extension.
231 ItemInspectView
[] views
;
234 dictionary GetExtensionsInfoOptions
{
235 boolean? includeDisabled
;
236 boolean? includeTerminated
;
239 dictionary ExtensionConfigurationUpdate
{
240 DOMString extensionId
;
242 boolean? incognitoAccess
;
243 boolean? errorCollection
;
244 boolean? runOnAllUrls
;
245 boolean? showActionButton
;
248 dictionary ProfileConfigurationUpdate
{
249 boolean? inDeveloperMode
;
252 dictionary ReloadOptions
{
253 // If false, an alert dialog will show in the event of a reload error.
254 // Defaults to false.
255 boolean? failQuietly
;
258 dictionary LoadUnpackedOptions
{
259 // If false, an alert dialog will show in the event of a reload error.
260 // Defaults to false.
261 boolean? failQuietly
;
285 // New window / view opened.
287 // window / view closed.
294 dictionary PackDirectoryResponse
{
295 // The response message of success or error.
298 // Unpacked items's path.
301 // Permanent key path.
308 dictionary ProjectInfo
{
312 dictionary EventData
{
313 EventType event_type
;
315 ExtensionInfo? extensionInfo
;
318 dictionary RequestFileSourceProperties
{
319 // The ID of the extension owning the file.
320 DOMString extensionId
;
322 // The path of the file, relative to the extension; e.g., manifest.json,
323 // script.js, or main.html.
324 DOMString pathSuffix
;
326 // The error message which was thrown as a result of the error in the file.
329 // The key in the manifest which caused the error (e.g., "permissions").
330 // (Required for "manifest.json" files)
331 DOMString? manifestKey
;
333 // The specific portion of the manifest key which caused the error (e.g.,
334 // "foo" in the "permissions" key). (Optional for "manifest.json" file).
335 DOMString? manifestSpecific
;
337 // The line number which caused the error (optional for non-manifest files).
341 dictionary RequestFileSourceResponse
{
342 // The region of the code which threw the error, and should be highlighted.
345 // The region before the "highlight" portion.
346 // If the region which threw the error was not found, the full contents of
347 // the file will be in the "beforeHighlight" section.
348 DOMString beforeHighlight
;
350 // The region after the "highlight" portion.
351 DOMString afterHighlight
;
353 // A title for the file in the form '<extension name>: <file name>'.
356 // The error message.
360 dictionary OpenDevToolsProperties
{
361 // The ID of the extension. This is only needed if opening the background
362 // page (where renderViewId and renderProcessId are -1).
363 DOMString? extensionId
;
365 // The ID of the render view in which the error occurred.
368 // The ID of the process in which the error occurred.
369 long renderProcessId
;
373 // The URL in which the error occurred.
376 // The line to focus the devtools at.
379 // The column to focus the devtools at.
383 dictionary DeleteExtensionErrorsProperties
{
384 DOMString extensionId
;
389 callback VoidCallback
= void ();
390 callback BooleanCallback
= void (boolean result
);
391 callback ExtensionInfosCallback
= void (ExtensionInfo
[] result
);
392 callback ExtensionInfoCallback
= void (ExtensionInfo result
);
393 callback ItemsInfoCallback
= void (ItemInfo
[] result
);
394 callback ProfileInfoCallback
= void (ProfileInfo info
);
395 callback GetProjectsInfoCallback
= void (ProjectInfo
[] result
);
396 callback PathCallback
= void (DOMString path
);
397 callback PackCallback
= void (PackDirectoryResponse response
);
398 callback VoidCallback
= void();
399 callback RequestFileSourceCallback
=
400 void (RequestFileSourceResponse response
);
402 interface Functions
{
403 // Runs auto update for extensions and apps immediately.
404 // |callback| : Called with the boolean result, true if autoUpdate is
406 static
void autoUpdate
(optional BooleanCallback
callback);
408 // Returns information of all the extensions and apps installed.
409 // |options| : Options to restrict the items returned.
410 // |callback| : Called with extensions info.
411 static
void getExtensionsInfo
(optional GetExtensionsInfoOptions options
,
412 optional ExtensionInfosCallback
callback);
414 // Returns information of a particular extension.
415 // |id| : The id of the extension.
416 // |callback| : Called with the result.
417 static
void getExtensionInfo
(DOMString
id,
418 optional ExtensionInfoCallback
callback);
420 // Returns information of all the extensions and apps installed.
421 // |includeDisabled| : include disabled items.
422 // |includeTerminated| : include terminated items.
423 // |callback| : Called with items info.
424 [deprecated
="Use getExtensionsInfo"] static
void getItemsInfo
(
425 boolean includeDisabled
,
426 boolean includeTerminated
,
427 ItemsInfoCallback
callback);
429 // Returns the current profile's configuration.
430 static
void getProfileConfiguration
(ProfileInfoCallback
callback);
432 // Updates the active profile.
433 // |update| : The parameters for updating the profile's configuration. Any
434 // properties omitted from |update| will not be changed.
435 static
void updateProfileConfiguration
(ProfileConfigurationUpdate update
,
436 optional VoidCallback
callback);
438 // Opens a permissions dialog.
439 // |extensionId| : The id of the extension to show permissions for.
440 static
void showPermissionsDialog
(DOMString extensionId
,
441 optional VoidCallback
callback);
443 // Reloads a given extension.
444 // |extensionId| : The id of the extension to reload.
445 // |options| : Additional configuration parameters.
446 static
void reload
(DOMString extensionId
,
447 optional ReloadOptions options
,
448 optional VoidCallback
callback);
450 // Modifies an extension's current configuration.
451 // |update| : The parameters for updating the extension's configuration.
452 // Any properties omitted from |update| will not be changed.
453 static
void updateExtensionConfiguration
(
454 ExtensionConfigurationUpdate update
,
455 optional VoidCallback
callback);
457 // Loads a user-selected unpacked item.
458 // |options| : Additional configuration parameters.
459 static
void loadUnpacked
(optional LoadUnpackedOptions options
,
460 optional VoidCallback
callback);
462 // Loads an extension / app.
463 // |directory| : The directory to load the extension from.
464 static
void loadDirectory
(
465 [instanceOf
=DirectoryEntry
] object directory
,
466 PathCallback
callback);
468 // Open Dialog to browse to an entry.
469 // |selectType| : Select a file or a folder.
470 // |fileType| : Required file type. For example, pem type is for private
471 // key and load type is for an unpacked item.
472 // |callback| : called with selected item's path.
473 static
void choosePath
(SelectType selectType
,
475 PathCallback
callback);
477 // Pack an extension.
478 // |rootPath| : The path of the extension.
479 // |privateKeyPath| : The path of the private key, if one is given.
480 // |flags| : Special flags to apply to the loading process, if any.
481 // |callback| : called with the success result string.
482 static
void packDirectory
(DOMString path
,
483 optional DOMString privateKeyPath
,
485 optional PackCallback
callback);
487 // Returns true if the profile is managed.
488 static
void isProfileManaged
(BooleanCallback
callback);
490 // Reads and returns the contents of a file related to an extension which
492 static
void requestFileSource
(RequestFileSourceProperties properties
,
493 RequestFileSourceCallback
callback);
495 // Open the developer tools to focus on a particular error.
496 static
void openDevTools
(OpenDevToolsProperties properties
,
497 optional VoidCallback
callback);
499 // Delete reported extension erors.
500 // |properties| : The properties specifying the errors to remove.
501 static
void deleteExtensionErrors
(
502 DeleteExtensionErrorsProperties properties
,
503 optional VoidCallback
callback);
505 // Repairs the extension specified.
506 // |extensionId| : The id of the extension to repair.
507 static
void repairExtension
(DOMString extensionId
,
508 optional VoidCallback
callback);
510 // Shows the options page for the extension specified.
511 // |extensionId| : The id of the extension to show the options page for.
512 static
void showOptions
(DOMString extensionId
,
513 optional VoidCallback
callback);
515 // Shows the path of the extension specified.
516 // |extensionId| : The id of the extension to show the path for.
517 static
void showPath
(DOMString extensionId
, optional VoidCallback
callback);
519 [nocompile
, deprecated
="Use management.setEnabled"]
520 static
void enable
(DOMString
id,
522 optional VoidCallback
callback);
523 [nocompile
, deprecated
="Use updateExtensionConfiguration"]
524 static
void allowIncognito
(DOMString extensionId
,
526 optional VoidCallback
callback);
527 [nocompile
, deprecated
="Use updateExtensionConfiguration"]
528 static
void allowFileAccess
(DOMString extensionId
,
530 optional VoidCallback
callback);
531 [nocompile
, deprecated
="Use openDevTools"]
532 static
void inspect
(InspectOptions options
,
533 optional VoidCallback
callback);
537 // Fired when a item state is changed.
538 static
void onItemStateChanged
(EventData response
);