diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-03 21:32:17 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-03 21:32:17 +0000 |
commit | ab19f19101f209e7c13af6762ee5a7a7dcd47d83 (patch) | |
tree | 47c0a700462eb4f7f665ab8417af9d52589f12c7 /webkit | |
parent | 5095120b4a2b3e108dbd4c6d9d0c19462e63142b (diff) | |
download | chromium_src-ab19f19101f209e7c13af6762ee5a7a7dcd47d83.zip chromium_src-ab19f19101f209e7c13af6762ee5a7a7dcd47d83.tar.gz chromium_src-ab19f19101f209e7c13af6762ee5a7a7dcd47d83.tar.bz2 |
Unfork ResourceResponseBase.cpp
Review URL: http://codereview.chromium.org/6464
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/pending/ResourceResponseBase.cpp | 251 | ||||
-rw-r--r-- | webkit/webkit.xcodeproj/project.pbxproj | 8 |
2 files changed, 4 insertions, 255 deletions
diff --git a/webkit/pending/ResourceResponseBase.cpp b/webkit/pending/ResourceResponseBase.cpp deleted file mode 100644 index 6e5d8e8..0000000 --- a/webkit/pending/ResourceResponseBase.cpp +++ /dev/null @@ -1,251 +0,0 @@ -// -*- mode: c++; c-basic-offset: 4 -*- -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ResourceResponseBase.h" -#include "ResourceResponse.h" - -namespace WebCore { - -inline const ResourceResponse& ResourceResponseBase::asResourceResponse() const -{ - return *static_cast<const ResourceResponse*>(this); -} - -bool ResourceResponseBase::isHTTP() const -{ - updateResourceResponse(); - - String protocol = m_url.protocol(); - - return equalIgnoringCase(protocol, "http") || equalIgnoringCase(protocol, "https"); -} - -const KURL& ResourceResponseBase::url() const -{ - updateResourceResponse(); - - return m_url; -} - -void ResourceResponseBase::setUrl(const KURL& url) -{ - updateResourceResponse(); - m_isNull = false; - - m_url = url; -} - -const String& ResourceResponseBase::mimeType() const -{ - updateResourceResponse(); - - return m_mimeType; -} - -void ResourceResponseBase::setMimeType(const String& mimeType) -{ - updateResourceResponse(); - m_isNull = false; - - m_mimeType = mimeType; -} - -long long ResourceResponseBase::expectedContentLength() const -{ - updateResourceResponse(); - - return m_expectedContentLength; -} - -void ResourceResponseBase::setExpectedContentLength(long long expectedContentLength) -{ - updateResourceResponse(); - m_isNull = false; - - m_expectedContentLength = expectedContentLength; -} - -const String& ResourceResponseBase::textEncodingName() const -{ - updateResourceResponse(); - - return m_textEncodingName; -} - -void ResourceResponseBase::setTextEncodingName(const String& encodingName) -{ - updateResourceResponse(); - m_isNull = false; - - m_textEncodingName = encodingName; -} - -// FIXME should compute this on the fly -const String& ResourceResponseBase::suggestedFilename() const -{ - updateResourceResponse(); - - return m_suggestedFilename; -} - -void ResourceResponseBase::setSuggestedFilename(const String& suggestedName) -{ - updateResourceResponse(); - m_isNull = false; - - m_suggestedFilename = suggestedName; -} - -int ResourceResponseBase::httpStatusCode() const -{ - updateResourceResponse(); - - return m_httpStatusCode; -} - -void ResourceResponseBase::setHTTPStatusCode(int statusCode) -{ - updateResourceResponse(); - - m_httpStatusCode = statusCode; -} - -const String& ResourceResponseBase::httpStatusText() const -{ - updateResourceResponse(); - - return m_httpStatusText; -} - -void ResourceResponseBase::setHTTPStatusText(const String& statusText) -{ - updateResourceResponse(); - - m_httpStatusText = statusText; -} - -String ResourceResponseBase::httpHeaderField(const String& name) const -{ - updateResourceResponse(); - - return m_httpHeaderFields.get(name); -} - -void ResourceResponseBase::setHTTPHeaderField(const String& name, const String& value) -{ - updateResourceResponse(); - - m_httpHeaderFields.set(name, value); -} - -const HTTPHeaderMap& ResourceResponseBase::httpHeaderFields() const -{ - updateResourceResponse(); - - return m_httpHeaderFields; -} - -bool ResourceResponseBase::isAttachment() const -{ - updateResourceResponse(); - - String value = m_httpHeaderFields.get("Content-Disposition"); - int loc = value.find(';'); - if (loc != -1) - value = value.left(loc); - value = value.stripWhiteSpace(); - return equalIgnoringCase(value, "attachment"); -} - -void ResourceResponseBase::setExpirationDate(time_t expirationDate) -{ - updateResourceResponse(); - - m_expirationDate = expirationDate; -} - -time_t ResourceResponseBase::expirationDate() const -{ - updateResourceResponse(); - - return m_expirationDate; -} - -void ResourceResponseBase::setLastModifiedDate(time_t lastModifiedDate) -{ - updateResourceResponse(); - - m_lastModifiedDate = lastModifiedDate; -} - -time_t ResourceResponseBase::lastModifiedDate() const -{ - updateResourceResponse(); - - return m_lastModifiedDate; -} - -void ResourceResponseBase::updateResourceResponse() const -{ - if (m_isUpToDate) - return; - - const_cast<ResourceResponse&>(asResourceResponse()).doUpdateResourceResponse(); - - m_isUpToDate = true; -} - -bool operator==(const ResourceResponse& a, const ResourceResponse& b) -{ - if (a.isNull() != b.isNull()) - return false; - if (a.url() != b.url()) - return false; - if (a.mimeType() != b.mimeType()) - return false; - if (a.expectedContentLength() != b.expectedContentLength()) - return false; - if (a.textEncodingName() != b.textEncodingName()) - return false; - if (a.suggestedFilename() != b.suggestedFilename()) - return false; - if (a.httpStatusCode() != b.httpStatusCode()) - return false; - if (a.httpStatusText() != b.httpStatusText()) - return false; - if (a.httpHeaderFields() != b.httpHeaderFields()) - return false; - if (a.expirationDate() != b.expirationDate()) - return false; -#if PLATFORM(MAC) && !PLATFORM(CHROMIUM) - if (a.nsURLResponse() != b.nsURLResponse()) - return false; -#endif - return true; - } - -} diff --git a/webkit/webkit.xcodeproj/project.pbxproj b/webkit/webkit.xcodeproj/project.pbxproj index 70d1944..4a4fcc8 100644 --- a/webkit/webkit.xcodeproj/project.pbxproj +++ b/webkit/webkit.xcodeproj/project.pbxproj @@ -331,6 +331,7 @@ B5599D0F0E95929900E2A85A /* SVGFEColorMatrixElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5599D0E0E95929900E2A85A /* SVGFEColorMatrixElement.cpp */; }; B5599D130E95942900E2A85A /* SVGDocumentExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5599D120E95942900E2A85A /* SVGDocumentExtensions.cpp */; }; B5599D160E9594E800E2A85A /* SVGImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5599D140E9594E800E2A85A /* SVGImage.cpp */; }; + B57635F80E96C13D008A7ABC /* ResourceResponseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B57635F70E96C13D008A7ABC /* ResourceResponseBase.cpp */; }; B5C180770E9581B6006EAF87 /* TextCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C180750E9581B6006EAF87 /* TextCodec.cpp */; }; B5C180790E9581CB006EAF87 /* TextCodecUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C180780E9581CB006EAF87 /* TextCodecUTF16.cpp */; }; B5C1807B0E9581DE006EAF87 /* TextDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C1807A0E9581DE006EAF87 /* TextDecoder.cpp */; }; @@ -748,7 +749,6 @@ E45625240E268E87005E4685 /* ResourceErrorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E91450D7F3CC2001ECF42 /* ResourceErrorMac.mm */; }; E45625250E268E87005E4685 /* ResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E91470D7F3CC2001ECF42 /* ResourceHandle.cpp */; }; E45625260E268E87005E4685 /* ResourceRequestBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E914B0D7F3CC2001ECF42 /* ResourceRequestBase.cpp */; }; - E45625270E268E87005E4685 /* ResourceResponseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E914D0D7F3CC2001ECF42 /* ResourceResponseBase.cpp */; }; E45625280E268E87005E4685 /* FileSystemPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E915D0D7F3CC2001ECF42 /* FileSystemPOSIX.cpp */; }; E456252A0E268E87005E4685 /* ScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E91870D7F3CC2001ECF42 /* ScrollBar.cpp */; }; E456252B0E268E87005E4685 /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B5E918C0D7F3CC2001ECF42 /* SecurityOrigin.cpp */; }; @@ -2734,7 +2734,6 @@ 7B5E914A0D7F3CC2001ECF42 /* ResourceHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceHandleInternal.h; sourceTree = "<group>"; }; 7B5E914B0D7F3CC2001ECF42 /* ResourceRequestBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceRequestBase.cpp; sourceTree = "<group>"; }; 7B5E914C0D7F3CC2001ECF42 /* ResourceRequestBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRequestBase.h; sourceTree = "<group>"; }; - 7B5E914D0D7F3CC2001ECF42 /* ResourceResponseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ResourceResponseBase.cpp; path = ../../../../../webkit/pending/ResourceResponseBase.cpp; sourceTree = "<group>"; }; 7B5E914E0D7F3CC2001ECF42 /* ResourceResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceResponseBase.h; sourceTree = "<group>"; }; 7B5E91530D7F3CC2001ECF42 /* NotImplemented.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotImplemented.h; sourceTree = "<group>"; }; 7B5E91540D7F3CC2001ECF42 /* Pasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pasteboard.h; sourceTree = "<group>"; }; @@ -3573,6 +3572,7 @@ B5599D120E95942900E2A85A /* SVGDocumentExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGDocumentExtensions.cpp; sourceTree = "<group>"; }; B5599D140E9594E800E2A85A /* SVGImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImage.cpp; sourceTree = "<group>"; }; B5599D150E9594E800E2A85A /* SVGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImage.h; sourceTree = "<group>"; }; + B57635F70E96C13D008A7ABC /* ResourceResponseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceResponseBase.cpp; sourceTree = "<group>"; }; B5C180740E95816D006EAF87 /* StringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHash.h; sourceTree = "<group>"; }; B5C180750E9581B6006EAF87 /* TextCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodec.cpp; sourceTree = "<group>"; }; B5C180760E9581B6006EAF87 /* TextCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodec.h; sourceTree = "<group>"; }; @@ -4969,7 +4969,7 @@ 7B5E914A0D7F3CC2001ECF42 /* ResourceHandleInternal.h */, 7B5E914B0D7F3CC2001ECF42 /* ResourceRequestBase.cpp */, 7B5E914C0D7F3CC2001ECF42 /* ResourceRequestBase.h */, - 7B5E914D0D7F3CC2001ECF42 /* ResourceResponseBase.cpp */, + B57635F70E96C13D008A7ABC /* ResourceResponseBase.cpp */, 7B5E914E0D7F3CC2001ECF42 /* ResourceResponseBase.h */, ); path = network; @@ -7608,7 +7608,7 @@ E45624960E268E87005E4685 /* ResourceLoader.cpp in Sources */, 827E13880E815A0500183614 /* ResourceLoaderMac.mm in Sources */, E45625260E268E87005E4685 /* ResourceRequestBase.cpp in Sources */, - E45625270E268E87005E4685 /* ResourceResponseBase.cpp in Sources */, + B57635F80E96C13D008A7ABC /* ResourceResponseBase.cpp in Sources */, E45625930E268E87005E4685 /* RootInlineBox.cpp in Sources */, E45624B00E268E87005E4685 /* Screen.cpp in Sources */, E456252A0E268E87005E4685 /* ScrollBar.cpp in Sources */, |