Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / developer_private.idl
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.
4
5 // developerPrivate API.
6 // This is a private API exposing developing and debugging functionalities for
7 // apps and extensions.
8 namespace developerPrivate {
9
10   enum ItemType {
11     hosted_app,
12     packaged_app,
13     legacy_packaged_app,
14     extension,
15     theme
16   };
17
18   dictionary ItemInspectView {
19     // path to the inspect page.
20     DOMString path;
21
22     // For lazy background pages, the value is -1.
23     long render_process_id;
24
25     long render_view_id;
26     boolean incognito;
27     boolean generatedBackgroundPage;
28   };
29
30   dictionary InstallWarning {
31     DOMString message;
32   };
33
34   dictionary ItemInfo {
35     DOMString id;
36     DOMString name;
37     DOMString version;
38     DOMString description;
39     boolean may_disable;
40     boolean enabled;
41     DOMString? disabled_reason;
42     boolean isApp;
43     ItemType type;
44     boolean allow_activity;
45     boolean allow_file_access;
46     boolean wants_file_access;
47     boolean incognito_enabled;
48     boolean is_unpacked;
49     boolean allow_reload;
50     boolean terminated;
51     boolean allow_incognito;
52     DOMString icon_url;
53
54     // Path of an unpacked extension.
55     DOMString? path;
56
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;
64     any[] runtime_errors;
65     boolean offline_enabled;
66
67     // All views of the current extension.
68     ItemInspectView[] views;
69   };
70
71   dictionary InspectOptions {
72     DOMString extension_id;
73     DOMString render_process_id;
74     DOMString render_view_id;
75     boolean incognito;
76   };
77
78   enum PackStatus {
79     SUCCESS,
80     ERROR,
81     WARNING
82   };
83
84   enum FileType {
85     LOAD,
86     PEM
87   };
88
89   enum SelectType {
90     FILE,
91     FOLDER
92   };
93
94   enum EventType {
95     INSTALLED,
96     UNINSTALLED,
97     LOADED,
98     UNLOADED,
99     // New window / view opened.
100     VIEW_REGISTERED,
101     // window / view closed.
102     VIEW_UNREGISTERED,
103     ERROR_ADDED
104   };
105
106   dictionary PackDirectoryResponse {
107     // The response message of success or error.
108     DOMString message;
109
110     // Unpacked items's path.
111     DOMString item_path;
112
113     // Permanent key path.
114     DOMString pem_path;
115
116     long override_flags;
117     PackStatus status;
118   };
119
120   dictionary ProjectInfo {
121     DOMString name;
122   };
123
124   dictionary EventData {
125     EventType event_type;
126     DOMString item_id;
127   };
128
129   callback VoidCallback = void ();
130   callback BooleanCallback = void (boolean result);
131   callback ItemsInfoCallback = void (ItemInfo[] result);
132   callback GetProjectsInfoCallback = void (ProjectInfo[] result);
133   callback PathCallback = void (DOMString path);
134   callback PackCallback = void (PackDirectoryResponse response);
135   callback VoidCallback = void();
136   callback AnyCallback = void (any result);
137
138   interface Functions {
139     // Runs auto update for extensions and apps immediately.
140     // |callback| : Called with the boolean result, true if autoUpdate is
141     // successful.
142     static void autoUpdate(BooleanCallback callback);
143
144     // Returns information of all the extensions and apps installed.
145     // |include_disabled| : include disabled items.
146     // |include_terminated| : include terminated items.
147     // |callback| : Called with items info.
148     static void getItemsInfo(boolean include_disabled,
149                              boolean include_terminated,
150                              ItemsInfoCallback callback);
151
152     // Opens a permissions dialog for given |itemId|.
153     static void showPermissionsDialog(DOMString itemId,
154                                       optional VoidCallback callback);
155
156     // Opens an inspect window for given |options|
157     static void inspect(InspectOptions options,
158                         optional VoidCallback callback);
159
160     // Enable / Disable file access for a given |item_id|
161     static void allowFileAccess(DOMString item_id,
162                                 boolean allow,
163                                 optional VoidCallback callback);
164
165     // Reloads a given item with |itemId|.
166     static void reload(DOMString itemId, optional VoidCallback callback);
167
168     // Enable / Disable a given item with id |itemId|.
169     static void enable(DOMString itemId,
170                        boolean enable,
171                        optional VoidCallback callback);
172
173     // Allow / Disallow item with |item_id| in incognito mode.
174     static void allowIncognito(DOMString item_id,
175                                boolean allow,
176                                VoidCallback callback);
177
178     // Load a user selected unpacked item
179     static void loadUnpacked(optional VoidCallback callback);
180
181     // Loads an extension / app from a given |directory|
182     static void loadDirectory([instanceOf=DirectoryEntry] object directory,
183                         PathCallback callback);
184
185     // Open Dialog to browse to an entry.
186     // |select_type| : Select a file or a folder.
187     // |file_type| : Required file type. For Example pem type is for private
188     // key and load type is for an unpacked item.
189     // |callback| : called with selected item's path.
190     static void choosePath(SelectType select_type,
191                            FileType file_type,
192                            PathCallback callback);
193
194     // Pack an item with given |path| and |private_key_path|
195     // |callback| : called with the success result string.
196     static void packDirectory(DOMString path,
197                               DOMString private_key_path,
198                               long flags,
199                               PackCallback callback);
200
201     // Returns true if the profile is managed.
202     static void isProfileManaged(BooleanCallback callback);
203
204     // Reads and returns the contents of a file related to an extension which
205     // caused an error. The expected argument is a dictionary with the
206     // following entries:
207     // - pathSuffix: The path of the file, relative to the extension; e.g.,
208     //       manifest.json, script.js, or main.html.
209     // - extensionId: The ID of the extension owning the file.
210     // - errorMessage: The error message which was thrown as a result of the
211     //       error in the file.
212     // - manifestKey (required for "manifest.json" file): The key
213     //       in the manifest which caused the error (e.g., "permissions").
214     // - manifestSpecific (optional for "manifest.json" file): The specific
215     //       portion of the manifest key which caused the error (e.g., "foo" in
216     //       the "permissions" key).
217     // - lineNumber (optional for non-manifest files): The line number which
218     //       caused the error.
219     // The callback is called with a dictionary with three keys:
220     // - highlight: The region of the code which threw the error, and should
221     //       be highlighted.
222     // - beforeHighlight: The region before the "highlight" portion.
223     // - afterHighlight: The region after the "highlight" portion.
224     // - highlight: The region of the code which threw the error.
225     // If the region which threw the error was not found, the full contents of
226     // the file will be in the "beforeHighlight" section.
227     static void requestFileSource(any dict, AnyCallback callback);
228
229     // Open the developer tools to focus on a particular error. The expected
230     // argument is a dictionary with the following entries:
231     // - renderViewId: The ID of the render view in which the error occurred.
232     // - renderProcessId: The ID of the process in which the error occurred.
233     // - url (optional): The URL in which the error occurred.
234     // - lineNumber (optional): The line to focus the devtools at.
235     // - columnNumber (optional): The column to focus the devtools at.
236     static void openDevTools(any dict);
237   };
238
239   interface Events {
240     // Fired when a item state is changed.
241     static void onItemStateChanged(EventData response);
242   };
243
244 };