summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/developer_private.idl
blob: bf6e4907a80ecbcd8d03658550645340f852efd2 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
// 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.

// developerPrivate API.
// This is a private API exposing developing and debugging functionalities for
// apps and extensions.
[use_movable_types=true] namespace developerPrivate {

  // DEPRECATED: Prefer ExtensionType.
  enum ItemType {
    hosted_app,
    packaged_app,
    legacy_packaged_app,
    extension,
    theme
  };

  // DEPRECATED: Prefer ExtensionView.
  dictionary ItemInspectView {
    // path to the inspect page.
    DOMString path;

    // For lazy background pages, the value is -1.
    long render_process_id;
    // This actually refers to a render frame.
    long render_view_id;

    boolean incognito;
    boolean generatedBackgroundPage;
  };

  // DEPRECATED: Use OpenDevTools.
  dictionary InspectOptions {
    DOMString extension_id;
    (DOMString or long) render_process_id;
    (DOMString or long) render_view_id;
    boolean incognito;
  };

  dictionary InstallWarning {
    DOMString message;
  };

  enum ExtensionType {
    HOSTED_APP,
    PLATFORM_APP,
    LEGACY_PACKAGED_APP,
    EXTENSION,
    THEME,
    SHARED_MODULE
  };

  enum Location {
    FROM_STORE,
    UNPACKED,
    THIRD_PARTY,
    // "Unknown" includes crx's installed from chrome://extensions.
    UNKNOWN
  };

  enum ViewType {
    APP_WINDOW,
    BACKGROUND_CONTENTS,
    COMPONENT,
    EXTENSION_BACKGROUND_PAGE,
    EXTENSION_DIALOG,
    EXTENSION_GUEST,
    EXTENSION_POPUP,
    LAUNCHER_PAGE,
    PANEL,
    TAB_CONTENTS
  };

  enum ErrorType {
    MANIFEST,
    RUNTIME
  };

  enum ErrorLevel {
    LOG,
    WARN,
    ERROR
  };

  enum ExtensionState {
    ENABLED,
    DISABLED,
    TERMINATED
  };

  enum CommandScope {
    GLOBAL,
    CHROME
  };

  dictionary AccessModifier {
    boolean isEnabled;
    boolean isActive;
  };

  dictionary StackFrame {
    long lineNumber;
    long columnNumber;
    DOMString url;
    DOMString functionName;
  };

  dictionary ManifestError {
    ErrorType type;
    DOMString extensionId;
    boolean fromIncognito;
    DOMString source;
    DOMString message;
    long id;
    DOMString manifestKey;
    DOMString? manifestSpecific;
  };

  dictionary RuntimeError {
    ErrorType type;
    DOMString extensionId;
    boolean fromIncognito;
    DOMString source;
    DOMString message;
    long id;
    ErrorLevel severity;
    DOMString contextUrl;
    long occurrences;
    long renderViewId;
    long renderProcessId;
    boolean canInspect;
    StackFrame[] stackTrace;
  };

  dictionary DisableReasons {
    boolean suspiciousInstall;
    boolean corruptInstall;
    boolean updateRequired;
  };

  dictionary OptionsPage {
    boolean openInTab;
    DOMString url;
  };

  dictionary HomePage {
    DOMString url;
    boolean specified;
  };

  dictionary ExtensionView {
    DOMString url;
    long renderProcessId;
    // This actually refers to a render frame.
    long renderViewId;
    boolean incognito;
    boolean isIframe;
    ViewType type;
  };

  enum ControllerType {
    POLICY,
    CHILD_CUSTODIAN,
    SUPERVISED_USER_CUSTODIAN
  };

  dictionary ControlledInfo {
    ControllerType type;
    DOMString text;
  };

  dictionary Command {
    DOMString description;
    DOMString keybinding;
    DOMString name;
    boolean isActive;
    CommandScope scope;
    boolean isExtensionAction;
  };

  dictionary ExtensionInfo {
    boolean actionButtonHidden;
    DOMString? blacklistText;
    Command[] commands;
    ControlledInfo? controlledInfo;
    DOMString[] dependentExtensions;
    DOMString description;
    DisableReasons disableReasons;
    AccessModifier errorCollection;
    AccessModifier fileAccess;
    HomePage homePage;
    DOMString iconUrl;
    DOMString id;
    AccessModifier incognitoAccess;
    DOMString[] installWarnings;
    DOMString? launchUrl;
    Location location;
    DOMString? locationText;
    ManifestError[] manifestErrors;
    boolean mustRemainInstalled;
    DOMString name;
    boolean offlineEnabled;
    OptionsPage? optionsPage;
    DOMString? path;
    DOMString? prettifiedPath;
    AccessModifier runOnAllUrls;
    RuntimeError[] runtimeErrors;
    DOMString[] runtimeWarnings;
    ExtensionState state;
    ExtensionType type;
    DOMString updateUrl;
    boolean userMayModify;
    DOMString version;
    ExtensionView[] views;
  };

  dictionary ProfileInfo {
    boolean appInfoDialogEnabled;
    boolean canLoadUnpacked;
    boolean inDeveloperMode;
    boolean isIncognitoAvailable;
    boolean isSupervised;
  };

  // DEPRECATED: Prefer ExtensionInfo.
  dictionary ItemInfo {
    DOMString id;
    DOMString name;
    DOMString version;
    DOMString description;
    boolean may_disable;
    boolean enabled;
    boolean isApp;
    ItemType type;
    boolean allow_activity;
    boolean allow_file_access;
    boolean wants_file_access;
    boolean incognito_enabled;
    boolean is_unpacked;
    boolean allow_reload;
    boolean terminated;
    boolean allow_incognito;
    DOMString icon_url;

    // Path of an unpacked extension.
    DOMString? path;

    // Options settings page for the item.
    DOMString? options_url;
    DOMString? app_launch_url;
    DOMString? homepage_url;
    DOMString? update_url;
    InstallWarning[] install_warnings;
    any[] manifest_errors;
    any[] runtime_errors;
    boolean offline_enabled;

    // All views of the current extension.
    ItemInspectView[] views;
  };

  dictionary GetExtensionsInfoOptions {
    boolean? includeDisabled;
    boolean? includeTerminated;
  };

  dictionary ExtensionConfigurationUpdate {
    DOMString extensionId;
    boolean? fileAccess;
    boolean? incognitoAccess;
    boolean? errorCollection;
    boolean? runOnAllUrls;
    boolean? showActionButton;
  };

  dictionary ProfileConfigurationUpdate {
    boolean? inDeveloperMode;
  };

  dictionary ExtensionCommandUpdate {
    DOMString extensionId;
    DOMString commandName;
    CommandScope? scope;
    DOMString? keybinding;
  };

  dictionary ReloadOptions {
    // If false, an alert dialog will show in the event of a reload error.
    // Defaults to false.
    boolean? failQuietly;
  };

  dictionary LoadUnpackedOptions {
    // If false, an alert dialog will show in the event of a reload error.
    // Defaults to false.
    boolean? failQuietly;
  };

  enum PackStatus {
    SUCCESS,
    ERROR,
    WARNING
  };

  enum FileType {
    LOAD,
    PEM
  };

  enum SelectType {
    FILE,
    FOLDER
  };

  enum EventType {
    INSTALLED,
    UNINSTALLED,
    LOADED,
    UNLOADED,
    // New window / view opened.
    VIEW_REGISTERED,
    // window / view closed.
    VIEW_UNREGISTERED,
    ERROR_ADDED,
    ERRORS_REMOVED,
    PREFS_CHANGED,
    WARNINGS_CHANGED
  };

  dictionary PackDirectoryResponse {
    // The response message of success or error.
    DOMString message;

    // Unpacked items's path.
    DOMString item_path;

    // Permanent key path.
    DOMString pem_path;

    long override_flags;
    PackStatus status;
  };

  dictionary ProjectInfo {
    DOMString name;
  };

  dictionary EventData {
    EventType event_type;
    DOMString item_id;
    ExtensionInfo? extensionInfo;
  };

  dictionary RequestFileSourceProperties {
    // The ID of the extension owning the file.
    DOMString extensionId;

    // The path of the file, relative to the extension; e.g., manifest.json,
    // script.js, or main.html.
    DOMString pathSuffix;

    // The error message which was thrown as a result of the error in the file.
    DOMString message;

    // The key in the manifest which caused the error (e.g., "permissions").
    // (Required for "manifest.json" files)
    DOMString? manifestKey;

    // The specific portion of the manifest key which caused the error (e.g.,
    // "foo" in the "permissions" key). (Optional for "manifest.json" file).
    DOMString? manifestSpecific;

    // The line number which caused the error (optional for non-manifest files).
    long? lineNumber;
  };

  dictionary RequestFileSourceResponse {
    // The region of the code which threw the error, and should be highlighted.
    DOMString highlight;

    // The region before the "highlight" portion.
    // If the region which threw the error was not found, the full contents of
    // the file will be in the "beforeHighlight" section.
    DOMString beforeHighlight;

    // The region after the "highlight" portion.
    DOMString afterHighlight;

    // A title for the file in the form '<extension name>: <file name>'.
    DOMString title;

    // The error message.
    DOMString message;
  };

  dictionary OpenDevToolsProperties {
    // The ID of the extension. This is only needed if opening the background
    // page (where renderViewId and renderProcessId are -1).
    DOMString? extensionId;

    // The ID of the render frame in which the error occurred.
    // Despite being called renderViewId, this refers to a render frame.
    long renderViewId;

    // The ID of the process in which the error occurred.
    long renderProcessId;

    boolean? incognito;

    // The URL in which the error occurred.
    DOMString? url;

    // The line to focus the devtools at.
    long? lineNumber;

    // The column to focus the devtools at.
    long? columnNumber;
  };

  dictionary DeleteExtensionErrorsProperties {
    DOMString extensionId;
    long[]? errorIds;
    ErrorType? type;
  };

  callback VoidCallback = void ();
  callback BooleanCallback = void (boolean result);
  callback ExtensionInfosCallback = void (ExtensionInfo[] result);
  callback ExtensionInfoCallback = void (ExtensionInfo result);
  callback ItemsInfoCallback = void (ItemInfo[] result);
  callback ProfileInfoCallback = void (ProfileInfo info);
  callback GetProjectsInfoCallback = void (ProjectInfo[] result);
  callback PathCallback = void (DOMString path);
  callback PackCallback = void (PackDirectoryResponse response);
  callback VoidCallback = void();
  callback RequestFileSourceCallback =
      void (RequestFileSourceResponse response);

  interface Functions {
    // Runs auto update for extensions and apps immediately.
    // |callback| : Called with the boolean result, true if autoUpdate is
    // successful.
    static void autoUpdate(optional BooleanCallback callback);

    // Returns information of all the extensions and apps installed.
    // |options| : Options to restrict the items returned.
    // |callback| : Called with extensions info.
    static void getExtensionsInfo(optional GetExtensionsInfoOptions options,
                                  optional ExtensionInfosCallback callback);

    // Returns information of a particular extension.
    // |id| : The id of the extension.
    // |callback| : Called with the result.
    static void getExtensionInfo(DOMString id,
                                 optional ExtensionInfoCallback callback);

    // Returns information of all the extensions and apps installed.
    // |includeDisabled| : include disabled items.
    // |includeTerminated| : include terminated items.
    // |callback| : Called with items info.
    [deprecated="Use getExtensionsInfo"] static void getItemsInfo(
        boolean includeDisabled,
        boolean includeTerminated,
        ItemsInfoCallback callback);

    // Returns the current profile's configuration.
    static void getProfileConfiguration(ProfileInfoCallback callback);

    // Updates the active profile.
    // |update| : The parameters for updating the profile's configuration.  Any
    //     properties omitted from |update| will not be changed.
    static void updateProfileConfiguration(ProfileConfigurationUpdate update,
                                           optional VoidCallback callback);

    // Opens a permissions dialog.
    // |extensionId| : The id of the extension to show permissions for.
    static void showPermissionsDialog(DOMString extensionId,
                                      optional VoidCallback callback);

    // Reloads a given extension.
    // |extensionId| : The id of the extension to reload.
    // |options| : Additional configuration parameters.
    static void reload(DOMString extensionId,
                       optional ReloadOptions options,
                       optional VoidCallback callback);

    // Modifies an extension's current configuration.
    // |update| : The parameters for updating the extension's configuration.
    //     Any properties omitted from |update| will not be changed.
    static void updateExtensionConfiguration(
        ExtensionConfigurationUpdate update,
        optional VoidCallback callback);

    // Loads a user-selected unpacked item.
    // |options| : Additional configuration parameters.
    static void loadUnpacked(optional LoadUnpackedOptions options,
                             optional VoidCallback callback);

    // Loads an extension / app.
    // |directory| : The directory to load the extension from.
    static void loadDirectory(
        [instanceOf=DirectoryEntry] object directory,
        PathCallback callback);

    // Open Dialog to browse to an entry.
    // |selectType| : Select a file or a folder.
    // |fileType| : Required file type. For example, pem type is for private
    // key and load type is for an unpacked item.
    // |callback| : called with selected item's path.
    static void choosePath(SelectType selectType,
                           FileType fileType,
                           PathCallback callback);

    // Pack an extension.
    // |rootPath| : The path of the extension.
    // |privateKeyPath| : The path of the private key, if one is given.
    // |flags| : Special flags to apply to the loading process, if any.
    // |callback| : called with the success result string.
    static void packDirectory(DOMString path,
                              optional DOMString privateKeyPath,
                              optional long flags,
                              optional PackCallback callback);

    // Returns true if the profile is managed.
    static void isProfileManaged(BooleanCallback callback);

    // Reads and returns the contents of a file related to an extension which
    // caused an error.
    static void requestFileSource(RequestFileSourceProperties properties,
                                  RequestFileSourceCallback callback);

    // Open the developer tools to focus on a particular error.
    static void openDevTools(OpenDevToolsProperties properties,
                             optional VoidCallback callback);

    // Delete reported extension erors.
    // |properties| : The properties specifying the errors to remove.
    static void deleteExtensionErrors(
        DeleteExtensionErrorsProperties properties,
        optional VoidCallback callback);

    // Repairs the extension specified.
    // |extensionId| : The id of the extension to repair.
    static void repairExtension(DOMString extensionId,
                                optional VoidCallback callback);

    // Shows the options page for the extension specified.
    // |extensionId| : The id of the extension to show the options page for.
    static void showOptions(DOMString extensionId,
                            optional VoidCallback callback);

    // Shows the path of the extension specified.
    // |extensionId| : The id of the extension to show the path for.
    static void showPath(DOMString extensionId, optional VoidCallback callback);

    // (Un)suspends global shortcut handling.
    // |isSuspended| : Whether or not shortcut handling should be suspended.
    static void setShortcutHandlingSuspended(boolean isSuspended,
                                             optional VoidCallback callback);

    // Updates an extension command.
    // |update| : The parameters for updating the extension command.
    static void updateExtensionCommand(ExtensionCommandUpdate update,
                                       optional VoidCallback callback);

    [nocompile, deprecated="Use management.setEnabled"]
        static void enable(DOMString id,
                           boolean enabled,
                           optional VoidCallback callback);
    [nocompile, deprecated="Use updateExtensionConfiguration"]
        static void allowIncognito(DOMString extensionId,
                                   boolean allow,
                                   optional VoidCallback callback);
    [nocompile, deprecated="Use updateExtensionConfiguration"]
        static void allowFileAccess(DOMString extensionId,
                                    boolean allow,
                                    optional VoidCallback callback);
    [nocompile, deprecated="Use openDevTools"]
        static void inspect(InspectOptions options,
                            optional VoidCallback callback);
  };

  interface Events {
    // Fired when a item state is changed.
    static void onItemStateChanged(EventData response);

    // Fired when the profile's state has changed.
    static void onProfileStateChanged(ProfileInfo info);
  };

};