diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebKit/chromium/src/WebHistoryItem.cpp | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit/chromium/src/WebHistoryItem.cpp')
-rw-r--r-- | Source/WebKit/chromium/src/WebHistoryItem.cpp | 329 |
1 files changed, 0 insertions, 329 deletions
diff --git a/Source/WebKit/chromium/src/WebHistoryItem.cpp b/Source/WebKit/chromium/src/WebHistoryItem.cpp deleted file mode 100644 index 976594c9c..000000000 --- a/Source/WebKit/chromium/src/WebHistoryItem.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (C) 2009 Google 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: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 THE COPYRIGHT - * OWNER 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 "WebHistoryItem.h" - -#include "FormController.h" -#include "FormData.h" -#include "HistoryItem.h" -#include "KURL.h" -#include "SerializedScriptValue.h" -#include "platform/WebSerializedScriptValue.h" -#include <public/WebHTTPBody.h> -#include <public/WebPoint.h> -#include <public/WebString.h> -#include <public/WebVector.h> - -using namespace WebCore; - -namespace WebKit { - -void WebHistoryItem::initialize() -{ - m_private = HistoryItem::create(); -} - -void WebHistoryItem::reset() -{ - m_private.reset(); -} - -void WebHistoryItem::assign(const WebHistoryItem& other) -{ - m_private = other.m_private; -} - -WebString WebHistoryItem::urlString() const -{ - return m_private->urlString(); -} - -void WebHistoryItem::setURLString(const WebString& url) -{ - ensureMutable(); - m_private->setURLString(KURL(ParsedURLString, url).string()); -} - -WebString WebHistoryItem::originalURLString() const -{ - return m_private->originalURLString(); -} - -void WebHistoryItem::setOriginalURLString(const WebString& originalURLString) -{ - ensureMutable(); - m_private->setOriginalURLString(originalURLString); -} - -WebString WebHistoryItem::referrer() const -{ - return m_private->referrer(); -} - -void WebHistoryItem::setReferrer(const WebString& referrer) -{ - ensureMutable(); - m_private->setReferrer(referrer); -} - -WebString WebHistoryItem::target() const -{ - return m_private->target(); -} - -void WebHistoryItem::setTarget(const WebString& target) -{ - ensureMutable(); - m_private->setTarget(target); -} - -WebString WebHistoryItem::parent() const -{ - return m_private->parent(); -} - -void WebHistoryItem::setParent(const WebString& parent) -{ - ensureMutable(); - m_private->setParent(parent); -} - -WebString WebHistoryItem::title() const -{ - return m_private->title(); -} - -void WebHistoryItem::setTitle(const WebString& title) -{ - ensureMutable(); - m_private->setTitle(title); -} - -WebString WebHistoryItem::alternateTitle() const -{ - return m_private->alternateTitle(); -} - -void WebHistoryItem::setAlternateTitle(const WebString& alternateTitle) -{ - ensureMutable(); - m_private->setAlternateTitle(alternateTitle); -} - -double WebHistoryItem::lastVisitedTime() const -{ - return m_private->lastVisitedTime(); -} - -void WebHistoryItem::setLastVisitedTime(double lastVisitedTime) -{ - ensureMutable(); - // FIXME: setLastVisitedTime increments the visit count, so we have to - // correct for that. Instead, we should have a back-door to just mutate - // the last visited time directly. - int count = m_private->visitCount(); - m_private->setLastVisitedTime(lastVisitedTime); - m_private->setVisitCount(count); -} - -WebPoint WebHistoryItem::scrollOffset() const -{ - return m_private->scrollPoint(); -} - -void WebHistoryItem::setScrollOffset(const WebPoint& scrollOffset) -{ - ensureMutable(); - m_private->setScrollPoint(scrollOffset); -} - -float WebHistoryItem::pageScaleFactor() const -{ - return m_private->pageScaleFactor(); -} - -void WebHistoryItem::setPageScaleFactor(float scale) -{ - ensureMutable(); - m_private->setPageScaleFactor(scale); -} - -bool WebHistoryItem::isTargetItem() const -{ - return m_private->isTargetItem(); -} - -void WebHistoryItem::setIsTargetItem(bool isTargetItem) -{ - ensureMutable(); - m_private->setIsTargetItem(isTargetItem); -} - -int WebHistoryItem::visitCount() const -{ - return m_private->visitCount(); -} - -void WebHistoryItem::setVisitCount(int count) -{ - ensureMutable(); - m_private->setVisitCount(count); -} - -WebVector<WebString> WebHistoryItem::documentState() const -{ - return m_private->documentState(); -} - -void WebHistoryItem::setDocumentState(const WebVector<WebString>& state) -{ - ensureMutable(); - // FIXME: would be nice to avoid the intermediate copy - Vector<String> ds; - for (size_t i = 0; i < state.size(); ++i) - ds.append(state[i]); - m_private->setDocumentState(ds); -} - -long long WebHistoryItem::itemSequenceNumber() const -{ - return m_private->itemSequenceNumber(); -} - -void WebHistoryItem::setItemSequenceNumber(long long itemSequenceNumber) -{ - ensureMutable(); - m_private->setItemSequenceNumber(itemSequenceNumber); -} - -long long WebHistoryItem::documentSequenceNumber() const -{ - return m_private->documentSequenceNumber(); -} - -void WebHistoryItem::setDocumentSequenceNumber(long long documentSequenceNumber) -{ - ensureMutable(); - m_private->setDocumentSequenceNumber(documentSequenceNumber); -} - -WebSerializedScriptValue WebHistoryItem::stateObject() const -{ - return WebSerializedScriptValue(m_private->stateObject()); -} - -void WebHistoryItem::setStateObject(const WebSerializedScriptValue& object) -{ - ensureMutable(); - m_private->setStateObject(object); -} - -WebString WebHistoryItem::httpContentType() const -{ - return m_private->formContentType(); -} - -void WebHistoryItem::setHTTPContentType(const WebString& httpContentType) -{ - ensureMutable(); - m_private->setFormContentType(httpContentType); -} - -WebHTTPBody WebHistoryItem::httpBody() const -{ - return WebHTTPBody(m_private->formData()); -} - -void WebHistoryItem::setHTTPBody(const WebHTTPBody& httpBody) -{ - ensureMutable(); - m_private->setFormData(httpBody); -} - -WebVector<WebHistoryItem> WebHistoryItem::children() const -{ - return m_private->children(); -} - -void WebHistoryItem::setChildren(const WebVector<WebHistoryItem>& items) -{ - ensureMutable(); - m_private->clearChildren(); - for (size_t i = 0; i < items.size(); ++i) - m_private->addChildItem(items[i]); -} - -void WebHistoryItem::appendToChildren(const WebHistoryItem& item) -{ - ensureMutable(); - m_private->addChildItem(item); -} - -WebVector<WebString> WebHistoryItem::getReferencedFilePaths() const -{ - Vector<WebString> filePaths; - const FormData* formData = m_private->formData(); - if (formData) { - for (size_t i = 0; i < formData->elements().size(); ++i) { - const FormDataElement& element = formData->elements()[i]; - if (element.m_type == FormDataElement::encodedFile) - filePaths.append(element.m_filename); - } - } - const Vector<String>& selectedFilePaths = WebCore::FormController::getReferencedFilePaths(m_private->documentState()); - for (size_t i = 0; i < selectedFilePaths.size(); ++i) - filePaths.append(selectedFilePaths[i]); - return filePaths; -} - -WebHistoryItem::WebHistoryItem(const PassRefPtr<HistoryItem>& item) - : m_private(item) -{ -} - -WebHistoryItem& WebHistoryItem::operator=(const PassRefPtr<HistoryItem>& item) -{ - m_private = item; - return *this; -} - -WebHistoryItem::operator PassRefPtr<HistoryItem>() const -{ - return m_private.get(); -} - -void WebHistoryItem::ensureMutable() -{ - if (!m_private->hasOneRef()) - m_private = m_private->copy(); -} - -} // namespace WebKit |