extension_constants.h revision 3551c9c881056c480085172ff9840cab31610854
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#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_ 6#define CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "url/gurl.h" 12 13namespace extension_urls { 14 // Returns the URL prefix for the extension/apps gallery. Can be set via the 15 // --apps-gallery-url switch. The URL returned will not contain a trailing 16 // slash. Do not use this as a prefix/extent for the store. 17 std::string GetWebstoreLaunchURL(); 18 19 // Returns the URL to the extensions category on the Web Store. This is 20 // derived from GetWebstoreLaunchURL(). 21 std::string GetExtensionGalleryURL(); 22 23 // Returns the URL prefix for an item in the extension/app gallery. This URL 24 // will contain a trailing slash and should be concatenated with an item ID 25 // to get the item detail URL. 26 std::string GetWebstoreItemDetailURLPrefix(); 27 28 // Returns the URL used to get webstore data (ratings, manifest, icon URL, 29 // etc.) about an extension from the webstore as JSON. 30 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id); 31 32 // Returns the URL used to get webstore search results in JSON format. The URL 33 // returns a JSON dictionary that has the search results (under "results"). 34 // Each entry in the array is a dictionary as the data returned for 35 // GetWebstoreItemJsonDataURL above. |query| is the user typed query string. 36 // |hl| is the host language code, e.g. en_US. Both arguments will be escaped 37 // and added as a query parameter to the returned web store json search URL. 38 GURL GetWebstoreJsonSearchUrl(const std::string& query, 39 const std::string& hl); 40 41 // Returns the URL of the web store search results page for |query|. 42 GURL GetWebstoreSearchPageUrl(const std::string& query); 43 44 // Return the update URL used by gallery/webstore extensions/apps. 45 GURL GetWebstoreUpdateUrl(); 46 47 // Returns whether the URL is the webstore update URL (just considering host 48 // and path, not scheme, query, etc.) 49 bool IsWebstoreUpdateUrl(const GURL& update_url); 50 51 // Returns true if the URL points to an extension blacklist. 52 bool IsBlacklistUpdateUrl(const GURL& url); 53 54 // The greatest common prefixes of the main extensions gallery's browse and 55 // download URLs. 56 extern const char kGalleryBrowsePrefix[]; 57} // namespace extension_urls 58 59namespace extension_misc { 60 // Matches chrome.windows.WINDOW_ID_NONE. 61 const int kUnknownWindowId = -1; 62 63 // Matches chrome.windows.WINDOW_ID_CURRENT. 64 const int kCurrentWindowId = -2; 65 66 // The extension id of the bookmark manager. 67 extern const char kBookmarkManagerId[]; 68 69 // The extension id of the Chrome component application. 70 extern const char kChromeAppId[]; 71 72 // The extension id of the Citrix Receiver application. 73 extern const char kCitrixReceiverAppId[]; 74 75 // The extension id of the beta Citrix Receiver application. 76 extern const char kCitrixReceiverAppBetaId[]; 77 78 // The extension id of the dev Citrix Receiver application. 79 extern const char kCitrixReceiverAppDevId[]; 80 81 // The extension id of the Cloud Print component application. 82 extern const char kCloudPrintAppId[]; 83 84 // The extension id of the Enterprise Web Store component application. 85 extern const char kEnterpriseWebStoreAppId[]; 86 87 // The extension id of GMail application. 88 extern const char kGmailAppId[]; 89 90 // The extension id of the Google Doc application. 91 extern const char kGoogleDocAppId[]; 92 93 // The extension id of the Google Play Music application. 94 extern const char kGooglePlayMusicAppId[]; 95 96 // The extension id of the Google Search application. 97 extern const char kGoogleSearchAppId[]; 98 99 // The extension id of the Google Sheets application. 100 extern const char kGoogleSheetsAppId[]; 101 102 // The extension id of the Google Slides application. 103 extern const char kGoogleSlidesAppId[]; 104 105 // The extension id of the HTerm app for ChromeOS. 106 extern const char kHTermAppId[]; 107 108 // The extension id of the HTerm dev app for ChromeOS. 109 extern const char kHTermDevAppId[]; 110 111 // The extension id of the Crosh component app for ChromeOS. 112 extern const char kCroshBuiltinAppId[]; 113 114 // The extension id of the Office Viewer component extension. 115 extern const char kQuickOfficeComponentExtensionId[]; 116 117 // The extension id of the Office Viewer dev extension. 118 extern const char kQuickOfficeDevExtensionId[]; 119 120 // The extension id of the Office Viewer extension. 121 extern const char kQuickOfficeExtensionId[]; 122 123 // The extension id of the settings application. 124 extern const char kSettingsAppId[]; 125 126 // The extension id used for testing streamsPrivate 127 extern const char kStreamsPrivateTestExtensionId[]; 128 129 // The extension id of the Web Store component application. 130 extern const char kWebStoreAppId[]; 131 132 // The extension id of the Youtube application. 133 extern const char kYoutubeAppId[]; 134 135 // The extension id of the Identity API UI application. 136 extern const char kIdentityApiUiAppId[]; 137 138 // The extension id of the in-app payments support application. 139 extern const char kInAppPaymentsSupportAppId[]; 140 141 // Note: this structure is an ASN.1 which encodes the algorithm used 142 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447). 143 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL } 144 const uint8 kSignatureAlgorithm[15] = { 145 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 146 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00 147 }; 148 149 // Don't remove items or change the order of this enum. It's used in 150 // histograms and preferences. 151 enum LaunchContainer { 152 LAUNCH_WINDOW, 153 LAUNCH_PANEL, 154 LAUNCH_TAB, 155 // For platform apps, which don't actually have a container (they just get a 156 // "onLaunched" event). 157 LAUNCH_NONE 158 }; 159 160 // The name of the app launch histogram. 161 extern const char kAppLaunchHistogram[]; 162 163 // The name of the app launch histogram for platform apps. 164 extern const char kPlatformAppLaunchHistogram[]; 165 166 // The buckets used for app launches. 167 enum AppLaunchBucket { 168 // Launch from NTP apps section while maximized. 169 APP_LAUNCH_NTP_APPS_MAXIMIZED, 170 171 // Launch from NTP apps section while collapsed. 172 APP_LAUNCH_NTP_APPS_COLLAPSED, 173 174 // Launch from NTP apps section while in menu mode. 175 APP_LAUNCH_NTP_APPS_MENU, 176 177 // Launch from NTP most visited section in any mode. 178 APP_LAUNCH_NTP_MOST_VISITED, 179 180 // Launch from NTP recently closed section in any mode. 181 APP_LAUNCH_NTP_RECENTLY_CLOSED, 182 183 // App link clicked from bookmark bar. 184 APP_LAUNCH_BOOKMARK_BAR, 185 186 // Nvigated to an app from within a web page (like by clicking a link). 187 APP_LAUNCH_CONTENT_NAVIGATION, 188 189 // Launch from session restore. 190 APP_LAUNCH_SESSION_RESTORE, 191 192 // Autolaunched at startup, like for pinned tabs. 193 APP_LAUNCH_AUTOLAUNCH, 194 195 // Launched from omnibox app links. 196 APP_LAUNCH_OMNIBOX_APP, 197 198 // App URL typed directly into the omnibox (w/ instant turned off). 199 APP_LAUNCH_OMNIBOX_LOCATION, 200 201 // Navigate to an app URL via instant. 202 APP_LAUNCH_OMNIBOX_INSTANT, 203 204 // Launch via chrome.management.launchApp. 205 APP_LAUNCH_EXTENSION_API, 206 207 // Launch an app via a shortcut. This includes using the --app or --app-id 208 // command line arguments, or via an app shim process on Mac. 209 APP_LAUNCH_CMD_LINE_APP, 210 211 // App launch by passing the URL on the cmd line (not using app switches). 212 APP_LAUNCH_CMD_LINE_URL, 213 214 // User clicked web store launcher on NTP. 215 APP_LAUNCH_NTP_WEBSTORE, 216 217 // App launched after the user re-enabled it on the NTP. 218 APP_LAUNCH_NTP_APP_RE_ENABLE, 219 220 // URL launched using the --app cmd line option, but the URL does not 221 // correspond to an installed app. These launches are left over from a 222 // feature that let you make desktop shortcuts from the file menu. 223 APP_LAUNCH_CMD_LINE_APP_LEGACY, 224 225 // User clicked web store link on the NTP footer. 226 APP_LAUNCH_NTP_WEBSTORE_FOOTER, 227 228 // User clicked [+] icon in apps page. 229 APP_LAUNCH_NTP_WEBSTORE_PLUS_ICON, 230 231 // User clicked icon in app launcher main view. 232 APP_LAUNCH_APP_LIST_MAIN, 233 234 // User clicked app launcher search result. 235 APP_LAUNCH_APP_LIST_SEARCH, 236 237 // User clicked the chrome app icon from the app launcher's main view. 238 APP_LAUNCH_APP_LIST_MAIN_CHROME, 239 240 // User clicked the webstore icon from the app launcher's main view. 241 APP_LAUNCH_APP_LIST_MAIN_WEBSTORE, 242 243 // User clicked the chrome app icon from the app launcher's search view. 244 APP_LAUNCH_APP_LIST_SEARCH_CHROME, 245 246 // User clicked the webstore icon from the app launcher's search view. 247 APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE, 248 249 APP_LAUNCH_BUCKET_BOUNDARY, 250 APP_LAUNCH_BUCKET_INVALID 251 }; 252 253#if defined(OS_CHROMEOS) 254 // Path to preinstalled ChromeVox screen reader extension. 255 extern const char kChromeVoxExtensionPath[]; 256 // Path to preinstalled Connectivity Diagnostics extension. 257 extern const char kConnectivityDiagnosticsPath[]; 258 extern const char kConnectivityDiagnosticsLauncherPath[]; 259 // Path to preinstalled speech synthesis extension. 260 extern const char kSpeechSynthesisExtensionPath[]; 261 // The extension id of the speech synthesis extension. 262 extern const char kSpeechSynthesisExtensionId[]; 263 // The extension id of the wallpaper manager application. 264 extern const char kWallpaperManagerId[]; 265#endif 266 267 // What causes an extension to be installed? Used in histograms, so don't 268 // change existing values. 269 enum CrxInstallCause { 270 INSTALL_CAUSE_UNSET = 0, 271 INSTALL_CAUSE_USER_DOWNLOAD, 272 INSTALL_CAUSE_UPDATE, 273 INSTALL_CAUSE_EXTERNAL_FILE, 274 INSTALL_CAUSE_AUTOMATION, 275 NUM_INSTALL_CAUSES 276 }; 277 278 enum UnloadedExtensionReason { 279 UNLOAD_REASON_DISABLE, // Extension is being disabled. 280 UNLOAD_REASON_UPDATE, // Extension is being updated to a newer version. 281 UNLOAD_REASON_UNINSTALL, // Extension is being uninstalled. 282 UNLOAD_REASON_TERMINATE, // Extension has terminated. 283 UNLOAD_REASON_BLACKLIST, // Extension has been blacklisted. 284 }; 285 286 // The states that an app can be in, as reported by chrome.app.installState 287 // and chrome.app.runningState. 288 extern const char kAppStateNotInstalled[]; 289 extern const char kAppStateInstalled[]; 290 extern const char kAppStateDisabled[]; 291 extern const char kAppStateRunning[]; 292 extern const char kAppStateCannotRun[]; 293 extern const char kAppStateReadyToRun[]; 294 295 // The path part of the file system url used for media file systems. 296 extern const char kMediaFileSystemPathPart[]; 297 298 // NOTE: If you change this list, you should also change kExtensionIconSizes 299 // in cc file. 300 enum ExtensionIcons { 301 EXTENSION_ICON_GIGANTOR = 512, 302 EXTENSION_ICON_EXTRA_LARGE = 256, 303 EXTENSION_ICON_LARGE = 128, 304 EXTENSION_ICON_MEDIUM = 48, 305 EXTENSION_ICON_SMALL = 32, 306 EXTENSION_ICON_SMALLISH = 24, 307 EXTENSION_ICON_ACTION = 19, 308 EXTENSION_ICON_BITTY = 16, 309 EXTENSION_ICON_INVALID = 0, 310 }; 311 312 // List of sizes for extension icons that can be defined in the manifest. 313 extern const int kExtensionIconSizes[]; 314 extern const size_t kNumExtensionIconSizes; 315 316 // List of sizes for extension icons that can be defined in the manifest. 317 extern const int kExtensionActionIconSizes[]; 318 extern const size_t kNumExtensionActionIconSizes; 319 320 // List of sizes for extension icons that can be defined in the manifest. 321 extern const int kScriptBadgeIconSizes[]; 322 extern const size_t kNumScriptBadgeIconSizes; 323} // namespace extension_misc 324 325#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_ 326