diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/loader/SubstituteData.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/loader/SubstituteData.h')
-rw-r--r-- | Source/WebCore/loader/SubstituteData.h | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/Source/WebCore/loader/SubstituteData.h b/Source/WebCore/loader/SubstituteData.h index 2959de7a8..f10135159 100644 --- a/Source/WebCore/loader/SubstituteData.h +++ b/Source/WebCore/loader/SubstituteData.h @@ -10,10 +10,10 @@ * 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 + * THIS SOFTWARE IS PROVIDED BY APPLE 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 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE 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 @@ -23,56 +23,48 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SubstituteData_h -#define SubstituteData_h +#pragma once -#include "URL.h" +#include "ResourceResponse.h" #include "SharedBuffer.h" -#include <wtf/PassRefPtr.h> +#include "URL.h" #include <wtf/RefPtr.h> namespace WebCore { class SubstituteData { public: + enum class SessionHistoryVisibility { + Visible, + Hidden, + }; + SubstituteData() - : m_shouldRevealToSessionHistory(false) { } - SubstituteData(PassRefPtr<SharedBuffer> content, const String& mimeType, - const String& textEncoding, const URL& failingURL, - const URL& responseURL = URL(), bool shouldRevealToSessionHistory = false) - : m_content(content) - , m_mimeType(mimeType) - , m_textEncoding(textEncoding) + SubstituteData(RefPtr<SharedBuffer>&& content, const URL& failingURL, const ResourceResponse& response, SessionHistoryVisibility shouldRevealToSessionHistory) + : m_content(WTFMove(content)) , m_failingURL(failingURL) - , m_responseURL(responseURL) + , m_response(response) , m_shouldRevealToSessionHistory(shouldRevealToSessionHistory) { } - static const bool ShouldRevealToSessionHistory = true; - - bool isValid() const { return m_content != 0; } - bool shouldRevealToSessionHistory() const { return m_shouldRevealToSessionHistory; } + bool isValid() const { return m_content != nullptr; } + bool shouldRevealToSessionHistory() const { return m_shouldRevealToSessionHistory == SessionHistoryVisibility::Visible; } const SharedBuffer* content() const { return m_content.get(); } - const String& mimeType() const { return m_mimeType; } - const String& textEncoding() const { return m_textEncoding; } + const String& mimeType() const { return m_response.mimeType(); } + const String& textEncoding() const { return m_response.textEncodingName(); } const URL& failingURL() const { return m_failingURL; } - const URL& responseURL() const { return m_responseURL; } + const ResourceResponse& response() const { return m_response; } private: RefPtr<SharedBuffer> m_content; - String m_mimeType; - String m_textEncoding; URL m_failingURL; - URL m_responseURL; - bool m_shouldRevealToSessionHistory; + ResourceResponse m_response; + SessionHistoryVisibility m_shouldRevealToSessionHistory { SessionHistoryVisibility::Hidden }; }; -} - -#endif // SubstituteData_h - +} // namespace WebCore |