constants.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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. #ifndef EXTENSIONS_COMMON_CONSTANTS_H_
  5. #define EXTENSIONS_COMMON_CONSTANTS_H_
  6. #include "base/files/file_path.h"
  7. #include "base/strings/string_piece_forward.h"
  8. #include "build/chromeos_buildflags.h"
  9. #include "extensions/common/extensions_export.h"
  10. namespace extensions {
  11. // Scheme we serve extension content from.
  12. EXTENSIONS_EXPORT extern const char kExtensionScheme[];
  13. // The name of the manifest inside an extension.
  14. EXTENSIONS_EXPORT extern const base::FilePath::CharType kManifestFilename[];
  15. // The name of the differential fingerprint file inside an extension.
  16. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  17. kDifferentialFingerprintFilename[];
  18. // The name of locale folder inside an extension.
  19. EXTENSIONS_EXPORT extern const base::FilePath::CharType kLocaleFolder[];
  20. // The name of the messages file inside an extension.
  21. EXTENSIONS_EXPORT extern const base::FilePath::CharType kMessagesFilename[];
  22. // The name of the gzipped messages file inside an extension.
  23. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  24. kGzippedMessagesFilename[];
  25. // The base directory for subdirectories with platform-specific code.
  26. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  27. kPlatformSpecificFolder[];
  28. // A directory reserved for metadata, generated either by the webstore
  29. // or chrome.
  30. EXTENSIONS_EXPORT extern const base::FilePath::CharType kMetadataFolder[];
  31. // Name of the verified contents file within the metadata folder.
  32. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  33. kVerifiedContentsFilename[];
  34. // Name of the computed hashes file within the metadata folder.
  35. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  36. kComputedHashesFilename[];
  37. // Name of the indexed ruleset directory for the Declarative Net Request API.
  38. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  39. kIndexedRulesetDirectory[];
  40. // The name of the directory inside the profile where extensions are
  41. // installed to.
  42. EXTENSIONS_EXPORT extern const char kInstallDirectoryName[];
  43. // The name of a temporary directory to install an extension into for
  44. // validation before finalizing install.
  45. EXTENSIONS_EXPORT extern const char kTempExtensionName[];
  46. // The file to write our decoded message catalogs to, relative to the
  47. // extension_path.
  48. EXTENSIONS_EXPORT extern const char kDecodedMessageCatalogsFilename[];
  49. // The filename to use for a background page generated from
  50. // background.scripts.
  51. EXTENSIONS_EXPORT extern const char kGeneratedBackgroundPageFilename[];
  52. // The URL piece between the extension ID and favicon URL.
  53. EXTENSIONS_EXPORT extern const char kFaviconSourcePath[];
  54. // Path to imported modules.
  55. EXTENSIONS_EXPORT extern const char kModulesDir[];
  56. // The file extension (.crx) for extensions.
  57. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  58. kExtensionFileExtension[];
  59. // The file extension (.pem) for private key files.
  60. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  61. kExtensionKeyFileExtension[];
  62. // Default frequency for auto updates, if turned on.
  63. EXTENSIONS_EXPORT extern const int kDefaultUpdateFrequencySeconds;
  64. // The name of the directory inside the profile where per-app local settings
  65. // are stored.
  66. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  67. kLocalAppSettingsDirectoryName[];
  68. // The name of the directory inside the profile where per-extension local
  69. // settings are stored.
  70. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  71. kLocalExtensionSettingsDirectoryName[];
  72. // The name of the directory inside the profile where per-app synced settings
  73. // are stored.
  74. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  75. kSyncAppSettingsDirectoryName[];
  76. // The name of the directory inside the profile where per-extension synced
  77. // settings are stored.
  78. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  79. kSyncExtensionSettingsDirectoryName[];
  80. // The name of the directory inside the profile where per-extension persistent
  81. // managed settings are stored.
  82. EXTENSIONS_EXPORT extern const base::FilePath::CharType
  83. kManagedSettingsDirectoryName[];
  84. // The name of the database inside the profile where chrome-internal
  85. // extension state resides.
  86. EXTENSIONS_EXPORT extern const base::FilePath::CharType kStateStoreName[];
  87. // The name of the database inside the profile where declarative extension
  88. // rules are stored.
  89. EXTENSIONS_EXPORT extern const base::FilePath::CharType kRulesStoreName[];
  90. // The name of the database inside the profile where persistent dynamic user
  91. // script metadata is stored.
  92. EXTENSIONS_EXPORT extern const base::FilePath::CharType kScriptsStoreName[];
  93. // Statistics are logged to UMA with these strings as part of histogram name.
  94. // They can all be found under Extensions.Database.Open.<client>. Changing this
  95. // needs to synchronize with histograms.xml, AND will also become incompatible
  96. // with older browsers still reporting the previous values.
  97. EXTENSIONS_EXPORT extern const char kSettingsDatabaseUMAClientName[];
  98. EXTENSIONS_EXPORT extern const char kRulesDatabaseUMAClientName[];
  99. EXTENSIONS_EXPORT extern const char kStateDatabaseUMAClientName[];
  100. EXTENSIONS_EXPORT extern const char kScriptsDatabaseUMAClientName[];
  101. // The URL query parameter key corresponding to multi-login user index.
  102. EXTENSIONS_EXPORT extern const char kAuthUserQueryKey[];
  103. // Mime type strings
  104. EXTENSIONS_EXPORT extern const char kMimeTypeJpeg[];
  105. EXTENSIONS_EXPORT extern const char kMimeTypePng[];
  106. // The extension id of the Web Store component application.
  107. EXTENSIONS_EXPORT extern const char kWebStoreAppId[];
  108. // The key used for signing some pieces of data from the webstore.
  109. EXTENSIONS_EXPORT extern const uint8_t kWebstoreSignaturesPublicKey[];
  110. EXTENSIONS_EXPORT extern const size_t kWebstoreSignaturesPublicKeySize;
  111. // A preference for storing the extension's update URL data.
  112. EXTENSIONS_EXPORT extern const char kUpdateURLData[];
  113. // Thread identifier for the main renderer thread (as opposed to a service
  114. // worker thread).
  115. // This is the default thread id used for extension event listeners registered
  116. // from a non-service worker context
  117. EXTENSIONS_EXPORT extern const int kMainThreadId;
  118. // Enumeration of possible app launch sources.
  119. // This should be kept in sync with LaunchSource in
  120. // extensions/common/api/app_runtime.idl, and GetLaunchSourceEnum() in
  121. // extensions/browser/api/app_runtime/app_runtime_api.cc.
  122. // Note the enumeration is used in UMA histogram so entries
  123. // should not be re-ordered or removed.
  124. enum class AppLaunchSource {
  125. kSourceNone = 0,
  126. kSourceUntracked = 1,
  127. kSourceAppLauncher = 2,
  128. kSourceNewTabPage = 3,
  129. kSourceReload = 4,
  130. kSourceRestart = 5,
  131. kSourceLoadAndLaunch = 6,
  132. kSourceCommandLine = 7,
  133. kSourceFileHandler = 8,
  134. kSourceUrlHandler = 9,
  135. kSourceSystemTray = 10,
  136. kSourceAboutPage = 11,
  137. kSourceKeyboard = 12,
  138. kSourceExtensionsPage = 13,
  139. kSourceManagementApi = 14,
  140. kSourceEphemeralAppDeprecated = 15,
  141. kSourceBackground = 16,
  142. kSourceKiosk = 17,
  143. kSourceChromeInternal = 18,
  144. kSourceTest = 19,
  145. kSourceInstalledNotification = 20,
  146. kSourceContextMenu = 21,
  147. kSourceArc = 22,
  148. kSourceIntentUrl = 23, // App launch triggered by a URL.
  149. kSourceRunOnOsLogin = 24, // App launched during OS login.
  150. kSourceProtocolHandler = 25, // App launch via protocol handler.
  151. kSourceReparenting = 26, // APP launch via reparenting.
  152. // Add any new values above this one, and update kMaxValue to the highest
  153. // enumerator value.
  154. kMaxValue = kSourceReparenting,
  155. };
  156. // This enum is used for the launch type the user wants to use for an
  157. // application.
  158. // Do not remove items or re-order this enum as it is used in preferences
  159. // and histograms.
  160. enum LaunchType {
  161. LAUNCH_TYPE_INVALID = -1,
  162. LAUNCH_TYPE_FIRST = 0,
  163. LAUNCH_TYPE_PINNED = LAUNCH_TYPE_FIRST,
  164. LAUNCH_TYPE_REGULAR = 1,
  165. LAUNCH_TYPE_FULLSCREEN = 2,
  166. LAUNCH_TYPE_WINDOW = 3,
  167. NUM_LAUNCH_TYPES,
  168. // Launch an app in the in the way a click on the NTP would,
  169. // if no user pref were set. Update this constant to change
  170. // the default for the NTP and chrome.management.launchApp().
  171. LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
  172. };
  173. } // namespace extensions
  174. namespace extension_misc {
  175. // Matches chrome.tabs.TAB_ID_NONE.
  176. EXTENSIONS_EXPORT extern const int kUnknownTabId;
  177. // Matches chrome.windows.WINDOW_ID_NONE.
  178. EXTENSIONS_EXPORT extern const int kUnknownWindowId;
  179. // Matches chrome.windows.WINDOW_ID_CURRENT.
  180. EXTENSIONS_EXPORT extern const int kCurrentWindowId;
  181. using ExtensionIcons = int;
  182. constexpr ExtensionIcons EXTENSION_ICON_GIGANTOR = 512;
  183. constexpr ExtensionIcons EXTENSION_ICON_EXTRA_LARGE = 256;
  184. constexpr ExtensionIcons EXTENSION_ICON_LARGE = 128;
  185. constexpr ExtensionIcons EXTENSION_ICON_MEDIUM = 48;
  186. constexpr ExtensionIcons EXTENSION_ICON_SMALL = 32;
  187. constexpr ExtensionIcons EXTENSION_ICON_SMALLISH = 24;
  188. constexpr ExtensionIcons EXTENSION_ICON_BITTY = 16;
  189. constexpr ExtensionIcons EXTENSION_ICON_INVALID = 0;
  190. // The extension id of the ChromeVox extension.
  191. EXTENSIONS_EXPORT extern const char kChromeVoxExtensionId[];
  192. // The extension id of the PDF extension.
  193. EXTENSIONS_EXPORT extern const char kPdfExtensionId[];
  194. // The extension id of the Office Viewer component extension.
  195. EXTENSIONS_EXPORT extern const char kQuickOfficeComponentExtensionId[];
  196. // The extension id of the Office Viewer extension on the internal webstore.
  197. EXTENSIONS_EXPORT extern const char kQuickOfficeInternalExtensionId[];
  198. // The extension id of the Office Viewer extension.
  199. EXTENSIONS_EXPORT extern const char kQuickOfficeExtensionId[];
  200. // The extension id used for testing mimeHandlerPrivate.
  201. EXTENSIONS_EXPORT extern const char kMimeHandlerPrivateTestExtensionId[];
  202. // The extension id of the Files Manager application.
  203. EXTENSIONS_EXPORT extern const char kFilesManagerAppId[];
  204. // The extension id of the Calculator application.
  205. EXTENSIONS_EXPORT extern const char kCalculatorAppId[];
  206. // The extension id of the demo Calendar application.
  207. EXTENSIONS_EXPORT extern const char kCalendarDemoAppId[];
  208. // The extension id of the GMail application.
  209. EXTENSIONS_EXPORT extern const char kGmailAppId[];
  210. // The extension id of the demo Google Docs application.
  211. EXTENSIONS_EXPORT extern const char kGoogleDocsDemoAppId[];
  212. // The extension id of the Google Docs PWA.
  213. EXTENSIONS_EXPORT extern const char kGoogleDocsPwaAppId[];
  214. // The extension id of the Google Drive application.
  215. EXTENSIONS_EXPORT extern const char kGoogleDriveAppId[];
  216. // The extension id of the Google Meet PWA.
  217. EXTENSIONS_EXPORT extern const char kGoogleMeetPwaAppId[];
  218. // The extension id of the demo Google Sheets application.
  219. EXTENSIONS_EXPORT extern const char kGoogleSheetsDemoAppId[];
  220. // The extension id of the Google Sheets PWA.
  221. EXTENSIONS_EXPORT extern const char kGoogleSheetsPwaAppId[];
  222. // The extension id of the demo Google Slides application.
  223. EXTENSIONS_EXPORT extern const char kGoogleSlidesDemoAppId[];
  224. // The extension id of the Google Keep application.
  225. EXTENSIONS_EXPORT extern const char kGoogleKeepAppId[];
  226. // The extension id of the Youtube application.
  227. EXTENSIONS_EXPORT extern const char kYoutubeAppId[];
  228. // The extension id of the Youtube PWA.
  229. EXTENSIONS_EXPORT extern const char kYoutubePwaAppId[];
  230. // The extension id of the Spotify PWA.
  231. EXTENSIONS_EXPORT extern const char kSpotifyAppId[];
  232. // The extension id of the BeFunky PWA.
  233. EXTENSIONS_EXPORT extern const char kBeFunkyAppId[];
  234. // The extension id of the Clipchamp PWA.
  235. EXTENSIONS_EXPORT extern const char kClipchampAppId[];
  236. // The extension id of the GeForce NOW PWA.
  237. EXTENSIONS_EXPORT extern const char kGeForceNowAppId[];
  238. // The extension id of the Zoom PWA.
  239. EXTENSIONS_EXPORT extern const char kZoomAppId[];
  240. // The extension id of the Sumo PWA.
  241. EXTENSIONS_EXPORT extern const char kSumoAppId[];
  242. // The extension id of the Sumo PWA.
  243. EXTENSIONS_EXPORT extern const char kAdobeSparkAppId[];
  244. // The extension id of the Google Docs application.
  245. EXTENSIONS_EXPORT extern const char kGoogleDocsAppId[];
  246. // The extension id of the Google Sheets application.
  247. EXTENSIONS_EXPORT extern const char kGoogleSheetsAppId[];
  248. // The extension id of the Google Slides application.
  249. EXTENSIONS_EXPORT extern const char kGoogleSlidesAppId[];
  250. #if BUILDFLAG(IS_CHROMEOS_ASH)
  251. // The extension id of the default Demo Mode Highlights app.
  252. EXTENSIONS_EXPORT extern const char kHighlightsAppId[];
  253. // The extension id of the default Demo Mode screensaver app.
  254. EXTENSIONS_EXPORT extern const char kScreensaverAppId[];
  255. // The id of the testing extension allowed in the signin profile.
  256. EXTENSIONS_EXPORT extern const char kSigninProfileTestExtensionId[];
  257. // The id of the testing extension allowed in guest mode.
  258. EXTENSIONS_EXPORT extern const char kGuestModeTestExtensionId[];
  259. // The extension id of 2022 Demo Mode Highlights app.
  260. EXTENSIONS_EXPORT extern const char kNewAttractLoopAppId[];
  261. // The extension id of 2022 Demo Mode screensaver app.
  262. EXTENSIONS_EXPORT extern const char kNewHighlightsAppId[];
  263. // Returns true if this app is part of the "system UI". Generally this is UI
  264. // that that on other operating systems would be considered part of the OS,
  265. // for example the file manager.
  266. EXTENSIONS_EXPORT bool IsSystemUIApp(base::StringPiece extension_id);
  267. // Returns true if this app is one of Demo Mode Chrome Apps, including
  268. // attract loop and highlights apps.
  269. EXTENSIONS_EXPORT bool IsDemoModeChromeApp(base::StringPiece extension_id);
  270. #endif
  271. // True if the id matches any of the QuickOffice extension ids.
  272. EXTENSIONS_EXPORT bool IsQuickOfficeExtension(const std::string& id);
  273. // Returns if the app is managed by extension default apps. This is a hardcoded
  274. // list of default apps for Windows/Linux/MacOS platforms that should be
  275. // migrated from extension to web app.
  276. // TODO(https://crbug.com/1257275): remove after deault app migration is done.
  277. // This function is copied from
  278. // chrome/browser/web_applications/extension_status_utils.h.
  279. EXTENSIONS_EXPORT bool IsPreinstalledAppId(const std::string& app_id);
  280. // The extension id for the production version of Hangouts.
  281. EXTENSIONS_EXPORT extern const char kProdHangoutsExtensionId[];
  282. // Extension ids used by Hangouts.
  283. EXTENSIONS_EXPORT extern const char* const kHangoutsExtensionIds[6];
  284. // Error message when enterprise policy blocks scripting of webpage.
  285. EXTENSIONS_EXPORT extern const char kPolicyBlockedScripting[];
  286. // The default block size for hashing used in content verification.
  287. EXTENSIONS_EXPORT extern const int kContentVerificationDefaultBlockSize;
  288. // The origin of the CryptoToken component extension, which implements the
  289. // deprecated U2F Security Key API.
  290. // TODO(1224886): Delete together with CryptoToken code.
  291. EXTENSIONS_EXPORT extern const char kCryptotokenExtensionId[];
  292. // The name of the CryptoToken component extension deprecation trial, which
  293. // allows making requests to the extension after it has been default disabled.
  294. // TODO(1224886): Delete together with CryptoToken code.
  295. EXTENSIONS_EXPORT extern const char kCryptotokenDeprecationTrialName[];
  296. } // namespace extension_misc
  297. #endif // EXTENSIONS_COMMON_CONSTANTS_H_