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
;
26 // This actually refers to a render frame.
30 boolean generatedBackgroundPage
;
33 // DEPRECATED: Use OpenDevTools.
34 dictionary InspectOptions
{
35 DOMString extension_id
;
36 (DOMString or
long) render_process_id
;
37 (DOMString or
long) render_view_id
;
41 dictionary InstallWarning
{
58 // "Unknown" includes crx's installed from chrome://extensions.
65 EXTENSION_BACKGROUND_PAGE
,
96 dictionary AccessModifier
{
101 dictionary StackFrame
{
105 DOMString functionName
;
108 dictionary ManifestError
{
110 DOMString extensionId
;
111 boolean fromIncognito
;
115 DOMString manifestKey
;
116 DOMString? manifestSpecific
;
119 dictionary RuntimeError
{
121 DOMString extensionId
;
122 boolean fromIncognito
;
127 DOMString contextUrl
;
130 long renderProcessId
;
132 StackFrame
[] stackTrace
;
135 dictionary DisableReasons
{
136 boolean suspiciousInstall
;
137 boolean corruptInstall
;
138 boolean updateRequired
;
141 dictionary OptionsPage
{
146 dictionary HomePage
{
151 dictionary ExtensionView
{
153 long renderProcessId
;
154 // This actually refers to a render frame.
160 enum ControllerType
{
163 SUPERVISED_USER_CUSTODIAN
166 dictionary ControlledInfo
{
172 DOMString description
;
173 DOMString keybinding
;
177 boolean isExtensionAction
;
180 dictionary ExtensionInfo
{
181 boolean actionButtonHidden
;
182 DOMString? blacklistText
;
184 ControlledInfo? controlledInfo
;
185 DOMString
[] dependentExtensions
;
186 DOMString description
;
187 DisableReasons disableReasons
;
188 AccessModifier errorCollection
;
189 AccessModifier fileAccess
;
193 AccessModifier incognitoAccess
;
194 DOMString
[] installWarnings
;
195 DOMString? launchUrl
;
197 DOMString? locationText
;
198 ManifestError
[] manifestErrors
;
199 boolean mustRemainInstalled
;
201 boolean offlineEnabled
;
202 OptionsPage? optionsPage
;
204 DOMString? prettifiedPath
;
205 AccessModifier runOnAllUrls
;
206 RuntimeError
[] runtimeErrors
;
207 DOMString
[] runtimeWarnings
;
208 ExtensionState state
;
211 boolean userMayModify
;
213 ExtensionView
[] views
;
216 dictionary ProfileInfo
{
217 boolean appInfoDialogEnabled
;
218 boolean canLoadUnpacked
;
219 boolean inDeveloperMode
;
220 boolean isIncognitoAvailable
;
221 boolean isSupervised
;
224 // DEPRECATED: Prefer ExtensionInfo.
225 dictionary ItemInfo
{
229 DOMString description
;
234 boolean allow_activity
;
235 boolean allow_file_access
;
236 boolean wants_file_access
;
237 boolean incognito_enabled
;
239 boolean allow_reload
;
241 boolean allow_incognito
;
244 // Path of an unpacked extension.
247 // Options settings page for the item.
248 DOMString? options_url
;
249 DOMString? app_launch_url
;
250 DOMString? homepage_url
;
251 DOMString? update_url
;
252 InstallWarning
[] install_warnings
;
253 any
[] manifest_errors
;
254 any
[] runtime_errors
;
255 boolean offline_enabled
;
257 // All views of the current extension.
258 ItemInspectView
[] views
;
261 dictionary GetExtensionsInfoOptions
{
262 boolean? includeDisabled
;
263 boolean? includeTerminated
;
266 dictionary ExtensionConfigurationUpdate
{
267 DOMString extensionId
;
269 boolean? incognitoAccess
;
270 boolean? errorCollection
;
271 boolean? runOnAllUrls
;
272 boolean? showActionButton
;
275 dictionary ProfileConfigurationUpdate
{
276 boolean? inDeveloperMode
;
279 dictionary ExtensionCommandUpdate
{
280 DOMString extensionId
;
281 DOMString commandName
;
283 DOMString? keybinding
;
286 dictionary ReloadOptions
{
287 // If false, an alert dialog will show in the event of a reload error.
288 // Defaults to false.
289 boolean? failQuietly
;
292 dictionary LoadUnpackedOptions
{
293 // If false, an alert dialog will show in the event of a reload error.
294 // Defaults to false.
295 boolean? failQuietly
;
319 // New window / view opened.
321 // window / view closed.
329 dictionary PackDirectoryResponse
{
330 // The response message of success or error.
333 // Unpacked items's path.
336 // Permanent key path.
343 dictionary ProjectInfo
{
347 dictionary EventData
{
348 EventType event_type
;
350 ExtensionInfo? extensionInfo
;
353 dictionary RequestFileSourceProperties
{
354 // The ID of the extension owning the file.
355 DOMString extensionId
;
357 // The path of the file, relative to the extension; e.g., manifest.json,
358 // script.js, or main.html.
359 DOMString pathSuffix
;
361 // The error message which was thrown as a result of the error in the file.
364 // The key in the manifest which caused the error (e.g., "permissions").
365 // (Required for "manifest.json" files)
366 DOMString? manifestKey
;
368 // The specific portion of the manifest key which caused the error (e.g.,
369 // "foo" in the "permissions" key). (Optional for "manifest.json" file).
370 DOMString? manifestSpecific
;
372 // The line number which caused the error (optional for non-manifest files).
376 dictionary RequestFileSourceResponse
{
377 // The region of the code which threw the error, and should be highlighted.
380 // The region before the "highlight" portion.
381 // If the region which threw the error was not found, the full contents of
382 // the file will be in the "beforeHighlight" section.
383 DOMString beforeHighlight
;
385 // The region after the "highlight" portion.
386 DOMString afterHighlight
;
388 // A title for the file in the form '<extension name>: <file name>'.
391 // The error message.
395 dictionary OpenDevToolsProperties
{
396 // The ID of the extension. This is only needed if opening the background
397 // page (where renderViewId and renderProcessId are -1).
398 DOMString? extensionId
;
400 // The ID of the render frame in which the error occurred.
401 // Despite being called renderViewId, this refers to a render frame.
404 // The ID of the process in which the error occurred.
405 long renderProcessId
;
409 // The URL in which the error occurred.
412 // The line to focus the devtools at.
415 // The column to focus the devtools at.
419 dictionary DeleteExtensionErrorsProperties
{
420 DOMString extensionId
;
425 callback VoidCallback
= void ();
426 callback BooleanCallback
= void (boolean result
);
427 callback ExtensionInfosCallback
= void (ExtensionInfo
[] result
);
428 callback ExtensionInfoCallback
= void (ExtensionInfo result
);
429 callback ItemsInfoCallback
= void (ItemInfo
[] result
);
430 callback ProfileInfoCallback
= void (ProfileInfo info
);
431 callback GetProjectsInfoCallback
= void (ProjectInfo
[] result
);
432 callback PathCallback
= void (DOMString path
);
433 callback PackCallback
= void (PackDirectoryResponse response
);
434 callback VoidCallback
= void();
435 callback RequestFileSourceCallback
=
436 void (RequestFileSourceResponse response
);
438 interface Functions
{
439 // Runs auto update for extensions and apps immediately.
440 // |callback| : Called with the boolean result, true if autoUpdate is
442 static
void autoUpdate
(optional BooleanCallback
callback);
444 // Returns information of all the extensions and apps installed.
445 // |options| : Options to restrict the items returned.
446 // |callback| : Called with extensions info.
447 static
void getExtensionsInfo
(optional GetExtensionsInfoOptions options
,
448 optional ExtensionInfosCallback
callback);
450 // Returns information of a particular extension.
451 // |id| : The id of the extension.
452 // |callback| : Called with the result.
453 static
void getExtensionInfo
(DOMString
id,
454 optional ExtensionInfoCallback
callback);
456 // Returns information of all the extensions and apps installed.
457 // |includeDisabled| : include disabled items.
458 // |includeTerminated| : include terminated items.
459 // |callback| : Called with items info.
460 [deprecated
="Use getExtensionsInfo"] static
void getItemsInfo
(
461 boolean includeDisabled
,
462 boolean includeTerminated
,
463 ItemsInfoCallback
callback);
465 // Returns the current profile's configuration.
466 static
void getProfileConfiguration
(ProfileInfoCallback
callback);
468 // Updates the active profile.
469 // |update| : The parameters for updating the profile's configuration. Any
470 // properties omitted from |update| will not be changed.
471 static
void updateProfileConfiguration
(ProfileConfigurationUpdate update
,
472 optional VoidCallback
callback);
474 // Opens a permissions dialog.
475 // |extensionId| : The id of the extension to show permissions for.
476 static
void showPermissionsDialog
(DOMString extensionId
,
477 optional VoidCallback
callback);
479 // Reloads a given extension.
480 // |extensionId| : The id of the extension to reload.
481 // |options| : Additional configuration parameters.
482 static
void reload
(DOMString extensionId
,
483 optional ReloadOptions options
,
484 optional VoidCallback
callback);
486 // Modifies an extension's current configuration.
487 // |update| : The parameters for updating the extension's configuration.
488 // Any properties omitted from |update| will not be changed.
489 static
void updateExtensionConfiguration
(
490 ExtensionConfigurationUpdate update
,
491 optional VoidCallback
callback);
493 // Loads a user-selected unpacked item.
494 // |options| : Additional configuration parameters.
495 static
void loadUnpacked
(optional LoadUnpackedOptions options
,
496 optional VoidCallback
callback);
498 // Loads an extension / app.
499 // |directory| : The directory to load the extension from.
500 static
void loadDirectory
(
501 [instanceOf
=DirectoryEntry
] object directory
,
502 PathCallback
callback);
504 // Open Dialog to browse to an entry.
505 // |selectType| : Select a file or a folder.
506 // |fileType| : Required file type. For example, pem type is for private
507 // key and load type is for an unpacked item.
508 // |callback| : called with selected item's path.
509 static
void choosePath
(SelectType selectType
,
511 PathCallback
callback);
513 // Pack an extension.
514 // |rootPath| : The path of the extension.
515 // |privateKeyPath| : The path of the private key, if one is given.
516 // |flags| : Special flags to apply to the loading process, if any.
517 // |callback| : called with the success result string.
518 static
void packDirectory
(DOMString path
,
519 optional DOMString privateKeyPath
,
521 optional PackCallback
callback);
523 // Returns true if the profile is managed.
524 static
void isProfileManaged
(BooleanCallback
callback);
526 // Reads and returns the contents of a file related to an extension which
528 static
void requestFileSource
(RequestFileSourceProperties properties
,
529 RequestFileSourceCallback
callback);
531 // Open the developer tools to focus on a particular error.
532 static
void openDevTools
(OpenDevToolsProperties properties
,
533 optional VoidCallback
callback);
535 // Delete reported extension erors.
536 // |properties| : The properties specifying the errors to remove.
537 static
void deleteExtensionErrors
(
538 DeleteExtensionErrorsProperties properties
,
539 optional VoidCallback
callback);
541 // Repairs the extension specified.
542 // |extensionId| : The id of the extension to repair.
543 static
void repairExtension
(DOMString extensionId
,
544 optional VoidCallback
callback);
546 // Shows the options page for the extension specified.
547 // |extensionId| : The id of the extension to show the options page for.
548 static
void showOptions
(DOMString extensionId
,
549 optional VoidCallback
callback);
551 // Shows the path of the extension specified.
552 // |extensionId| : The id of the extension to show the path for.
553 static
void showPath
(DOMString extensionId
, optional VoidCallback
callback);
555 // (Un)suspends global shortcut handling.
556 // |isSuspended| : Whether or not shortcut handling should be suspended.
557 static
void setShortcutHandlingSuspended
(boolean isSuspended
,
558 optional VoidCallback
callback);
560 // Updates an extension command.
561 // |update| : The parameters for updating the extension command.
562 static
void updateExtensionCommand
(ExtensionCommandUpdate update
,
563 optional VoidCallback
callback);
565 [nocompile
, deprecated
="Use management.setEnabled"]
566 static
void enable
(DOMString
id,
568 optional VoidCallback
callback);
569 [nocompile
, deprecated
="Use updateExtensionConfiguration"]
570 static
void allowIncognito
(DOMString extensionId
,
572 optional VoidCallback
callback);
573 [nocompile
, deprecated
="Use updateExtensionConfiguration"]
574 static
void allowFileAccess
(DOMString extensionId
,
576 optional VoidCallback
callback);
577 [nocompile
, deprecated
="Use openDevTools"]
578 static
void inspect
(InspectOptions options
,
579 optional VoidCallback
callback);
583 // Fired when a item state is changed.
584 static
void onItemStateChanged
(EventData response
);
586 // Fired when the profile's state has changed.
587 static
void onProfileStateChanged
(ProfileInfo info
);