Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / chrome / common / extensions / extension_constants.h
blobef23a7761b2316e5de195b97798b57c49be3fae6
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_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "googleurl/src/gurl.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 leading to a search page for Web Intents. The search is
29 // specific to intents with the given |action| and |type|.
30 GURL GetWebstoreIntentQueryURL(const std::string& action,
31 const std::string& type);
33 // Returns the URL used to get webstore data (ratings, manifest, icon URL,
34 // etc.) about an extension from the webstore as JSON.
35 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id);
37 // Return the update URL used by gallery/webstore extensions/apps.
38 GURL GetWebstoreUpdateUrl();
40 // Returns whether the URL is the webstore update URL (just considering host
41 // and path, not scheme, query, etc.)
42 bool IsWebstoreUpdateUrl(const GURL& update_url);
44 // Returns true if the URL points to an extension blacklist.
45 bool IsBlacklistUpdateUrl(const GURL& url);
47 // The greatest common prefixes of the main extensions gallery's browse and
48 // download URLs.
49 extern const char kGalleryBrowsePrefix[];
50 } // namespace extension_urls
52 namespace extension_filenames {
53 // The name of a temporary directory to install an extension into for
54 // validation before finalizing install.
55 extern const char kTempExtensionName[];
57 // The file to write our decoded images to, relative to the extension_path.
58 extern const char kDecodedImagesFilename[];
60 // The file to write our decoded message catalogs to, relative to the
61 // extension_path.
62 extern const char kDecodedMessageCatalogsFilename[];
64 // The filename to use for a background page generated from
65 // background.scripts.
66 extern const char kGeneratedBackgroundPageFilename[];
69 // Keys in the dictionary returned by Extension::GetBasicInfo().
70 namespace extension_info_keys {
71 extern const char kDescriptionKey[];
72 extern const char kEnabledKey[];
73 extern const char kHomepageUrlKey[];
74 extern const char kIdKey[];
75 extern const char kNameKey[];
76 extern const char kOfflineEnabledKey[];
77 extern const char kOptionsUrlKey[];
78 extern const char kDetailsUrlKey[];
79 extern const char kVersionKey[];
80 extern const char kPackagedAppKey[];
83 namespace extension_misc {
84 // Matches chrome.windows.WINDOW_ID_NONE.
85 const int kUnknownWindowId = -1;
87 // Matches chrome.windows.WINDOW_ID_CURRENT.
88 const int kCurrentWindowId = -2;
90 // The extension id of the bookmark manager.
91 extern const char kBookmarkManagerId[];
93 // The extension id of the Citrix Receiver application.
94 extern const char kCitrixReceiverAppId[];
96 // The extension id of the beta Citrix Receiver application.
97 extern const char kCitrixReceiverAppBetaId[];
99 // The extension id of the dev Citrix Receiver application.
100 extern const char kCitrixReceiverAppDevId[];
102 // The extension id of the Enterprise Web Store component application.
103 extern const char kEnterpriseWebStoreAppId[];
105 // The extension id of the HTerm app for ChromeOS.
106 extern const char kHTermAppId[];
108 // The extension id of the HTerm dev app for ChromeOS.
109 extern const char kHTermDevAppId[];
111 // The extension id of the Crosh component app for ChromeOS.
112 extern const char kCroshBuiltinAppId[];
114 // The extension id of the Web Store component application.
115 extern const char kWebStoreAppId[];
117 // The extension id of the Cloud Print component application.
118 extern const char kCloudPrintAppId[];
120 // The extension id of the Chrome component application.
121 extern const char kChromeAppId[];
123 // Note: this structure is an ASN.1 which encodes the algorithm used
124 // with its parameters. This is defined in PKCS #1 v2.1 (RFC 3447).
125 // It is encoding: { OID sha1WithRSAEncryption PARAMETERS NULL }
126 const uint8 kSignatureAlgorithm[15] = {
127 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
128 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00
131 // Don't remove items or change the order of this enum. It's used in
132 // histograms and preferences.
133 enum LaunchContainer {
134 LAUNCH_WINDOW,
135 LAUNCH_PANEL,
136 LAUNCH_TAB,
137 // For platform apps, which don't actually have a container (they just get a
138 // "onLaunched" event).
139 LAUNCH_NONE
142 // The name of the app launch histogram.
143 extern const char kAppLaunchHistogram[];
145 // The buckets used for app launches.
146 enum AppLaunchBucket {
147 // Launch from NTP apps section while maximized.
148 APP_LAUNCH_NTP_APPS_MAXIMIZED,
150 // Launch from NTP apps section while collapsed.
151 APP_LAUNCH_NTP_APPS_COLLAPSED,
153 // Launch from NTP apps section while in menu mode.
154 APP_LAUNCH_NTP_APPS_MENU,
156 // Launch from NTP most visited section in any mode.
157 APP_LAUNCH_NTP_MOST_VISITED,
159 // Launch from NTP recently closed section in any mode.
160 APP_LAUNCH_NTP_RECENTLY_CLOSED,
162 // App link clicked from bookmark bar.
163 APP_LAUNCH_BOOKMARK_BAR,
165 // Nvigated to an app from within a web page (like by clicking a link).
166 APP_LAUNCH_CONTENT_NAVIGATION,
168 // Launch from session restore.
169 APP_LAUNCH_SESSION_RESTORE,
171 // Autolaunched at startup, like for pinned tabs.
172 APP_LAUNCH_AUTOLAUNCH,
174 // Launched from omnibox app links.
175 APP_LAUNCH_OMNIBOX_APP,
177 // App URL typed directly into the omnibox (w/ instant turned off).
178 APP_LAUNCH_OMNIBOX_LOCATION,
180 // Navigate to an app URL via instant.
181 APP_LAUNCH_OMNIBOX_INSTANT,
183 // Launch via chrome.management.launchApp.
184 APP_LAUNCH_EXTENSION_API,
186 // Launch using the --app or --app-id cmd line options.
187 APP_LAUNCH_CMD_LINE_APP,
189 // App launch by passing the URL on the cmd line (not using app switches).
190 APP_LAUNCH_CMD_LINE_URL,
192 // User clicked web store launcher on NTP.
193 APP_LAUNCH_NTP_WEBSTORE,
195 // App launched after the user re-enabled it on the NTP.
196 APP_LAUNCH_NTP_APP_RE_ENABLE,
198 // URL launched using the --app cmd line option, but the URL does not
199 // correspond to an installed app. These launches are left over from a
200 // feature that let you make desktop shortcuts from the file menu.
201 APP_LAUNCH_CMD_LINE_APP_LEGACY,
203 // User clicked web store link on the NTP footer.
204 APP_LAUNCH_NTP_WEBSTORE_FOOTER,
206 // User clicked [+] icon in apps page.
207 APP_LAUNCH_NTP_WEBSTORE_PLUS_ICON,
209 APP_LAUNCH_BUCKET_BOUNDARY,
210 APP_LAUNCH_BUCKET_INVALID
213 #if defined(OS_CHROMEOS)
214 // The directory path on a ChromeOS device where accessibility extensions are
215 // stored.
216 extern const char kAccessExtensionPath[];
217 extern const char kChromeVoxDirectoryName[];
218 // The extension id of the wallpaper manager application.
219 extern const char kWallpaperManagerId[];
220 #endif
222 // What causes an extension to be installed? Used in histograms, so don't
223 // change existing values.
224 enum CrxInstallCause {
225 INSTALL_CAUSE_UNSET = 0,
226 INSTALL_CAUSE_USER_DOWNLOAD,
227 INSTALL_CAUSE_UPDATE,
228 INSTALL_CAUSE_EXTERNAL_FILE,
229 INSTALL_CAUSE_AUTOMATION,
230 NUM_INSTALL_CAUSES
233 enum UnloadedExtensionReason {
234 UNLOAD_REASON_DISABLE, // Extension is being disabled.
235 UNLOAD_REASON_UPDATE, // Extension is being updated to a newer version.
236 UNLOAD_REASON_UNINSTALL, // Extension is being uninstalled.
237 UNLOAD_REASON_TERMINATE, // Extension has terminated.
240 // The states that an app can be in, as reported by chrome.app.installState
241 // and chrome.app.runningState.
242 extern const char kAppStateNotInstalled[];
243 extern const char kAppStateInstalled[];
244 extern const char kAppStateDisabled[];
245 extern const char kAppStateRunning[];
246 extern const char kAppStateCannotRun[];
247 extern const char kAppStateReadyToRun[];
249 // The path part of the file system url used for media file systems.
250 extern const char kMediaFileSystemPathPart[];
252 // Error indicating that the app notifications API is not accessible by split
253 // mode extensions in incognito windows.
254 extern const char kAppNotificationsIncognitoError[];
256 // NOTE: If you change this list, you should also change kExtensionIconSizes
257 // in cc file.
258 enum ExtensionIcons {
259 EXTENSION_ICON_GIGANTOR = 512,
260 EXTENSION_ICON_EXTRA_LARGE = 256,
261 EXTENSION_ICON_LARGE = 128,
262 EXTENSION_ICON_MEDIUM = 48,
263 EXTENSION_ICON_SMALL = 32,
264 EXTENSION_ICON_SMALLISH = 24,
265 EXTENSION_ICON_ACTION = 19,
266 EXTENSION_ICON_BITTY = 16,
267 EXTENSION_ICON_INVALID = 0,
270 // List of sizes for extension icons that can be defined in the manifest.
271 extern const int kExtensionIconSizes[];
272 extern const size_t kNumExtensionIconSizes;
274 // List of sizes for extension icons that can be defined in the manifest.
275 extern const int kExtensionActionIconSizes[];
276 extern const size_t kNumExtensionActionIconSizes;
278 // List of sizes for extension icons that can be defined in the manifest.
279 extern const int kScriptBadgeIconSizes[];
280 extern const size_t kNumScriptBadgeIconSizes;
282 } // extension_misc
284 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_