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