• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
7 #pragma once
8 
9 #include "base/basictypes.h"
10 
11 // Keys used in JSON representation of extensions.
12 namespace extension_manifest_keys {
13   extern const char* kAllFrames;
14   extern const char* kApp;
15   extern const char* kBackground;
16   extern const char* kBrowserAction;
17   extern const char* kBrowseURLs;
18   extern const char* kChromeURLOverrides;
19   extern const char* kContentScripts;
20   extern const char* kConvertedFromUserScript;
21   extern const char* kCss;
22   extern const char* kCurrentLocale;
23   extern const char* kDefaultLocale;
24   extern const char* kDescription;
25   extern const char* kDevToolsPage;
26   extern const char* kExcludeGlobs;
27   extern const char* kFileFilters;
28   extern const char* kFileBrowserHandlers;
29   extern const char* kHomepageURL;
30   extern const char* kIcons;
31   extern const char* kIncognito;
32   extern const char* kIncludeGlobs;
33   extern const char* kIsolation;
34   extern const char* kJs;
35   extern const char* kLaunch;
36   extern const char* kLaunchContainer;
37   extern const char* kLaunchHeight;
38   extern const char* kLaunchLocalPath;
39   extern const char* kLaunchWebURL;
40   extern const char* kLaunchWidth;
41   extern const char* kMatches;
42   extern const char* kMinimumChromeVersion;
43   extern const char* kNaClModules;
44   extern const char* kNaClModulesMIMEType;
45   extern const char* kNaClModulesPath;
46   extern const char* kName;
47   extern const char* kOmnibox;
48   extern const char* kOmniboxKeyword;
49   extern const char* kOptionsPage;
50   extern const char* kPageAction;
51   extern const char* kPageActionDefaultIcon;
52   extern const char* kPageActionDefaultPopup;
53   extern const char* kPageActionDefaultTitle;
54   extern const char* kPageActionIcons;
55   extern const char* kPageActionId;
56   extern const char* kPageActionPopup;
57   extern const char* kPageActionPopupHeight;
58   extern const char* kPageActionPopupPath;
59   extern const char* kPageActions;
60   extern const char* kPermissions;
61   extern const char* kPlugins;
62   extern const char* kPluginsPath;
63   extern const char* kPluginsPublic;
64   extern const char* kPublicKey;
65   extern const char* kRunAt;
66   extern const char* kSidebar;
67   extern const char* kSidebarDefaultIcon;
68   extern const char* kSidebarDefaultPage;
69   extern const char* kSidebarDefaultTitle;
70   extern const char* kSignature;
71   extern const char* kTheme;
72   extern const char* kThemeColors;
73   extern const char* kThemeDisplayProperties;
74   extern const char* kThemeImages;
75   extern const char* kThemeTints;
76   extern const char* kToolstripPath;
77   extern const char* kToolstrips;
78   extern const char* kTts;
79   extern const char* kTtsGenderFemale;
80   extern const char* kTtsGenderMale;
81   extern const char* kTtsVoices;
82   extern const char* kTtsVoicesGender;
83   extern const char* kTtsVoicesLocale;
84   extern const char* kTtsVoicesVoiceName;
85   extern const char* kType;
86   extern const char* kUpdateURL;
87   extern const char* kVersion;
88   extern const char* kWebURLs;
89 }  // namespace extension_manifest_keys
90 
91 // Some values expected in manifests.
92 namespace extension_manifest_values {
93   extern const char* kIncognitoSplit;
94   extern const char* kIncognitoSpanning;
95   extern const char* kIsolatedStorage;
96   extern const char* kLaunchContainerPanel;
97   extern const char* kLaunchContainerTab;
98   extern const char* kLaunchContainerWindow;
99   extern const char* kPageActionTypePermanent;
100   extern const char* kPageActionTypeTab;
101   extern const char* kRunAtDocumentEnd;
102   extern const char* kRunAtDocumentIdle;
103   extern const char* kRunAtDocumentStart;
104 }  // namespace extension_manifest_values
105 
106 // Error messages returned from Extension::InitFromValue().
107 namespace extension_manifest_errors {
108   extern const char* kAppsNotEnabled;
109   extern const char* kBackgroundPermissionNeeded;
110   extern const char* kCannotAccessPage;
111   extern const char* kCannotClaimAllHostsInExtent;
112   extern const char* kCannotClaimAllURLsInExtent;
113   extern const char* kCannotScriptGallery;
114   extern const char* kCannotUninstallManagedExtension;
115   extern const char* kChromeVersionTooLow;
116   extern const char* kDevToolsExperimental;
117   extern const char* kDisabledByPolicy;
118   extern const char* kExperimentalFlagRequired;
119   extern const char* kExperimentalFeature;
120   extern const char* kExpectString;
121   extern const char* kHostedAppsCannotIncludeExtensionFeatures;
122   extern const char* kInvalidAllFrames;
123   extern const char* kInvalidBackground;
124   extern const char* kInvalidBackgroundInHostedApp;
125   extern const char* kInvalidBrowserAction;
126   extern const char* kInvalidBrowseURL;
127   extern const char* kInvalidBrowseURLs;
128   extern const char* kInvalidChromeURLOverrides;
129   extern const char* kInvalidContentScript;
130   extern const char* kInvalidContentScriptsList;
131   extern const char* kInvalidCss;
132   extern const char* kInvalidCssList;
133   extern const char* kInvalidDefaultLocale;
134   extern const char* kInvalidDescription;
135   extern const char* kInvalidDevToolsPage;
136   extern const char* kInvalidFileBrowserHandler;
137   extern const char* kInvalidFileFiltersList;
138   extern const char* kInvalidFileFilterValue;
139   extern const char* kInvalidGlob;
140   extern const char* kInvalidGlobList;
141   extern const char* kInvalidHomepageURL;
142   extern const char* kInvalidIconPath;
143   extern const char* kInvalidIcons;
144   extern const char* kInvalidIncognitoBehavior;
145   extern const char* kInvalidIsolation;
146   extern const char* kInvalidIsolationValue;
147   extern const char* kInvalidJs;
148   extern const char* kInvalidJsList;
149   extern const char* kInvalidKey;
150   extern const char* kInvalidLaunchContainer;
151   extern const char* kInvalidLaunchHeight;
152   extern const char* kInvalidLaunchHeightContainer;
153   extern const char* kInvalidLaunchLocalPath;
154   extern const char* kInvalidLaunchWebURL;
155   extern const char* kInvalidLaunchWidth;
156   extern const char* kInvalidLaunchWidthContainer;
157   extern const char* kInvalidManifest;
158   extern const char* kInvalidMatch;
159   extern const char* kInvalidMatchCount;
160   extern const char* kInvalidMatches;
161   extern const char* kInvalidMinimumChromeVersion;
162   extern const char* kInvalidNaClModules;
163   extern const char* kInvalidNaClModulesMIMEType;
164   extern const char* kInvalidNaClModulesPath;
165   extern const char* kInvalidName;
166   extern const char* kInvalidOmniboxKeyword;
167   extern const char* kInvalidOptionsPage;
168   extern const char* kInvalidOptionsPageExpectUrlInPackage;
169   extern const char* kInvalidOptionsPageInHostedApp;
170   extern const char* kInvalidPageAction;
171   extern const char* kInvalidPageActionDefaultTitle;
172   extern const char* kInvalidPageActionIconPath;
173   extern const char* kInvalidPageActionId;
174   extern const char* kInvalidPageActionName;
175   extern const char* kInvalidPageActionOldAndNewKeys;
176   extern const char* kInvalidPageActionPopup;
177   extern const char* kInvalidPageActionPopupHeight;
178   extern const char* kInvalidPageActionPopupPath;
179   extern const char* kInvalidPageActionsList;
180   extern const char* kInvalidPageActionsListSize;
181   extern const char* kInvalidPageActionTypeValue;
182   extern const char* kInvalidPermission;
183   extern const char* kInvalidPermissions;
184   extern const char* kInvalidPermissionScheme;
185   extern const char* kInvalidPlugins;
186   extern const char* kInvalidPluginsPath;
187   extern const char* kInvalidPluginsPublic;
188   extern const char* kInvalidRunAt;
189   extern const char* kInvalidSidebar;
190   extern const char* kInvalidSidebarDefaultIconPath;
191   extern const char* kInvalidSidebarDefaultPage;
192   extern const char* kInvalidSidebarDefaultTitle;
193   extern const char* kInvalidSignature;
194   extern const char* kInvalidTheme;
195   extern const char* kInvalidThemeColors;
196   extern const char* kInvalidThemeImages;
197   extern const char* kInvalidThemeImagesMissing;
198   extern const char* kInvalidThemeTints;
199   extern const char* kInvalidToolstrip;
200   extern const char* kInvalidToolstrips;
201   extern const char* kInvalidTts;
202   extern const char* kInvalidTtsVoices;
203   extern const char* kInvalidTtsVoicesGender;
204   extern const char* kInvalidTtsVoicesLocale;
205   extern const char* kInvalidTtsVoicesVoiceName;
206   extern const char* kInvalidUpdateURL;
207   extern const char* kInvalidURLPatternError;
208   extern const char* kInvalidVersion;
209   extern const char* kInvalidWebURL;
210   extern const char* kInvalidWebURLs;
211   extern const char* kInvalidZipHash;
212   extern const char* kLaunchPathAndURLAreExclusive;
213   extern const char* kLaunchURLRequired;
214   extern const char* kLocalesMessagesFileMissing;
215   extern const char* kLocalesNoDefaultLocaleSpecified;
216   extern const char* kLocalesNoDefaultMessages;
217   extern const char* kLocalesNoValidLocaleNamesListed;
218   extern const char* kLocalesTreeMissing;
219   extern const char* kManifestParseError;
220   extern const char* kManifestUnreadable;
221   extern const char* kMissingFile;
222   extern const char* kMultipleOverrides;
223   extern const char* kNoWildCardsInPaths;
224   extern const char* kOneUISurfaceOnly;
225   extern const char* kReservedMessageFound;
226   extern const char* kSidebarExperimental;
227   extern const char* kThemesCannotContainExtensions;
228   extern const char* kWebContentMustBeEnabled;
229 #if defined(OS_CHROMEOS)
230   extern const char* kIllegalPlugins;
231 #endif
232 }  // namespace extension_manifest_errors
233 
234 namespace extension_urls {
235   // The greatest common prefixes of the main extensions gallery's browse and
236   // download URLs.
237   extern const char* kGalleryBrowsePrefix;
238 
239   // Same thing for the "minigallery". The minigallery is the temporary static
240   // themes gallery that we put up when we launched themes.
241   extern const char* kMiniGalleryBrowsePrefix;
242   extern const char* kMiniGalleryDownloadPrefix;
243 }  // namespace extension_urls
244 
245 namespace extension_filenames {
246   // The name of a temporary directory to install an extension into for
247   // validation before finalizing install.
248   extern const char* kTempExtensionName;
249 
250   // The file to write our decoded images to, relative to the extension_path.
251   extern const char* kDecodedImagesFilename;
252 
253   // The file to write our decoded message catalogs to, relative to the
254   // extension_path.
255   extern const char* kDecodedMessageCatalogsFilename;
256 }
257 
258 namespace extension_misc {
259   const int kUnknownWindowId = -1;
260 
261   // The extension id of the bookmark manager.
262   extern const char* kBookmarkManagerId;
263 
264   // The extension id of the Web Store component application.
265   extern const char* kWebStoreAppId;
266 
267   // Note: this structure is an ASN.1 which encodes the algorithm used
268   // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447).
269   // It is encoding: { OID sha1WithRSAEncryption      PARAMETERS NULL }
270   const uint8 kSignatureAlgorithm[15] = {
271     0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
272     0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00
273   };
274 
275   // Don't remove items or change the order of this enum.  It's used in
276   // histograms and preferences.
277   enum LaunchContainer {
278     LAUNCH_WINDOW,
279     LAUNCH_PANEL,
280     LAUNCH_TAB
281   };
282 
283   // The name of the apps promo histogram.
284   extern const char* kAppsPromoHistogram;
285 
286   // The buckets used in the apps promo histogram.
287   enum AppsPromoBuckets {
288     PROMO_LAUNCH_APP,
289     PROMO_LAUNCH_WEB_STORE,
290     PROMO_CLOSE,
291     PROMO_EXPIRE,
292     PROMO_SEEN,
293     PROMO_BUCKET_BOUNDARY
294   };
295 
296   // The name of the app launch histogram.
297   extern const char* kAppLaunchHistogram;
298 
299   // The buckets used for app launches.
300   enum AppLaunchBucket {
301     // Launch from NTP apps section while maximized.
302     APP_LAUNCH_NTP_APPS_MAXIMIZED,
303 
304     // Launch from NTP apps section while collapsed.
305     APP_LAUNCH_NTP_APPS_COLLAPSED,
306 
307     // Launch from NTP apps section while in menu mode.
308     APP_LAUNCH_NTP_APPS_MENU,
309 
310     // Launch from NTP most visited section in any mode.
311     APP_LAUNCH_NTP_MOST_VISITED,
312 
313     // Launch from NTP recently closed section in any mode.
314     APP_LAUNCH_NTP_RECENTLY_CLOSED,
315 
316     // App link clicked from bookmark bar.
317     APP_LAUNCH_BOOKMARK_BAR,
318 
319     // Nvigated to an app from within a web page (like by clicking a link).
320     APP_LAUNCH_CONTENT_NAVIGATION,
321 
322     // Launch from session restore.
323     APP_LAUNCH_SESSION_RESTORE,
324 
325     // Autolaunched at startup, like for pinned tabs.
326     APP_LAUNCH_AUTOLAUNCH,
327 
328     // Launched from omnibox app links (not implemented yet).
329     APP_LAUNCH_OMNIBOX_APP,
330 
331     // App URL typed directly into the omnibox (w/ instant turned off).
332     APP_LAUNCH_OMNIBOX_LOCATION,
333 
334     // Navigate to an app URL via instant.
335     APP_LAUNCH_OMNIBOX_INSTANT,
336 
337     // Launch via chrome.management.launchApp.
338     APP_LAUNCH_EXTENSION_API,
339 
340     // Launch using the --app or --app-id cmd line options.
341     APP_LAUNCH_CMD_LINE_APP,
342 
343     // App launch by passing the URL on the cmd line (not using app switches).
344     APP_LAUNCH_CMD_LINE_URL,
345 
346     // User clicked web store launcher on NTP.
347     APP_LAUNCH_NTP_WEBSTORE,
348 
349     // App launched after the user re-enabled it on the NTP.
350     APP_LAUNCH_NTP_APP_RE_ENABLE,
351 
352     // URL launched using the --app cmd line option, but the URL does not
353     // correspond to an installed app. These launches are left over from a
354     // feature that let you make desktop shortcuts from the file menu.
355     APP_LAUNCH_CMD_LINE_APP_LEGACY,
356 
357     APP_LAUNCH_BUCKET_BOUNDARY,
358     APP_LAUNCH_BUCKET_INVALID
359   };
360 
361 #if defined(OS_CHROMEOS)
362   // The directory path on a ChromeOS device where accessibility extensions are
363   // stored.
364   extern const char* kAccessExtensionPath;
365 #endif
366 }  // extension_misc
367 
368 #endif  // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
369