• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
7 
8 #include <string>
9 
10 #include "base/basictypes.h"
11 #include "url/gurl.h"
12 
13 namespace extension_urls {
14 
15 // Returns the URL prefix for the extension/apps gallery. Can be set via the
16 // --apps-gallery-url switch. The URL returned will not contain a trailing
17 // slash. Do not use this as a prefix/extent for the store.
18 std::string GetWebstoreLaunchURL();
19 
20 // Returns the URL to the extensions category on the Web Store. This is
21 // derived from GetWebstoreLaunchURL().
22 std::string GetExtensionGalleryURL();
23 
24 // Returns the URL prefix for an item in the extension/app gallery. This URL
25 // will contain a trailing slash and should be concatenated with an item ID
26 // to get the item detail URL.
27 std::string GetWebstoreItemDetailURLPrefix();
28 
29 // Returns the URL used to get webstore data (ratings, manifest, icon URL,
30 // etc.) about an extension from the webstore as JSON.
31 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id);
32 
33 // Returns the URL used to get webstore search results in JSON format. The URL
34 // returns a JSON dictionary that has the search results (under "results").
35 // Each entry in the array is a dictionary as the data returned for
36 // GetWebstoreItemJsonDataURL above. |query| is the user typed query string.
37 // |hl| is the host language code, e.g. en_US. Both arguments will be escaped
38 // and added as a query parameter to the returned web store json search URL.
39 GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl);
40 
41 // Returns the URL of the web store search results page for |query|.
42 GURL GetWebstoreSearchPageUrl(const std::string& query);
43 
44 // Return the update URL used by gallery/webstore extensions/apps. This may
45 // have been overridden by a command line flag for testing purposes.
46 GURL GetWebstoreUpdateUrl();
47 
48 // This returns the compile-time constant webstore update url. Usually you
49 // should prefer using GetWebstoreUpdateUrl.
50 GURL GetDefaultWebstoreUpdateUrl();
51 
52 // Returns whether the URL is the webstore update URL (just considering host
53 // and path, not scheme, query, etc.)
54 bool IsWebstoreUpdateUrl(const GURL& update_url);
55 
56 // Returns true if the URL points to an extension blacklist.
57 bool IsBlacklistUpdateUrl(const GURL& url);
58 // The greatest common prefixes of the main extensions gallery's browse and
59 // download URLs.
60 extern const char kGalleryBrowsePrefix[];
61 
62 // Field to use with webstore URL for tracking launch source.
63 extern const char kWebstoreSourceField[];
64 
65 // Values to use with webstore URL launch source field.
66 extern const char kLaunchSourceAppList[];
67 extern const char kLaunchSourceAppListSearch[];
68 extern const char kLaunchSourceAppListInfoDialog[];
69 
70 }  // namespace extension_urls
71 
72 namespace extension_misc {
73 
74 // The extension id of the bookmark manager.
75 extern const char kBookmarkManagerId[];
76 
77 // The extension id of the Chrome component application.
78 extern const char kChromeAppId[];
79 
80 // The extension id of the Cloud Print component application.
81 extern const char kCloudPrintAppId[];
82 
83 // The extension id of the Easy Unlock component application.
84 extern const char kEasyUnlockAppId[];
85 
86 // The extension id of the Enterprise Web Store component application.
87 extern const char kEnterpriseWebStoreAppId[];
88 
89 // The extension id of GMail application.
90 extern const char kGmailAppId[];
91 
92 // The extension id of the Google Doc application.
93 extern const char kGoogleDocAppId[];
94 
95 // The extension id of the Google Play Music application.
96 extern const char kGooglePlayMusicAppId[];
97 
98 // The extension id of the Google Search application.
99 extern const char kGoogleSearchAppId[];
100 
101 // The extension id of the Google Sheets application.
102 extern const char kGoogleSheetsAppId[];
103 
104 // The extension id of the Google Slides application.
105 extern const char kGoogleSlidesAppId[];
106 
107 // The extension id of the HTerm app for ChromeOS.
108 extern const char kHTermAppId[];
109 
110 // The extension id of the HTerm dev app for ChromeOS.
111 extern const char kHTermDevAppId[];
112 
113 // The extension id of the Identity API UI application.
114 extern const char kIdentityApiUiAppId[];
115 
116 // The extension id of the Crosh component app for ChromeOS.
117 extern const char kCroshBuiltinAppId[];
118 
119 // The extension id of the hotword voice search trigger extension.
120 extern const char kHotwordExtensionId[];
121 
122 // The extension id of the PDF extension.
123 extern const char kPdfExtensionId[];
124 
125 // The extension id of the Office Viewer component extension.
126 extern const char kQuickOfficeComponentExtensionId[];
127 
128 // The extension id of the Office Viewer extension on the internal webstore.
129 extern const char kQuickOfficeInternalExtensionId[];
130 
131 // The extension id of the Office Viewer extension.
132 extern const char kQuickOfficeExtensionId[];
133 
134 // The extension id of the settings application.
135 extern const char kSettingsAppId[];
136 
137 // The extension id used for testing streamsPrivate
138 extern const char kStreamsPrivateTestExtensionId[];
139 
140 // The extension id of the Web Store component application.
141 extern const char kWebStoreAppId[];
142 
143 // The extension id of the Youtube application.
144 extern const char kYoutubeAppId[];
145 
146 // The extension id of the in-app payments support application.
147 extern const char kInAppPaymentsSupportAppId[];
148 
149 // The name of the app launch histogram.
150 extern const char kAppLaunchHistogram[];
151 
152 // The name of the app launch histogram for platform apps.
153 extern const char kPlatformAppLaunchHistogram[];
154 
155 // The buckets used for app launches.
156 enum AppLaunchBucket {
157   // Launch from NTP apps section while maximized.
158   APP_LAUNCH_NTP_APPS_MAXIMIZED,
159 
160   // Launch from NTP apps section while collapsed.
161   APP_LAUNCH_NTP_APPS_COLLAPSED,
162 
163   // Launch from NTP apps section while in menu mode.
164   APP_LAUNCH_NTP_APPS_MENU,
165 
166   // Launch from NTP most visited section in any mode.
167   APP_LAUNCH_NTP_MOST_VISITED,
168 
169   // Launch from NTP recently closed section in any mode.
170   APP_LAUNCH_NTP_RECENTLY_CLOSED,
171 
172   // App link clicked from bookmark bar.
173   APP_LAUNCH_BOOKMARK_BAR,
174 
175   // Nvigated to an app from within a web page (like by clicking a link).
176   APP_LAUNCH_CONTENT_NAVIGATION,
177 
178   // Launch from session restore.
179   APP_LAUNCH_SESSION_RESTORE,
180 
181   // Autolaunched at startup, like for pinned tabs.
182   APP_LAUNCH_AUTOLAUNCH,
183 
184   // Launched from omnibox app links.
185   APP_LAUNCH_OMNIBOX_APP,
186 
187   // App URL typed directly into the omnibox (w/ instant turned off).
188   APP_LAUNCH_OMNIBOX_LOCATION,
189 
190   // Navigate to an app URL via instant.
191   APP_LAUNCH_OMNIBOX_INSTANT,
192 
193   // Launch via chrome.management.launchApp.
194   APP_LAUNCH_EXTENSION_API,
195 
196   // Launch an app via a shortcut. This includes using the --app or --app-id
197   // command line arguments, or via an app shim process on Mac.
198   APP_LAUNCH_CMD_LINE_APP,
199 
200   // App launch by passing the URL on the cmd line (not using app switches).
201   APP_LAUNCH_CMD_LINE_URL,
202 
203   // User clicked web store launcher on NTP.
204   APP_LAUNCH_NTP_WEBSTORE,
205 
206   // App launched after the user re-enabled it on the NTP.
207   APP_LAUNCH_NTP_APP_RE_ENABLE,
208 
209   // URL launched using the --app cmd line option, but the URL does not
210   // correspond to an installed app. These launches are left over from a
211   // feature that let you make desktop shortcuts from the file menu.
212   APP_LAUNCH_CMD_LINE_APP_LEGACY,
213 
214   // User clicked web store link on the NTP footer.
215   APP_LAUNCH_NTP_WEBSTORE_FOOTER,
216 
217   // User clicked [+] icon in apps page.
218   APP_LAUNCH_NTP_WEBSTORE_PLUS_ICON,
219 
220   // User clicked icon in app launcher main view.
221   APP_LAUNCH_APP_LIST_MAIN,
222 
223   // User clicked app launcher search result.
224   APP_LAUNCH_APP_LIST_SEARCH,
225 
226   // User clicked the chrome app icon from the app launcher's main view.
227   APP_LAUNCH_APP_LIST_MAIN_CHROME,
228 
229   // User clicked the webstore icon from the app launcher's main view.
230   APP_LAUNCH_APP_LIST_MAIN_WEBSTORE,
231 
232   // User clicked the chrome app icon from the app launcher's search view.
233   APP_LAUNCH_APP_LIST_SEARCH_CHROME,
234 
235   // User clicked the webstore icon from the app launcher's search view.
236   APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE,
237   APP_LAUNCH_BUCKET_BOUNDARY,
238   APP_LAUNCH_BUCKET_INVALID
239 };
240 
241 // The extension id of the ChromeVox extension.
242 extern const char kChromeVoxExtensionId[];
243 
244 #if defined(OS_CHROMEOS)
245 // Path to preinstalled ChromeVox screen reader extension (relative to
246 // |chrome::DIR_RESOURCES|).
247 extern const char kChromeVoxExtensionPath[];
248 // Name of ChromeVox manifest file.
249 extern const char kChromeVoxManifestFilename[];
250 // Name of ChromeVox guest manifest file.
251 extern const char kChromeVoxGuestManifestFilename[];
252 // Extension id, path (relative to |chrome::DIR_RESOURCES|) and IME engine
253 // id for the builtin-in Braille IME extension.
254 extern const char kBrailleImeExtensionId[];
255 extern const char kBrailleImeExtensionPath[];
256 extern const char kBrailleImeEngineId[];
257 // Path to preinstalled Connectivity Diagnostics extension.
258 extern const char kConnectivityDiagnosticsPath[];
259 extern const char kConnectivityDiagnosticsKioskPath[];
260 extern const char kConnectivityDiagnosticsLauncherPath[];
261 // Path to preinstalled speech synthesis extension.
262 extern const char kSpeechSynthesisExtensionPath[];
263 // The extension id of the speech synthesis extension.
264 extern const char kSpeechSynthesisExtensionId[];
265 // The extension id of the wallpaper manager application.
266 extern const char kWallpaperManagerId[];
267 // The extension id of the first run dialog application.
268 extern const char kFirstRunDialogId[];
269 #endif
270 
271 // What causes an extension to be installed? Used in histograms, so don't
272 // change existing values.
273 enum CrxInstallCause {
274   INSTALL_CAUSE_UNSET = 0,
275   INSTALL_CAUSE_USER_DOWNLOAD,
276   INSTALL_CAUSE_UPDATE,
277   INSTALL_CAUSE_EXTERNAL_FILE,
278   INSTALL_CAUSE_AUTOMATION,
279   NUM_INSTALL_CAUSES
280 };
281 
282 // The states that an app can be in, as reported by chrome.app.installState
283 // and chrome.app.runningState.
284 extern const char kAppStateNotInstalled[];
285 extern const char kAppStateInstalled[];
286 extern const char kAppStateDisabled[];
287 extern const char kAppStateRunning[];
288 extern const char kAppStateCannotRun[];
289 extern const char kAppStateReadyToRun[];
290 
291 // The path part of the file system url used for media file systems.
292 extern const char kMediaFileSystemPathPart[];
293 
294 // The key used for signing some pieces of data from the webstore.
295 extern const uint8 kWebstoreSignaturesPublicKey[];
296 extern const int kWebstoreSignaturesPublicKeySize;
297 
298 }  // namespace extension_misc
299 
300 namespace extensions {
301 
302 // This enum is used for the launch type the user wants to use for an
303 // application.
304 // Do not remove items or re-order this enum as it is used in preferences
305 // and histograms.
306 enum LaunchType {
307   LAUNCH_TYPE_INVALID = -1,
308   LAUNCH_TYPE_FIRST = 0,
309   LAUNCH_TYPE_PINNED = LAUNCH_TYPE_FIRST,
310   LAUNCH_TYPE_REGULAR = 1,
311   LAUNCH_TYPE_FULLSCREEN = 2,
312   LAUNCH_TYPE_WINDOW = 3,
313   NUM_LAUNCH_TYPES,
314 
315   // Launch an app in the in the way a click on the NTP would,
316   // if no user pref were set.  Update this constant to change
317   // the default for the NTP and chrome.management.launchApp().
318   LAUNCH_TYPE_DEFAULT = LAUNCH_TYPE_REGULAR
319 };
320 
321 // Don't remove items or change the order of this enum.  It's used in
322 // histograms and preferences.
323 enum LaunchContainer {
324   LAUNCH_CONTAINER_WINDOW,
325   LAUNCH_CONTAINER_PANEL,
326   LAUNCH_CONTAINER_TAB,
327   // For platform apps, which don't actually have a container (they just get a
328   // "onLaunched" event).
329   LAUNCH_CONTAINER_NONE
330 };
331 
332 }  // namespace extensions
333 
334 #endif  // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_
335