url_constants.cc revision dc0f95d653279beabeb9817299e2902918ba123e
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#include <stdlib.h>
6
7#include "chrome/common/url_constants.h"
8#include "googleurl/src/url_util.h"
9
10namespace chrome {
11
12const char kAboutScheme[] = "about";
13const char kBlobScheme[] = "blob";
14const char kChromeDevToolsScheme[] = "chrome-devtools";
15const char kChromeInternalScheme[] = "chrome-internal";
16const char kChromeUIScheme[] = "chrome";
17const char kDataScheme[] = "data";
18const char kExtensionScheme[] = "chrome-extension";
19const char kFileScheme[] = "file";
20const char kFileSystemScheme[] = "filesystem";
21const char kFtpScheme[] = "ftp";
22const char kGearsScheme[] = "gears";
23const char kHttpScheme[] = "http";
24const char kHttpsScheme[] = "https";
25const char kJavaScriptScheme[] = "javascript";
26const char kMailToScheme[] = "mailto";
27const char kMetadataScheme[] = "metadata";
28const char kUserScriptScheme[] = "chrome-user-script";
29const char kViewSourceScheme[] = "view-source";
30
31#if defined(OS_CHROMEOS)
32const char kCrosScheme[] = "cros";
33#endif
34
35const char kStandardSchemeSeparator[] = "://";
36
37const char* kSavableSchemes[] = {
38  kHttpScheme,
39  kHttpsScheme,
40  kFileScheme,
41  kFtpScheme,
42  kExtensionScheme,
43  kChromeDevToolsScheme,
44  kChromeUIScheme,
45  NULL
46};
47
48const char kAboutAboutURL[] = "about:about";
49const char kAboutAppCacheInternalsURL[] = "about:appcache-internals";
50const char kAboutBlankURL[] = "about:blank";
51const char kAboutCacheURL[] = "about:cache";
52const char kAboutConflicts[] = "about:conflicts";
53const char kAboutCrashURL[] = "about:crash";
54const char kAboutKillURL[] = "about:kill";
55const char kAboutCreditsURL[] = "about:credits";
56const char kAboutDNSURL[] = "about:dns";
57const char kAboutFlagsURL[] = "about:flags";
58const char kAboutGpuURL[] = "about:gpu";
59const char kAboutGpuCrashURL[] = "about:gpucrash";
60const char kAboutGpuHangURL[] = "about:gpuhang";
61const char kAboutHangURL[] = "about:hang";
62const char kAboutHistogramsURL[] = "about:histograms";
63const char kAboutMemoryURL[] = "about:memory";
64const char kAboutNetInternalsURL[] = "about:net-internals";
65const char kAboutPluginsURL[] = "about:plugins";
66const char kAboutShorthangURL[] = "about:shorthang";
67const char kAboutSyncURL[] = "about:sync";
68const char kAboutSyncInternalsURL[] = "about:sync-internals";
69const char kAboutTermsURL[] = "about:terms";
70const char kAboutVersionURL[] = "about:version";
71
72// Use an obfuscated URL to make this nondiscoverable, we only want this
73// to be used for testing.
74const char kAboutBrowserCrash[] = "about:inducebrowsercrashforrealz";
75
76const char kChromeUIAboutAboutURL[] = "chrome://about/about";
77const char kChromeUIAboutCreditsURL[] = "chrome://about/credits";
78const char kChromeUIAboutURL[] = "chrome://settings/about";
79const char kChromeUIAppLauncherURL[] = "chrome://newtab/#mode=app-launcher";
80const char kChromeUIBookmarksURL[] = "chrome://bookmarks/";
81const char kChromeUIBugReportURL[] = "chrome://bugreport/";
82const char kChromeUIConflictsURL[] = "chrome://conflicts/";
83const char kChromeUIConstrainedHTMLTestURL[] = "chrome://constrained-test/";
84const char kChromeUICrashesURL[] = "chrome://crashes/";
85const char kChromeUIDevToolsURL[] = "chrome-devtools://devtools/";
86const char kChromeUIDownloadsURL[] = "chrome://downloads/";
87const char kChromeUIExtensionIconURL[] = "chrome://extension-icon/";
88const char kChromeUIExtensionsURL[] = "chrome://extensions/";
89const char kChromeUIFavIconURL[] = "chrome://favicon/";
90const char kChromeUIFlagsURL[] = "chrome://flags/";
91const char kChromeUIHistory2URL[] = "chrome://history2/";
92const char kChromeUIHistoryURL[] = "chrome://history/";
93const char kChromeUIIPCURL[] = "chrome://about/ipc";
94const char kChromeUIKeyboardURL[] = "chrome://keyboard/";
95const char kChromeUINewTabURL[] = "chrome://newtab";
96const char kChromeUIPluginsURL[] = "chrome://plugins/";
97const char kChromeUIPrintURL[] = "chrome://print/";
98const char kChromeUISettingsURL[] = "chrome://settings/";
99const char kChromeUITextfieldsURL[] = "chrome://textfields/";
100
101#if defined(OS_CHROMEOS)
102const char kChromeUIAboutOSCreditsURL[] = "chrome://about/os-credits";
103const char kChromeUIActivationMessage[] = "chrome://activationmessage/";
104const char kChromeUIFileBrowseURL[] = "chrome://filebrowse/";
105const char kChromeUIImageBurnerURL[] = "chrome://imageburner/";
106const char kChromeUIKeyboardOverlayURL[] = "chrome://keyboardoverlay/";
107const char kChromeUIMediaplayerURL[] = "chrome://mediaplayer/";
108const char kChromeUIMobileSetupURL[] = "chrome://mobilesetup/";
109const char kChromeUIRegisterPageURL[] = "chrome://register/";
110const char kChromeUISlideshowURL[] = "chrome://slideshow/";
111const char kChromeUISystemInfoURL[] = "chrome://system/";
112const char kChromeUIUserImageURL[] = "chrome://userimage/";
113#endif
114
115// Keep this list sorted please.
116const char kChromeUIBookmarksHost[] = "bookmarks";
117const char kChromeUIBugReportHost[] = "bugreport";
118const char kChromeUIConflictsHost[] = "conflicts";
119const char kChromeUICrashesHost[] = "crashes";
120const char kChromeUIDevToolsHost[] = "devtools";
121const char kChromeUIDialogHost[] = "dialog";
122const char kChromeUIDownloadsHost[] = "downloads";
123const char kChromeUIExtensionIconHost[] = "extension-icon";
124const char kChromeUIExtensionsHost[] = "extensions";
125const char kChromeUIFavIconHost[] = "favicon";
126const char kChromeUIFlagsHost[] = "flags";
127const char kChromeUIGpuInternalsHost[] = "gpu-internals";
128const char kChromeUIHistoryHost[] = "history";
129const char kChromeUIHistory2Host[] = "history2";
130const char kChromeUIInspectorHost[] = "inspector";
131const char kChromeUIKeyboardHost[] = "keyboard";
132const char kChromeUINetInternalsHost[] = "net-internals";
133const char kChromeUINewTabHost[] = "newtab";
134const char kChromeUIPluginsHost[] = "plugins";
135const char kChromeUIPrintHost[] = "print";
136const char kChromeUIRemotingHost[] = "remoting";
137const char kChromeUIRemotingResourcesHost[] = "remotingresources";
138const char kChromeUIResourcesHost[] = "resources";
139const char kChromeUIScreenshotPath[] = "screenshots";
140const char kChromeUISettingsHost[] = "settings";
141const char kChromeUISyncInternalsHost[] = "sync-internals";
142const char kChromeUISyncResourcesHost[] = "syncresources";
143const char kChromeUITextfieldsHost[] = "textfields";
144const char kChromeUIThemePath[] = "theme";
145const char kChromeUIThumbnailPath[] = "thumb";
146
147#if defined(OS_CHROMEOS)
148const char kChromeUIActivationMessageHost[] = "activationmessage";
149const char kChromeUIFileBrowseHost[] = "filebrowse";
150const char kChromeUIImageBurnerHost[] = "imageburner";
151const char kChromeUIKeyboardOverlayHost[] = "keyboardoverlay";
152const char kChromeUIMediaplayerHost[] = "mediaplayer";
153const char kChromeUIMobileSetupHost[] = "mobilesetup";
154const char kChromeUIRegisterPageHost[] = "register";
155const char kChromeUISlideshowHost[] = "slideshow";
156const char kChromeUISystemInfoHost[] = "system";
157const char kChromeUIMenu[] = "menu";
158const char kChromeUIWrenchMenu[] = "wrench-menu";
159const char kChromeUINetworkMenu[] = "network-menu";
160const char kChromeUIUserImageHost[] = "userimage";
161#endif
162
163#if defined(OS_CHROMEOS) && defined(TOUCH_UI)
164const char kChromeUILoginContainerHost[] = "login-container";
165const char kChromeUILoginHost[] = "login";
166#endif
167
168const char kUnreachableWebDataURL[] = "chrome://chromewebdata/";
169
170const char kAppCacheViewInternalsURL[] = "chrome://appcache-internals/";
171
172const char kBlobViewInternalsURL[] = "chrome://blob-internals/";
173
174const char kCloudPrintResourcesURL[] = "chrome://cloudprintresources/";
175const char kCloudPrintResourcesHost[] = "cloudprintresources";
176const char kCloudPrintSetupHost[] = "cloudprintsetup";
177
178const char kNetworkViewInternalsURL[] = "chrome://net-internals/";
179const char kNetworkViewCacheURL[] = "chrome://view-http-cache/";
180
181const char kSyncViewInternalsURL[] = "chrome://sync-internals/";
182
183// GPU sub pages
184const char kGpuInternalsURL[] = "chrome://gpu-internals/";
185
186// Option sub pages.
187const char kAdvancedOptionsSubPage[] =  "advanced";
188const char kAutoFillSubPage[] = "autofill";
189const char kBrowserOptionsSubPage[] =  "browser";
190const char kClearBrowserDataSubPage[] = "clearBrowserData";
191const char kContentSettingsSubPage[] = "content";
192const char kContentSettingsExceptionsSubPage[] = "contentExceptions";
193const char kDefaultOptionsSubPage[] =  "";
194const char kImportDataSubPage[] = "importData";
195const char kPersonalOptionsSubPage[] =  "personal";
196const char kSearchEnginesSubPage[] = "searchEngines";
197#if defined(OS_CHROMEOS)
198const char kInternetOptionsSubPage[] = "internet";
199const char kLanguageOptionsSubPage[] = "languages";
200const char kSystemOptionsSubPage[] = "system";
201#endif
202
203const char kChromeHelpURL[] =
204#if defined(OS_CHROMEOS)
205  "http://www.google.com/support/chromeos/";
206#else
207  "http://www.google.com/support/chrome/";
208#endif
209
210  const char kPageInfoHelpCenterURL[] =
211#if defined(OS_CHROMEOS)
212    "http://www.google.com/support/chromeos/bin/answer.py?answer=95617";
213#else
214    "http://www.google.com/support/chrome/bin/answer.py?answer=95617";
215#endif
216
217const char kCrashReasonURL[] =
218#if defined(OS_CHROMEOS)
219    "http://www.google.com/support/chromeos/bin/answer.py?answer=1047340";
220#else
221    "http://www.google.com/support/chrome/bin/answer.py?answer=95669";
222#endif
223
224// TODO: These are currently placeholders that point to the crash
225// docs.  See bug http://crosbug.com/10711
226const char kKillReasonURL[] =
227#if defined(OS_CHROMEOS)
228    "http://www.google.com/support/chromeos/bin/answer.py?answer=1047340";
229#else
230    "http://www.google.com/support/chrome/bin/answer.py?answer=95669";
231#endif
232
233const char kPrivacyLearnMoreURL[] =
234#if defined(OS_CHROMEOS)
235    "http://www.google.com/support/chromeos/bin/answer.py?answer=1047334";
236#else
237    "http://www.google.com/support/chrome/bin/answer.py?answer=114836";
238#endif
239
240const char kChromiumProjectURL[] = "http://code.google.com/chromium/";
241
242const char kLearnMoreReportingURL[] =
243    "http://www.google.com/support/chrome/bin/answer.py?answer=96817";
244
245const char kOutdatedPluginLearnMoreURL[] =
246    "http://www.google.com/support/chrome/bin/answer.py?answer=1181003";
247
248void RegisterChromeSchemes() {
249  // Don't need "chrome-internal" which was used in old versions of Chrome for
250  // the new tab page.
251  url_util::AddStandardScheme(kChromeDevToolsScheme);
252  url_util::AddStandardScheme(kChromeUIScheme);
253  url_util::AddStandardScheme(kGearsScheme);
254  url_util::AddStandardScheme(kExtensionScheme);
255  url_util::AddStandardScheme(kMetadataScheme);
256#if defined(OS_CHROMEOS)
257  url_util::AddStandardScheme(kCrosScheme);
258#endif
259
260  // Prevent future modification of the standard schemes list. This is to
261  // prevent accidental creation of data races in the program. AddStandardScheme
262  // isn't threadsafe so must be called when GURL isn't used on any other
263  // thread. This is really easy to mess up, so we say that all calls to
264  // AddStandardScheme in Chrome must be inside this function.
265  url_util::LockStandardSchemes();
266}
267
268}  // namespace chrome
269