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
{
18 dictionary ItemInspectView
{
19 // path to the inspect page.
22 // For lazy background pages, the value is -1.
23 long render_process_id
;
27 boolean generatedBackgroundPage
;
30 dictionary InstallWarning
{
38 DOMString description
;
41 DOMString? disabled_reason
;
44 boolean allow_activity
;
45 boolean allow_file_access
;
46 boolean wants_file_access
;
47 boolean incognito_enabled
;
51 boolean allow_incognito
;
54 // Path of an unpacked extension.
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
;
65 boolean offline_enabled
;
67 // All views of the current extension.
68 ItemInspectView
[] views
;
71 dictionary InspectOptions
{
72 DOMString extension_id
;
73 DOMString render_process_id
;
74 DOMString render_view_id
;
99 // New window / view opened.
101 // window / view closed.
106 dictionary PackDirectoryResponse
{
107 // The response message of success or error.
110 // Unpacked items's path.
113 // Permanent key path.
120 dictionary ProjectInfo
{
124 dictionary EventData
{
125 EventType event_type
;
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
);
138 interface Functions
{
139 // Runs auto update for extensions and apps immediately.
140 // |callback| : Called with the boolean result, true if autoUpdate is
142 static
void autoUpdate
(BooleanCallback
callback);
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);
152 // Opens a permissions dialog for given |itemId|.
153 static
void showPermissionsDialog
(DOMString itemId
,
154 optional VoidCallback
callback);
156 // Opens an inspect window for given |options|
157 static
void inspect
(InspectOptions options
,
158 optional VoidCallback
callback);
160 // Enable / Disable file access for a given |item_id|
161 static
void allowFileAccess
(DOMString item_id
,
163 optional VoidCallback
callback);
165 // Reloads a given item with |itemId|.
166 static
void reload
(DOMString itemId
, optional VoidCallback
callback);
168 // Enable / Disable a given item with id |itemId|.
169 static
void enable
(DOMString itemId
,
171 optional VoidCallback
callback);
173 // Allow / Disallow item with |item_id| in incognito mode.
174 static
void allowIncognito
(DOMString item_id
,
176 VoidCallback
callback);
178 // Load a user selected unpacked item
179 static
void loadUnpacked
(optional VoidCallback
callback);
181 // Loads an extension / app from a given |directory|
182 static
void loadDirectory
([instanceOf
=DirectoryEntry
] object directory
,
183 PathCallback
callback);
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
,
192 PathCallback
callback);
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
,
199 PackCallback
callback);
201 // Returns true if the profile is managed.
202 static
void isProfileManaged
(BooleanCallback
callback);
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
219 // The callback is called with a dictionary with three keys:
220 // - highlight: The region of the code which threw the error, and should
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);
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
);
240 // Fired when a item state is changed.
241 static
void onItemStateChanged
(EventData response
);