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. 8namespace 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 boolean offline_enabled; 64 65 // All views of the current extension. 66 ItemInspectView[] views; 67 }; 68 69 dictionary InspectOptions { 70 DOMString extension_id; 71 DOMString render_process_id; 72 DOMString render_view_id; 73 boolean incognito; 74 }; 75 76 enum PackStatus { 77 SUCCESS, 78 ERROR, 79 WARNING 80 }; 81 82 enum FileType { 83 LOAD, 84 PEM 85 }; 86 87 enum SelectType { 88 FILE, 89 FOLDER 90 }; 91 92 enum EventType { 93 INSTALLED, 94 UNINSTALLED, 95 LOADED, 96 UNLOADED, 97 // New window / view opened. 98 VIEW_REGISTERED, 99 // window / view closed. 100 VIEW_UNREGISTERED 101 }; 102 103 dictionary PackDirectoryResponse { 104 // The response message of success or error. 105 DOMString message; 106 107 // Unpacked items's path. 108 DOMString item_path; 109 110 // Permanent key path. 111 DOMString pem_path; 112 113 long override_flags; 114 PackStatus status; 115 }; 116 117 dictionary ProjectInfo { 118 DOMString name; 119 }; 120 121 dictionary EventData { 122 EventType event_type; 123 DOMString item_id; 124 }; 125 126 callback VoidCallback = void (); 127 callback BooleanCallback = void (boolean result); 128 callback ItemsInfoCallback = void (ItemInfo[] result); 129 callback GetStringsCallback = void (object result); 130 callback GetProjectsInfoCallback = void (ProjectInfo[] result); 131 callback PathCallback = void (DOMString path); 132 callback PackCallback = void (PackDirectoryResponse response); 133 callback VoidCallback = void(); 134 135 interface Functions { 136 // Runs auto update for extensions and apps immediately. 137 // |callback| : Called with the boolean result, true if autoUpdate is 138 // successful. 139 static void autoUpdate(BooleanCallback callback); 140 141 // Returns information of all the extensions and apps installed. 142 // |include_disabled| : include disabled items. 143 // |include_terminated| : include terminated items. 144 // |callback| : Called with items info. 145 static void getItemsInfo(boolean include_disabled, 146 boolean include_terminated, 147 ItemsInfoCallback callback); 148 149 // Opens a permissions dialog for given |itemId|. 150 static void showPermissionsDialog(DOMString itemId, 151 optional VoidCallback callback); 152 153 // Opens an inspect window for given |options| 154 static void inspect(InspectOptions options, 155 optional VoidCallback callback); 156 157 // Enable / Disable file access for a given |item_id| 158 static void allowFileAccess(DOMString item_id, 159 boolean allow, 160 optional VoidCallback callback); 161 162 // Reloads a given item with |itemId|. 163 static void reload(DOMString itemId, optional VoidCallback callback); 164 165 // Enable / Disable a given item with id |itemId|. 166 static void enable(DOMString itemId, 167 boolean enable, 168 optional VoidCallback callback); 169 170 // Allow / Disallow item with |item_id| in incognito mode. 171 static void allowIncognito(DOMString item_id, 172 boolean allow, 173 VoidCallback callback); 174 175 // Load a user selected unpacked item 176 static void loadUnpacked(optional VoidCallback callback); 177 178 // Copies the syncfs folder for the extension to local disk. 179 static void exportSyncfsFolderToLocalfs(DOMString folder_name, 180 optional VoidCallback callback); 181 182 // Loads the unpacked app / extension. 183 // |callback| called with itemId of the loaded item. 184 static void loadProject(DOMString project_name, 185 PathCallback callback); 186 187 // Open Dialog to browse to an entry. 188 // |select_type| : Select a file or a folder. 189 // |file_type| : Required file type. For Example pem type is for private 190 // key and load type is for an unpacked item. 191 // |callback| : called with selected item's path. 192 static void choosePath(SelectType select_type, 193 FileType file_type, 194 PathCallback callback); 195 196 // Pack an item with given |path| and |private_key_path| 197 // |callback| : called with the success result string. 198 static void packDirectory(DOMString path, 199 DOMString private_key_path, 200 long flags, 201 PackCallback callback); 202 203 // Gets localized translated strings for apps_debugger. It returns the 204 // strings as a dictionary mapping from string identifier to the 205 // translated string to use in the apps_debugger app UI. 206 static void getStrings(GetStringsCallback callback); 207 208 // Returns true if the profile is managed. 209 static void isProfileManaged(BooleanCallback callback); 210 }; 211 212 interface Events { 213 // Fired when a item state is changed. 214 static void onItemStateChanged(EventData response); 215 }; 216 217}; 218