summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/developer_private.idl
blob: 740390ca0949eec1632b19b323e4060e69852ddd (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
// 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.

namespace developerPrivate {

  enum ItemType {
    hosted_app,
    packaged_app,
    legacy_packaged_app,
    extension,
    theme
  };

  dictionary ItemInspectView {
    // path to the inspect page.
    DOMString path;

    // For lazy background pages, the value is -1.
    long render_process_id;

    long render_view_id;
    boolean incognito;
  };

  dictionary ItemInfo {
    DOMString id;
    DOMString name;
    DOMString version;
    DOMString description;
    boolean may_disable;
    boolean enabled;
    DOMString? disabled_reason;
    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;
    boolean offline_enabled;

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

  dictionary InspectOptions {
    DOMString extension_id;
    DOMString render_process_id;
    DOMString render_view_id;
    boolean incognito;
  };

  enum PackStatus {
    SUCCESS,
    ERROR,
    WARNING
  };

  enum FileType {
    LOAD,
    PEM
  };

  enum SelectType {
    FILE,
    FOLDER
  };

  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;
  };

  callback VoidCallback = void ();
  callback BooleanCallback = void (boolean result);
  callback ItemsInfoCallback = void (ItemInfo[] result);
  callback GetStringsCallback = void (object result);
  callback GetProjectsInfoCallback = void (ProjectInfo[] result);
  callback PathCallback = void (DOMString path);
  callback PackCallback = void (PackDirectoryResponse response);
  callback VoidCallback = void();

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

    // Returns information of all the extensions and apps installed.
    // |include_disabled| : include disabled items.
    // |include_terminated| : include terminated items.
    // |callback| : Called with items info.
    static void getItemsInfo(boolean include_disabled,
                             boolean include_terminated,
                             ItemsInfoCallback callback);

    // Opens a permissions dialog for given |itemId|.
    static void showPermissionsDialog(DOMString itemId,
                                      optional VoidCallback callback);

    // Opens an inspect window for given |options|
    static void inspect(InspectOptions options,
                        optional VoidCallback callback);

    // Enable / Disable file access for a given |item_id|
    static void allowFileAccess(DOMString item_id,
                                boolean allow,
                                optional VoidCallback callback);

    // Reloads a given item with |itemId|.
    static void reload(DOMString itemId, optional VoidCallback callback);

    // Restarts a given item with |itemId|.
    static void restart(DOMString itemId, optional VoidCallback callback);

    // Enable / Disable a given item with id |itemId|.
    static void enable(DOMString itemId,
                       boolean enable,
                       optional VoidCallback callback);

    // Allow / Disallow item with |item_id| in incognito mode.
    static void allowIncognito(DOMString item_id,
                               boolean allow,
                               VoidCallback callback);

    // Load a user selected unpacked item
    static void loadUnpacked(optional VoidCallback callback);

    // Copies the syncfs folder for the extension to local disk.
    static void exportSyncfsFolderToLocalfs(DOMString folder_name,
                                            optional VoidCallback callback);

    // Loads the unpacked app / extension.
    // |callback| called with itemId of the loaded item.
    static void loadProject(DOMString project_name,
                            PathCallback callback);

    // Open Dialog to browse to an entry.
    // |select_type| : Select a file or a folder.
    // |file_type| : 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 select_type,
                           FileType file_type,
                           PathCallback callback);

    // Pack an item with given |path| and |private_key_path|
    // |callback| : called with the success result string.
    static void packDirectory(DOMString path,
                              DOMString private_key_path,
                              long flags,
                              PackCallback callback);

    // Gets localized translated strings for apps_debugger. It returns the
    // strings as a dictionary mapping from string identifier to the
    // translated string to use in the apps_debugger app UI.
    static void getStrings(GetStringsCallback callback);
  };

};