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 13 namespace 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 58 // Field to use with webstore URL for tracking launch source. 59 extern const char kWebstoreSourceField[]; 60 61 // Values to use with webstore URL launch source field. 62 extern const char kLaunchSourceAppList[]; 63 extern const char kLaunchSourceAppListSearch[]; 64 } // namespace extension_urls 65 66 namespace extension_misc { 67 // Matches chrome.windows.WINDOW_ID_NONE. 68 const int kUnknownWindowId = -1; 69 70 // Matches chrome.windows.WINDOW_ID_CURRENT. 71 const int kCurrentWindowId = -2; 72 73 // The extension id of the bookmark manager. 74 extern const char kBookmarkManagerId[]; 75 76 // The extension id of the Chrome component application. 77 extern const char kChromeAppId[]; 78 79 // The extension id of the Cloud Print component application. 80 extern const char kCloudPrintAppId[]; 81 82 // The extension id of the Enterprise Web Store component application. 83 extern const char kEnterpriseWebStoreAppId[]; 84 85 // The extension id of GMail application. 86 extern const char kGmailAppId[]; 87 88 // The extension id of the Google Doc application. 89 extern const char kGoogleDocAppId[]; 90 91 // The extension id of the Google Play Music application. 92 extern const char kGooglePlayMusicAppId[]; 93 94 // The extension id of the Google Search application. 95 extern const char kGoogleSearchAppId[]; 96 97 // The extension id of the Google Sheets application. 98 extern const char kGoogleSheetsAppId[]; 99 100 // The extension id of the Google Slides application. 101 extern const char kGoogleSlidesAppId[]; 102 103 // The extension id of the HTerm app for ChromeOS. 104 extern const char kHTermAppId[]; 105 106 // The extension id of the HTerm dev app for ChromeOS. 107 extern const char kHTermDevAppId[]; 108 109 // The extension id of the Crosh component app for ChromeOS. 110 extern const char kCroshBuiltinAppId[]; 111 112 // The extension id of the PDF extension. 113 extern const char kPdfExtensionId[]; 114 115 // The extension id of the Office Viewer component extension. 116 extern const char kQuickOfficeComponentExtensionId[]; 117 118 // The extension id of the Office Viewer dev extension. 119 extern const char kQuickOfficeDevExtensionId[]; 120 121 // The extension id of the Office Viewer extension. 122 extern const char kQuickOfficeExtensionId[]; 123 124 // The extension id of the settings application. 125 extern const char kSettingsAppId[]; 126 127 // The extension id used for testing streamsPrivate 128 extern const char kStreamsPrivateTestExtensionId[]; 129 130 // The extension id of the Web Store component application. 131 extern const char kWebStoreAppId[]; 132 133 // The extension id of the Youtube application. 134 extern const char kYoutubeAppId[]; 135 136 // The extension id of the Identity API UI application. 137 extern const char kIdentityApiUiAppId[]; 138 139 // The extension id of the in-app payments support application. 140 extern const char kInAppPaymentsSupportAppId[]; 141 142 // The extension id of the Tips & Tricks application. 143 extern const char kTipsAndTricksAppId[]; 144 145 // Note: this structure is an ASN.1 which encodes the algorithm used 146 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447). 147 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL } 148 const uint8 kSignatureAlgorithm[15] = { 149 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 150 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00 151 }; 152 153 // The name of the app launch histogram. 154 extern const char kAppLaunchHistogram[]; 155 156 // The name of the app launch histogram for platform apps. 157 extern const char kPlatformAppLaunchHistogram[]; 158 159 // The buckets used for app launches. 160 enum AppLaunchBucket { 161 // Launch from NTP apps section while maximized. 162 APP_LAUNCH_NTP_APPS_MAXIMIZED, 163 164 // Launch from NTP apps section while collapsed. 165 APP_LAUNCH_NTP_APPS_COLLAPSED, 166 167 // Launch from NTP apps section while in menu mode. 168 APP_LAUNCH_NTP_APPS_MENU, 169 170 // Launch from NTP most visited section in any mode. 171 APP_LAUNCH_NTP_MOST_VISITED, 172 173 // Launch from NTP recently closed section in any mode. 174 APP_LAUNCH_NTP_RECENTLY_CLOSED, 175 176 // App link clicked from bookmark bar. 177 APP_LAUNCH_BOOKMARK_BAR, 178 179 // Nvigated to an app from within a web page (like by clicking a link). 180 APP_LAUNCH_CONTENT_NAVIGATION, 181 182 // Launch from session restore. 183 APP_LAUNCH_SESSION_RESTORE, 184 185 // Autolaunched at startup, like for pinned tabs. 186 APP_LAUNCH_AUTOLAUNCH, 187 188 // Launched from omnibox app links. 189 APP_LAUNCH_OMNIBOX_APP, 190 191 // App URL typed directly into the omnibox (w/ instant turned off). 192 APP_LAUNCH_OMNIBOX_LOCATION, 193 194 // Navigate to an app URL via instant. 195 APP_LAUNCH_OMNIBOX_INSTANT, 196 197 // Launch via chrome.management.launchApp. 198 APP_LAUNCH_EXTENSION_API, 199 200 // Launch an app via a shortcut. This includes using the --app or --app-id 201 // command line arguments, or via an app shim process on Mac. 202 APP_LAUNCH_CMD_LINE_APP, 203 204 // App launch by passing the URL on the cmd line (not using app switches). 205 APP_LAUNCH_CMD_LINE_URL, 206 207 // User clicked web store launcher on NTP. 208 APP_LAUNCH_NTP_WEBSTORE, 209 210 // App launched after the user re-enabled it on the NTP. 211 APP_LAUNCH_NTP_APP_RE_ENABLE, 212 213 // URL launched using the --app cmd line option, but the URL does not 214 // correspond to an installed app. These launches are left over from a 215 // feature that let you make desktop shortcuts from the file menu. 216 APP_LAUNCH_CMD_LINE_APP_LEGACY, 217 218 // User clicked web store link on the NTP footer. 219 APP_LAUNCH_NTP_WEBSTORE_FOOTER, 220 221 // User clicked [+] icon in apps page. 222 APP_LAUNCH_NTP_WEBSTORE_PLUS_ICON, 223 224 // User clicked icon in app launcher main view. 225 APP_LAUNCH_APP_LIST_MAIN, 226 227 // User clicked app launcher search result. 228 APP_LAUNCH_APP_LIST_SEARCH, 229 230 // User clicked the chrome app icon from the app launcher's main view. 231 APP_LAUNCH_APP_LIST_MAIN_CHROME, 232 233 // User clicked the webstore icon from the app launcher's main view. 234 APP_LAUNCH_APP_LIST_MAIN_WEBSTORE, 235 236 // User clicked the chrome app icon from the app launcher's search view. 237 APP_LAUNCH_APP_LIST_SEARCH_CHROME, 238 239 // User clicked the webstore icon from the app launcher's search view. 240 APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE, 241 242 APP_LAUNCH_BUCKET_BOUNDARY, 243 APP_LAUNCH_BUCKET_INVALID 244 }; 245 246 // The extension id of the ChromeVox extension. 247 extern const char kChromeVoxExtensionId[]; 248 249 #if defined(OS_CHROMEOS) 250 // Path to preinstalled ChromeVox screen reader extension (relative to 251 // |chrome::DIR_RESOURCES|). 252 extern const char kChromeVoxExtensionPath[]; 253 // Path to preinstalled Connectivity Diagnostics extension. 254 extern const char kConnectivityDiagnosticsPath[]; 255 extern const char kConnectivityDiagnosticsLauncherPath[]; 256 // Path to preinstalled speech synthesis extension. 257 extern const char kSpeechSynthesisExtensionPath[]; 258 // The extension id of the speech synthesis extension. 259 extern const char kSpeechSynthesisExtensionId[]; 260 // The extension id of the wallpaper manager application. 261 extern const char kWallpaperManagerId[]; 262 // The extension id of the first run dialog application. 263 extern const char kFirstRunDialogId[]; 264 #endif 265 266 // What causes an extension to be installed? Used in histograms, so don't 267 // change existing values. 268 enum CrxInstallCause { 269 INSTALL_CAUSE_UNSET = 0, 270 INSTALL_CAUSE_USER_DOWNLOAD, 271 INSTALL_CAUSE_UPDATE, 272 INSTALL_CAUSE_EXTERNAL_FILE, 273 INSTALL_CAUSE_AUTOMATION, 274 NUM_INSTALL_CAUSES 275 }; 276 277 // The states that an app can be in, as reported by chrome.app.installState 278 // and chrome.app.runningState. 279 extern const char kAppStateNotInstalled[]; 280 extern const char kAppStateInstalled[]; 281 extern const char kAppStateDisabled[]; 282 extern const char kAppStateRunning[]; 283 extern const char kAppStateCannotRun[]; 284 extern const char kAppStateReadyToRun[]; 285 286 // The path part of the file system url used for media file systems. 287 extern const char kMediaFileSystemPathPart[]; 288 289 // NOTE: If you change this list, you should also change kExtensionIconSizes 290 // in cc file. 291 enum ExtensionIcons { 292 EXTENSION_ICON_GIGANTOR = 512, 293 EXTENSION_ICON_EXTRA_LARGE = 256, 294 EXTENSION_ICON_LARGE = 128, 295 EXTENSION_ICON_MEDIUM = 48, 296 EXTENSION_ICON_SMALL = 32, 297 EXTENSION_ICON_SMALLISH = 24, 298 EXTENSION_ICON_ACTION = 19, 299 EXTENSION_ICON_BITTY = 16, 300 EXTENSION_ICON_INVALID = 0, 301 }; 302 303 // List of sizes for extension icons that can be defined in the manifest. 304 extern const int kExtensionIconSizes[]; 305 extern const size_t kNumExtensionIconSizes; 306 307 // List of sizes for extension icons that can be defined in the manifest. 308 extern const int kExtensionActionIconSizes[]; 309 extern const size_t kNumExtensionActionIconSizes; 310 311 // List of sizes for extension icons that can be defined in the manifest. 312 extern const int kScriptBadgeIconSizes[]; 313 extern const size_t kNumScriptBadgeIconSizes; 314 } // namespace extension_misc 315 316 namespace extensions { 317 // This enum is used for the launch type the user wants to use for an 318 // application. 319 // Do not remove items or re-order this enum as it is used in preferences 320 // and histograms. 321 enum LaunchType { 322 LAUNCH_TYPE_PINNED, 323 LAUNCH_TYPE_REGULAR, 324 LAUNCH_TYPE_FULLSCREEN, 325 LAUNCH_TYPE_WINDOW, 326 327 // Launch an app in the in the way a click on the NTP would, 328 // if no user pref were set. Update this constant to change 329 // the default for the NTP and chrome.management.launchApp(). 330 LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR 331 }; 332 333 // Don't remove items or change the order of this enum. It's used in 334 // histograms and preferences. 335 enum LaunchContainer { 336 LAUNCH_CONTAINER_WINDOW, 337 LAUNCH_CONTAINER_PANEL, 338 LAUNCH_CONTAINER_TAB, 339 // For platform apps, which don't actually have a container (they just get a 340 // "onLaunched" event). 341 LAUNCH_CONTAINER_NONE 342 }; 343 } // namespace extensions 344 345 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_ 346