2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef WebHistoryItem_h
32 #define WebHistoryItem_h
34 #include "WebCommon.h"
35 #include "WebPrivatePtr.h"
37 namespace WebCore { class HistoryItem; }
42 class WebSerializedScriptValue;
44 template <typename T> class WebVector;
46 // Represents a frame-level navigation entry in session history. A
47 // WebHistoryItem is a node in a tree.
49 // Copying a WebHistoryItem is cheap.
51 class WebHistoryItem {
53 ~WebHistoryItem() { reset(); }
56 WebHistoryItem(const WebHistoryItem& h) { assign(h); }
57 WebHistoryItem& operator=(const WebHistoryItem& h)
63 WEBKIT_EXPORT void initialize();
64 WEBKIT_EXPORT void reset();
65 WEBKIT_EXPORT void assign(const WebHistoryItem&);
67 bool isNull() const { return m_private.isNull(); }
69 WEBKIT_EXPORT WebString urlString() const;
70 WEBKIT_EXPORT void setURLString(const WebString&);
72 WEBKIT_EXPORT WebString originalURLString() const;
73 WEBKIT_EXPORT void setOriginalURLString(const WebString&);
75 WEBKIT_EXPORT WebString referrer() const;
76 WEBKIT_EXPORT void setReferrer(const WebString&);
78 WEBKIT_EXPORT WebString target() const;
79 WEBKIT_EXPORT void setTarget(const WebString&);
81 WEBKIT_EXPORT WebString parent() const;
82 WEBKIT_EXPORT void setParent(const WebString&);
84 WEBKIT_EXPORT WebString title() const;
85 WEBKIT_EXPORT void setTitle(const WebString&);
87 WEBKIT_EXPORT WebString alternateTitle() const;
88 WEBKIT_EXPORT void setAlternateTitle(const WebString&);
90 WEBKIT_EXPORT double lastVisitedTime() const;
91 WEBKIT_EXPORT void setLastVisitedTime(double);
93 WEBKIT_EXPORT WebPoint scrollOffset() const;
94 WEBKIT_EXPORT void setScrollOffset(const WebPoint&);
96 WEBKIT_EXPORT float pageScaleFactor() const;
97 WEBKIT_EXPORT void setPageScaleFactor(float);
99 WEBKIT_EXPORT bool isTargetItem() const;
100 WEBKIT_EXPORT void setIsTargetItem(bool);
102 WEBKIT_EXPORT int visitCount() const;
103 WEBKIT_EXPORT void setVisitCount(int);
105 WEBKIT_EXPORT WebVector<WebString> documentState() const;
106 WEBKIT_EXPORT void setDocumentState(const WebVector<WebString>&);
108 WEBKIT_EXPORT long long itemSequenceNumber() const;
109 WEBKIT_EXPORT void setItemSequenceNumber(long long);
111 WEBKIT_EXPORT long long documentSequenceNumber() const;
112 WEBKIT_EXPORT void setDocumentSequenceNumber(long long);
114 WEBKIT_EXPORT WebSerializedScriptValue stateObject() const;
115 WEBKIT_EXPORT void setStateObject(const WebSerializedScriptValue&);
117 WEBKIT_EXPORT WebString httpContentType() const;
118 WEBKIT_EXPORT void setHTTPContentType(const WebString&);
120 WEBKIT_EXPORT WebHTTPBody httpBody() const;
121 WEBKIT_EXPORT void setHTTPBody(const WebHTTPBody&);
123 WEBKIT_EXPORT WebVector<WebHistoryItem> children() const;
124 WEBKIT_EXPORT void setChildren(const WebVector<WebHistoryItem>&);
125 WEBKIT_EXPORT void appendToChildren(const WebHistoryItem&);
127 #if WEBKIT_IMPLEMENTATION
128 WebHistoryItem(const WTF::PassRefPtr<WebCore::HistoryItem>&);
129 WebHistoryItem& operator=(const WTF::PassRefPtr<WebCore::HistoryItem>&);
130 operator WTF::PassRefPtr<WebCore::HistoryItem>() const;
134 void ensureMutable();
135 WebPrivatePtr<WebCore::HistoryItem> m_private;
138 } // namespace WebKit