1 // Copyright (c) 2011 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 #include "chrome/common/extensions/extension_constants.h" 6 7 namespace extension_manifest_keys { 8 9 const char* kAllFrames = "all_frames"; 10 const char* kApp = "app"; 11 const char* kBackground = "background_page"; 12 const char* kBrowserAction = "browser_action"; 13 const char* kChromeURLOverrides = "chrome_url_overrides"; 14 const char* kContentScripts = "content_scripts"; 15 const char* kConvertedFromUserScript = "converted_from_user_script"; 16 const char* kCss = "css"; 17 const char* kCurrentLocale = "current_locale"; 18 const char* kDefaultLocale = "default_locale"; 19 const char* kDescription = "description"; 20 const char* kDevToolsPage = "devtools_page"; 21 const char* kExcludeGlobs = "exclude_globs"; 22 const char* kFileFilters = "file_filters"; 23 const char* kFileBrowserHandlers = "file_browser_handlers"; 24 const char* kHomepageURL = "homepage_url"; 25 const char* kIcons = "icons"; 26 const char* kIncognito = "incognito"; 27 const char* kIncludeGlobs = "include_globs"; 28 const char* kIsolation = "app.isolation"; 29 const char* kJs = "js"; 30 const char* kLaunch = "app.launch"; 31 const char* kLaunchContainer = "app.launch.container"; 32 const char* kLaunchHeight = "app.launch.height"; 33 const char* kLaunchLocalPath = "app.launch.local_path"; 34 const char* kLaunchWebURL = "app.launch.web_url"; 35 const char* kLaunchWidth = "app.launch.width"; 36 const char* kMatches = "matches"; 37 const char* kMinimumChromeVersion = "minimum_chrome_version"; 38 const char* kName = "name"; 39 const char* kNaClModules = "nacl_modules"; 40 const char* kNaClModulesMIMEType = "mime_type"; 41 const char* kNaClModulesPath = "path"; 42 const char* kOmnibox = "omnibox"; 43 const char* kOmniboxKeyword = "omnibox.keyword"; 44 const char* kOptionsPage = "options_page"; 45 const char* kPageAction = "page_action"; 46 const char* kPageActionDefaultIcon = "default_icon"; 47 const char* kPageActionDefaultPopup = "default_popup"; 48 const char* kPageActionDefaultTitle = "default_title"; 49 const char* kPageActionIcons = "icons"; 50 const char* kPageActionId = "id"; 51 const char* kPageActionPopup = "popup"; 52 const char* kPageActionPopupHeight = "height"; 53 const char* kPageActionPopupPath = "path"; 54 const char* kPageActions = "page_actions"; 55 const char* kPermissions = "permissions"; 56 const char* kPlugins = "plugins"; 57 const char* kPluginsPath = "path"; 58 const char* kPluginsPublic = "public"; 59 const char* kPublicKey = "key"; 60 const char* kRunAt = "run_at"; 61 const char* kSidebar = "sidebar"; 62 const char* kSidebarDefaultIcon = "default_icon"; 63 const char* kSidebarDefaultPage = "default_page"; 64 const char* kSidebarDefaultTitle = "default_title"; 65 const char* kSignature = "signature"; 66 const char* kTheme = "theme"; 67 const char* kThemeColors = "colors"; 68 const char* kThemeDisplayProperties = "properties"; 69 const char* kThemeImages = "images"; 70 const char* kThemeTints = "tints"; 71 const char* kToolstripPath = "path"; 72 const char* kToolstrips = "toolstrips"; 73 const char* kTts = "tts"; 74 const char* kTtsGenderFemale = "female"; 75 const char* kTtsGenderMale = "male"; 76 const char* kTtsVoices = "voices"; 77 const char* kTtsVoicesGender = "gender"; 78 const char* kTtsVoicesLocale = "locale"; 79 const char* kTtsVoicesVoiceName = "voiceName"; 80 const char* kType = "type"; 81 const char* kUpdateURL = "update_url"; 82 const char* kVersion = "version"; 83 const char* kWebURLs = "app.urls"; 84 } // namespace extension_manifest_keys 85 86 namespace extension_manifest_values { 87 const char* kIncognitoSplit = "split"; 88 const char* kIncognitoSpanning = "spanning"; 89 const char* kIsolatedStorage = "storage"; 90 const char* kRunAtDocumentStart = "document_start"; 91 const char* kRunAtDocumentEnd = "document_end"; 92 const char* kRunAtDocumentIdle = "document_idle"; 93 const char* kPageActionTypeTab = "tab"; 94 const char* kPageActionTypePermanent = "permanent"; 95 const char* kLaunchContainerPanel = "panel"; 96 const char* kLaunchContainerTab = "tab"; 97 const char* kLaunchContainerWindow = "window"; 98 } // namespace extension_manifest_values 99 100 // Extension-related error messages. Some of these are simple patterns, where a 101 // '*' is replaced at runtime with a specific value. This is used instead of 102 // printf because we want to unit test them and scanf is hard to make 103 // cross-platform. 104 namespace extension_manifest_errors { 105 const char* kAppsNotEnabled = 106 "Apps are not enabled."; 107 const char* kBackgroundPermissionNeeded = 108 "Hosted apps that use 'background_page' must have the 'background' " 109 "permission."; 110 const char* kCannotAccessPage = 111 "Cannot access contents of url \"*\". " 112 "Extension manifest must request permission to access this host."; 113 const char* kCannotClaimAllHostsInExtent = 114 "Cannot claim all hosts ('*') in an extent."; 115 const char* kCannotClaimAllURLsInExtent = 116 "Cannot claim all URLs in an extent."; 117 const char* kCannotScriptGallery = 118 "The extensions gallery cannot be scripted."; 119 const char* kCannotUninstallManagedExtension = 120 "Attempted uninstallation of an extension that is not user-manageable."; 121 const char* kChromeVersionTooLow = 122 "This extension requires * version * or greater."; 123 const char* kDisabledByPolicy = 124 "This extension has been disabled by your administrator."; 125 const char* kDevToolsExperimental = 126 "You must request the 'experimental' permission in order to use the" 127 " DevTools API."; 128 const char* kExpectString = "Expect string value."; 129 const char* kExperimentalFlagRequired = 130 "Loading extensions with 'experimental' permission requires" 131 " --enable-experimental-extension-apis command line flag."; 132 const char *kExperimentalFeature = 133 "This feature requires 'experimental' permissions and" 134 " --enable-experimental-extension-apis command line flag."; 135 const char* kHostedAppsCannotIncludeExtensionFeatures = 136 "Hosted apps cannot use the extension feature '*'."; 137 const char* kInvalidAllFrames = 138 "Invalid value for 'content_scripts[*].all_frames'."; 139 const char* kInvalidBackground = 140 "Invalid value for 'background_page'."; 141 const char* kInvalidBackgroundInHostedApp = 142 "Invalid value for 'background_page'. Hosted apps must specify an " 143 "absolute HTTPS URL for the background page."; 144 const char* kInvalidBrowserAction = 145 "Invalid value for 'browser_action'."; 146 const char* kInvalidChromeURLOverrides = 147 "Invalid value for 'chrome_url_overrides'."; 148 const char* kInvalidContentScript = 149 "Invalid value for 'content_scripts[*]'."; 150 const char* kInvalidContentScriptsList = 151 "Invalid value for 'content_scripts'."; 152 const char* kInvalidCss = 153 "Invalid value for 'content_scripts[*].css[*]'."; 154 const char* kInvalidCssList = 155 "Required value 'content_scripts[*].css' is invalid."; 156 const char* kInvalidDefaultLocale = 157 "Invalid value for default locale - locale name must be a string."; 158 const char* kInvalidDescription = 159 "Invalid value for 'description'."; 160 const char* kInvalidDevToolsPage = 161 "Invalid value for 'devtools_page'."; 162 const char* kInvalidFileBrowserHandler = 163 "Invalid value for 'file_browser_handers'."; 164 const char* kInvalidFileFiltersList = 165 "Invalid value for 'file_filters'."; 166 const char* kInvalidFileFilterValue = 167 "Invalid value for 'file_filters[*]'."; 168 const char* kInvalidGlob = 169 "Invalid value for 'content_scripts[*].*[*]'."; 170 const char* kInvalidGlobList = 171 "Invalid value for 'content_scripts[*].*'."; 172 const char* kInvalidHomepageURL = 173 "Invalid value for homepage url: '[*]'."; 174 const char* kInvalidIconPath = 175 "Invalid value for 'icons[\"*\"]'."; 176 const char* kInvalidIcons = 177 "Invalid value for 'icons'."; 178 const char* kInvalidIncognitoBehavior = 179 "Invalid value for 'incognito'."; 180 const char* kInvalidIsolation = 181 "Invalid value for 'app.isolation'."; 182 const char* kInvalidIsolationValue = 183 "Invalid value for 'app.isolation[*]'."; 184 const char* kInvalidJs = 185 "Invalid value for 'content_scripts[*].js[*]'."; 186 const char* kInvalidJsList = 187 "Required value 'content_scripts[*].js' is invalid."; 188 const char* kInvalidKey = 189 "Value 'key' is missing or invalid."; 190 const char* kInvalidLaunchContainer = 191 "Invalid value for 'app.launch.container'."; 192 const char* kInvalidLaunchHeight = 193 "Invalid value for 'app.launch.height'."; 194 const char* kInvalidLaunchHeightContainer = 195 "Invalid container type for 'app.launch.height'."; 196 const char* kInvalidLaunchLocalPath = 197 "Invalid value for 'app.launch.local_path'."; 198 const char* kInvalidLaunchWebURL = 199 "Invalid value for 'app.launch.web_url'."; 200 const char* kInvalidLaunchWidth = 201 "Invalid value for 'app.launch.width'."; 202 const char* kInvalidLaunchWidthContainer = 203 "Invalid container type for 'app.launch.width'."; 204 const char* kInvalidManifest = 205 "Manifest file is invalid."; 206 const char* kInvalidMatch = 207 "Invalid value for 'content_scripts[*].matches[*]': *"; 208 const char* kInvalidMatchCount = 209 "Invalid value for 'content_scripts[*].matches'. There must be at least" 210 "one match specified."; 211 const char* kInvalidMatches = 212 "Required value 'content_scripts[*].matches' is missing or invalid."; 213 const char* kInvalidMinimumChromeVersion = 214 "Invalid value for 'minimum_chrome_version'."; 215 const char* kInvalidName = 216 "Required value 'name' is missing or invalid."; 217 const char* kInvalidNaClModules = 218 "Invalid value for 'nacl_modules'."; 219 const char* kInvalidNaClModulesPath = 220 "Invalid value for 'nacl_modules[*].path'."; 221 const char* kInvalidNaClModulesMIMEType = 222 "Invalid value for 'nacl_modules[*].mime_type'."; 223 const char* kInvalidOmniboxKeyword = 224 "Invalid value for 'omnibox.keyword'."; 225 const char* kInvalidOptionsPage = 226 "Invalid value for 'options_page'."; 227 const char* kInvalidOptionsPageExpectUrlInPackage = 228 "Invalid value for 'options_page'. Value must be a relative path."; 229 const char* kInvalidOptionsPageInHostedApp = 230 "Invalid value for 'options_page'. Hosted apps must specify an " 231 "absolute URL."; 232 const char* kInvalidPageAction = 233 "Invalid value for 'page_action'."; 234 const char* kInvalidPageActionDefaultTitle = 235 "Invalid value for 'default_title'."; 236 const char* kInvalidPageActionIconPath = 237 "Invalid value for 'page_action.default_icon'."; 238 const char* kInvalidPageActionId = 239 "Required value 'id' is missing or invalid."; 240 const char* kInvalidPageActionName = 241 "Invalid value for 'page_action.name'."; 242 const char* kInvalidPageActionOldAndNewKeys = 243 "Key \"*\" is deprecated. Key \"*\" has the same meaning. You can not " 244 "use both."; 245 const char* kInvalidPageActionPopup = 246 "Invalid type for page action popup."; 247 const char* kInvalidPageActionPopupHeight = 248 "Invalid value for page action popup height [*]."; 249 const char* kInvalidPageActionPopupPath = 250 "Invalid value for page action popup path [*]."; 251 const char* kInvalidPageActionsList = 252 "Invalid value for 'page_actions'."; 253 const char* kInvalidPageActionsListSize = 254 "Invalid value for 'page_actions'. There can be at most one page action."; 255 const char* kInvalidPageActionTypeValue = 256 "Invalid value for 'page_actions[*].type', expected 'tab' or 'permanent'."; 257 const char* kInvalidPermission = 258 "Invalid value for 'permissions[*]'."; 259 const char* kInvalidPermissions = 260 "Required value 'permissions' is missing or invalid."; 261 const char* kInvalidPermissionScheme = 262 "Invalid scheme for 'permissions[*]'."; 263 const char* kInvalidPlugins = 264 "Invalid value for 'plugins'."; 265 const char* kInvalidPluginsPath = 266 "Invalid value for 'plugins[*].path'."; 267 const char* kInvalidPluginsPublic = 268 "Invalid value for 'plugins[*].public'."; 269 const char* kInvalidRunAt = 270 "Invalid value for 'content_scripts[*].run_at'."; 271 const char* kInvalidSidebar = 272 "Invalid value for 'sidebar'."; 273 const char* kInvalidSidebarDefaultIconPath = 274 "Invalid value for 'sidebar.default_icon'."; 275 const char* kInvalidSidebarDefaultPage = 276 "Invalid value for 'sidebar.default_page'."; 277 const char* kInvalidSidebarDefaultTitle = 278 "Invalid value for 'sidebar.default_title'."; 279 const char* kInvalidSignature = 280 "Value 'signature' is missing or invalid."; 281 const char* kInvalidTheme = 282 "Invalid value for 'theme'."; 283 const char* kInvalidThemeColors = 284 "Invalid value for theme colors - colors must be integers"; 285 const char* kInvalidThemeImages = 286 "Invalid value for theme images - images must be strings."; 287 const char* kInvalidThemeImagesMissing = 288 "An image specified in the theme is missing."; 289 const char* kInvalidThemeTints = 290 "Invalid value for theme images - tints must be decimal numbers."; 291 const char* kInvalidToolstrip = 292 "Invalid value for 'toolstrips[*]'"; 293 const char* kInvalidToolstrips = 294 "Invalid value for 'toolstrips'."; 295 const char* kInvalidTts = 296 "Invalid value for 'tts'."; 297 const char* kInvalidTtsVoices = 298 "Invalid value for 'tts.voices'."; 299 const char* kInvalidTtsVoicesGender = 300 "Invalid value for 'tts.voices[*].gender'."; 301 const char* kInvalidTtsVoicesLocale = 302 "Invalid value for 'tts.voices[*].locale'."; 303 const char* kInvalidTtsVoicesVoiceName = 304 "Invalid value for 'tts.voices[*].voiceName'."; 305 const char* kInvalidUpdateURL = 306 "Invalid value for update url: '[*]'."; 307 const char* kInvalidURLPatternError = 308 "Invalid url pattern '*'"; 309 const char* kInvalidVersion = 310 "Required value 'version' is missing or invalid. It must be between 1-4 " 311 "dot-separated integers each between 0 and 65536."; 312 const char* kInvalidWebURL = 313 "Invalid value for 'app.urls[*]': *"; 314 const char* kInvalidWebURLs = 315 "Invalid value for 'app.urls'."; 316 const char* kInvalidZipHash = 317 "Required key 'zip_hash' is missing or invalid."; 318 const char* kLaunchPathAndURLAreExclusive = 319 "The 'app.launch.local_path' and 'launch.web_url' keys cannot both be set."; 320 const char* kLaunchURLRequired = 321 "Either 'app.launch.local_path' or 'app.launch.web_url' is required."; 322 const char* kLocalesMessagesFileMissing = 323 "Messages file is missing for locale."; 324 const char* kLocalesNoDefaultLocaleSpecified = 325 "Localization used, but default_locale wasn't specified in the manifest."; 326 const char* kLocalesNoDefaultMessages = 327 "Default locale is defined but default data couldn't be loaded."; 328 const char* kLocalesNoValidLocaleNamesListed = 329 "No valid locale name could be found in _locales directory."; 330 const char* kLocalesTreeMissing = 331 "Default locale was specified, but _locales subtree is missing."; 332 const char* kManifestParseError = 333 "Manifest is not valid JSON."; 334 const char* kManifestUnreadable = 335 "Manifest file is missing or unreadable."; 336 const char* kMissingFile = 337 "At least one js or css file is required for 'content_scripts[*]'."; 338 const char* kMultipleOverrides = 339 "An extension cannot override more than one page."; 340 const char* kNoWildCardsInPaths = 341 "Wildcards are not allowed in extent URL pattern paths."; 342 const char* kOneUISurfaceOnly = 343 "Only one of 'browser_action', 'page_action', and 'app' can be specified."; 344 const char* kReservedMessageFound = 345 "Reserved key * found in message catalog."; 346 const char* kSidebarExperimental = 347 "You must request the 'experimental' permission in order to use the" 348 " Sidebar API."; 349 const char* kThemesCannotContainExtensions = 350 "A theme cannot contain extensions code."; 351 #if defined(OS_CHROMEOS) 352 const char* kIllegalPlugins = 353 "Extensions cannot install plugins on Chrome OS"; 354 #endif 355 } // namespace extension_manifest_errors 356 357 namespace extension_urls { 358 const char* kGalleryBrowsePrefix = "https://chrome.google.com/webstore"; 359 const char* kMiniGalleryBrowsePrefix = "https://tools.google.com/chrome/"; 360 const char* kMiniGalleryDownloadPrefix = "https://dl-ssl.google.com/chrome/"; 361 } 362 363 namespace extension_filenames { 364 const char* kTempExtensionName = "CRX_INSTALL"; 365 366 // The file to write our decoded images to, relative to the extension_path. 367 const char* kDecodedImagesFilename = "DECODED_IMAGES"; 368 369 // The file to write our decoded message catalogs to, relative to the 370 // extension_path. 371 const char* kDecodedMessageCatalogsFilename = "DECODED_MESSAGE_CATALOGS"; 372 } 373 374 namespace extension_misc { 375 const char* kBookmarkManagerId = "eemcgdkfndhakfknompkggombfjjjeno"; 376 const char* kWebStoreAppId = "ahfgeienlihckogmohjhadlkjgocpleb"; 377 const char* kAppsPromoHistogram = "Extensions.AppsPromo"; 378 const char* kAppLaunchHistogram = "Extensions.AppLaunch"; 379 #if defined(OS_CHROMEOS) 380 const char* kAccessExtensionPath = 381 "/usr/share/chromeos-assets/accessibility/extensions"; 382 #endif 383 } 384