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.
5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
10 #include "base/basictypes.h"
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();
19 // Returns the URL to the extensions category on the Web Store. This is
20 // derived from GetWebstoreLaunchURL().
21 std::string GetExtensionGalleryURL();
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();
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);
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);
41 // Returns the URL of the web store search results page for |query|.
42 GURL GetWebstoreSearchPageUrl(const std::string& query);
44 // Return the update URL used by gallery/webstore extensions/apps.
45 GURL GetWebstoreUpdateUrl();
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);
51 // Returns true if the URL points to an extension blacklist.
52 bool IsBlacklistUpdateUrl(const GURL& url);
54 // The greatest common prefixes of the main extensions gallery's browse and
56 extern const char kGalleryBrowsePrefix[];
58 // Field to use with webstore URL for tracking launch source.
59 extern const char kWebstoreSourceField[];
61 // Values to use with webstore URL launch source field.
62 extern const char kLaunchSourceAppList[];
63 extern const char kLaunchSourceAppListSearch[];
64 extern const char kLaunchSourceAppListInfoDialog[];
65 } // namespace extension_urls
67 namespace extension_misc {
68 // Matches chrome.windows.WINDOW_ID_NONE.
69 const int kUnknownWindowId = -1;
71 // Matches chrome.windows.WINDOW_ID_CURRENT.
72 const int kCurrentWindowId = -2;
74 // The extension id of the bookmark manager.
75 extern const char kBookmarkManagerId[];
77 // The extension id of the Chrome component application.
78 extern const char kChromeAppId[];
80 // The extension id of the Cloud Print component application.
81 extern const char kCloudPrintAppId[];
83 // The extension id of the Enterprise Web Store component application.
84 extern const char kEnterpriseWebStoreAppId[];
86 // The extension id of GMail application.
87 extern const char kGmailAppId[];
89 // The extension id of the Google Doc application.
90 extern const char kGoogleDocAppId[];
92 // The extension id of the Google Play Music application.
93 extern const char kGooglePlayMusicAppId[];
95 // The extension id of the Google Search application.
96 extern const char kGoogleSearchAppId[];
98 // The extension id of the Google Sheets application.
99 extern const char kGoogleSheetsAppId[];
101 // The extension id of the Google Slides application.
102 extern const char kGoogleSlidesAppId[];
104 // The extension id of the HTerm app for ChromeOS.
105 extern const char kHTermAppId[];
107 // The extension id of the HTerm dev app for ChromeOS.
108 extern const char kHTermDevAppId[];
110 // The extension id of the Crosh component app for ChromeOS.
111 extern const char kCroshBuiltinAppId[];
113 // The extension id of the hotword voice search trigger extension.
114 extern const char kHotwordExtensionId[];
116 // The extension id of the PDF extension.
117 extern const char kPdfExtensionId[];
119 // The extension id of the Office Viewer component extension.
120 extern const char kQuickOfficeComponentExtensionId[];
122 // The extension id of the Office Viewer extension on the internal webstore.
123 extern const char kQuickOfficeInternalExtensionId[];
125 // The extension id of the Office Viewer extension.
126 extern const char kQuickOfficeExtensionId[];
128 // The extension id of the settings application.
129 extern const char kSettingsAppId[];
131 // The extension id used for testing streamsPrivate
132 extern const char kStreamsPrivateTestExtensionId[];
134 // The extension id of the Web Store component application.
135 extern const char kWebStoreAppId[];
137 // The extension id of the Youtube application.
138 extern const char kYoutubeAppId[];
140 // The extension id of the Identity API UI application.
141 extern const char kIdentityApiUiAppId[];
143 // The extension id of the in-app payments support application.
144 extern const char kInAppPaymentsSupportAppId[];
146 // Note: this structure is an ASN.1 which encodes the algorithm used
147 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447).
148 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL }
149 const uint8 kSignatureAlgorithm[15] = {
150 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
151 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00
154 // The name of the app launch histogram.
155 extern const char kAppLaunchHistogram[];
157 // The name of the app launch histogram for platform apps.
158 extern const char kPlatformAppLaunchHistogram[];
160 // The buckets used for app launches.
161 enum AppLaunchBucket {
162 // Launch from NTP apps section while maximized.
163 APP_LAUNCH_NTP_APPS_MAXIMIZED,
165 // Launch from NTP apps section while collapsed.
166 APP_LAUNCH_NTP_APPS_COLLAPSED,
168 // Launch from NTP apps section while in menu mode.
169 APP_LAUNCH_NTP_APPS_MENU,
171 // Launch from NTP most visited section in any mode.
172 APP_LAUNCH_NTP_MOST_VISITED,
174 // Launch from NTP recently closed section in any mode.
175 APP_LAUNCH_NTP_RECENTLY_CLOSED,
177 // App link clicked from bookmark bar.
178 APP_LAUNCH_BOOKMARK_BAR,
180 // Nvigated to an app from within a web page (like by clicking a link).
181 APP_LAUNCH_CONTENT_NAVIGATION,
183 // Launch from session restore.
184 APP_LAUNCH_SESSION_RESTORE,
186 // Autolaunched at startup, like for pinned tabs.
187 APP_LAUNCH_AUTOLAUNCH,
189 // Launched from omnibox app links.
190 APP_LAUNCH_OMNIBOX_APP,
192 // App URL typed directly into the omnibox (w/ instant turned off).
193 APP_LAUNCH_OMNIBOX_LOCATION,
195 // Navigate to an app URL via instant.
196 APP_LAUNCH_OMNIBOX_INSTANT,
198 // Launch via chrome.management.launchApp.
199 APP_LAUNCH_EXTENSION_API,
201 // Launch an app via a shortcut. This includes using the --app or --app-id
202 // command line arguments, or via an app shim process on Mac.
203 APP_LAUNCH_CMD_LINE_APP,
205 // App launch by passing the URL on the cmd line (not using app switches).
206 APP_LAUNCH_CMD_LINE_URL,
208 // User clicked web store launcher on NTP.
209 APP_LAUNCH_NTP_WEBSTORE,
211 // App launched after the user re-enabled it on the NTP.
212 APP_LAUNCH_NTP_APP_RE_ENABLE,
214 // URL launched using the --app cmd line option, but the URL does not
215 // correspond to an installed app. These launches are left over from a
216 // feature that let you make desktop shortcuts from the file menu.
217 APP_LAUNCH_CMD_LINE_APP_LEGACY,
219 // User clicked web store link on the NTP footer.
220 APP_LAUNCH_NTP_WEBSTORE_FOOTER,
222 // User clicked [+] icon in apps page.
223 APP_LAUNCH_NTP_WEBSTORE_PLUS_ICON,
225 // User clicked icon in app launcher main view.
226 APP_LAUNCH_APP_LIST_MAIN,
228 // User clicked app launcher search result.
229 APP_LAUNCH_APP_LIST_SEARCH,
231 // User clicked the chrome app icon from the app launcher's main view.
232 APP_LAUNCH_APP_LIST_MAIN_CHROME,
234 // User clicked the webstore icon from the app launcher's main view.
235 APP_LAUNCH_APP_LIST_MAIN_WEBSTORE,
237 // User clicked the chrome app icon from the app launcher's search view.
238 APP_LAUNCH_APP_LIST_SEARCH_CHROME,
240 // User clicked the webstore icon from the app launcher's search view.
241 APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE,
243 APP_LAUNCH_BUCKET_BOUNDARY,
244 APP_LAUNCH_BUCKET_INVALID
247 // The extension id of the ChromeVox extension.
248 extern const char kChromeVoxExtensionId[];
250 #if defined(OS_CHROMEOS)
251 // Path to preinstalled ChromeVox screen reader extension (relative to
252 // |chrome::DIR_RESOURCES|).
253 extern const char kChromeVoxExtensionPath[];
254 // Path to preinstalled Connectivity Diagnostics extension.
255 extern const char kConnectivityDiagnosticsPath[];
256 extern const char kConnectivityDiagnosticsLauncherPath[];
257 // Path to preinstalled speech synthesis extension.
258 extern const char kSpeechSynthesisExtensionPath[];
259 // The extension id of the speech synthesis extension.
260 extern const char kSpeechSynthesisExtensionId[];
261 // The extension id of the wallpaper manager application.
262 extern const char kWallpaperManagerId[];
263 // The extension id of the first run dialog application.
264 extern const char kFirstRunDialogId[];
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,
278 // The states that an app can be in, as reported by chrome.app.installState
279 // and chrome.app.runningState.
280 extern const char kAppStateNotInstalled[];
281 extern const char kAppStateInstalled[];
282 extern const char kAppStateDisabled[];
283 extern const char kAppStateRunning[];
284 extern const char kAppStateCannotRun[];
285 extern const char kAppStateReadyToRun[];
287 // The path part of the file system url used for media file systems.
288 extern const char kMediaFileSystemPathPart[];
290 // NOTE: If you change this list, you should also change kExtensionIconSizes
292 enum ExtensionIcons {
293 EXTENSION_ICON_GIGANTOR = 512,
294 EXTENSION_ICON_EXTRA_LARGE = 256,
295 EXTENSION_ICON_LARGE = 128,
296 EXTENSION_ICON_MEDIUM = 48,
297 EXTENSION_ICON_SMALL = 32,
298 EXTENSION_ICON_SMALLISH = 24,
299 EXTENSION_ICON_ACTION = 19,
300 EXTENSION_ICON_BITTY = 16,
301 EXTENSION_ICON_INVALID = 0,
304 // List of sizes for extension icons that can be defined in the manifest.
305 extern const int kExtensionIconSizes[];
306 extern const size_t kNumExtensionIconSizes;
308 // List of sizes for extension icons that can be defined in the manifest.
309 extern const int kExtensionActionIconSizes[];
310 extern const size_t kNumExtensionActionIconSizes;
312 } // namespace extension_misc
314 namespace extensions {
315 // This enum is used for the launch type the user wants to use for an
317 // Do not remove items or re-order this enum as it is used in preferences
320 LAUNCH_TYPE_INVALID = -1,
321 LAUNCH_TYPE_FIRST = 0,
322 LAUNCH_TYPE_PINNED = LAUNCH_TYPE_FIRST,
323 LAUNCH_TYPE_REGULAR = 1,
324 LAUNCH_TYPE_FULLSCREEN = 2,
325 LAUNCH_TYPE_WINDOW = 3,
328 // Launch an app in the in the way a click on the NTP would,
329 // if no user pref were set. Update this constant to change
330 // the default for the NTP and chrome.management.launchApp().
331 LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
334 // Don't remove items or change the order of this enum. It's used in
335 // histograms and preferences.
336 enum LaunchContainer {
337 LAUNCH_CONTAINER_WINDOW,
338 LAUNCH_CONTAINER_PANEL,
339 LAUNCH_CONTAINER_TAB,
340 // For platform apps, which don't actually have a container (they just get a
341 // "onLaunched" event).
342 LAUNCH_CONTAINER_NONE
344 } // namespace extensions
346 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_