1/* 2 * Copyright (C) 2011 Igalia S.L. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20#include "config.h" 21#include "ErrorsGtk.h" 22 23#include "ResourceError.h" 24#include "ResourceRequest.h" 25#include "ResourceResponse.h" 26#include <glib/gi18n-lib.h> 27 28namespace WebCore { 29 30ResourceError cancelledError(const ResourceRequest& request) 31{ 32 return ResourceError(errorDomainNetwork, NetworkErrorCancelled, 33 request.url().string(), _("Load request cancelled")); 34} 35 36ResourceError blockedError(const ResourceRequest& request) 37{ 38 return ResourceError(errorDomainPolicy, PolicyErrorCannotUseRestrictedPort, 39 request.url().string(), _("Not allowed to use restricted network port")); 40} 41 42ResourceError cannotShowURLError(const ResourceRequest& request) 43{ 44 return ResourceError(errorDomainPolicy, PolicyErrorCannotShowURL, 45 request.url().string(), _("URL cannot be shown")); 46} 47 48ResourceError interruptedForPolicyChangeError(const ResourceRequest& request) 49{ 50 return ResourceError(errorDomainPolicy, PolicyErrorFrameLoadInterruptedByPolicyChange, 51 request.url().string(), _("Frame load was interrupted")); 52} 53 54ResourceError cannotShowMIMETypeError(const ResourceResponse& response) 55{ 56 return ResourceError(errorDomainPolicy, PolicyErrorCannotShowMimeType, 57 response.url().string(), _("Content with the specified MIME type cannot be shown")); 58} 59 60ResourceError fileDoesNotExistError(const ResourceResponse& response) 61{ 62 return ResourceError(errorDomainNetwork, NetworkErrorFileDoesNotExist, 63 response.url().string(), _("File does not exist")); 64} 65 66ResourceError pluginWillHandleLoadError(const ResourceResponse& response) 67{ 68 return ResourceError(errorDomainPlugin, PluginErrorWillHandleLoad, 69 response.url().string(), _("Plugin will handle load")); 70} 71 72ResourceError downloadNetworkError(const ResourceError& networkError) 73{ 74 return ResourceError(errorDomainDownload, DownloadErrorNetwork, 75 networkError.failingURL(), networkError.localizedDescription()); 76} 77 78ResourceError downloadCancelledByUserError(const ResourceResponse& response) 79{ 80 return ResourceError(errorDomainDownload, DownloadErrorCancelledByUser, 81 response.url().string(), _("User cancelled the download")); 82} 83 84ResourceError downloadDestinationError(const ResourceResponse& response, const String& errorMessage) 85{ 86 return ResourceError(errorDomainDownload, DownloadErrorDestination, 87 response.url().string(), errorMessage); 88} 89 90ResourceError printError(const URL& failingURL, const String& errorMessage) 91{ 92 return ResourceError(errorDomainPrint, PrintErrorGeneral, failingURL, errorMessage); 93} 94 95ResourceError printerNotFoundError(const URL& failingURL) 96{ 97 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, failingURL, _("Printer not found")); 98} 99 100ResourceError invalidPageRangeToPrint(const URL& failingURL) 101{ 102 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, failingURL, _("Invalid page range")); 103} 104 105} // namespace WebCore 106