Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / web / WebHistoryItem.h
blob6f34c615677ddfb3f17318da4a12c513b98f533f
1 /*
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
6 * met:
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
13 * distribution.
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 "../platform/WebCommon.h"
35 #include "../platform/WebHistoryScrollRestorationType.h"
36 #include "../platform/WebPrivatePtr.h"
37 #include "../platform/WebReferrerPolicy.h"
39 namespace blink {
41 class HistoryItem;
42 class WebHTTPBody;
43 class WebString;
44 class WebSerializedScriptValue;
45 struct WebFloatPoint;
46 struct WebPoint;
47 template <typename T> class WebVector;
49 enum WebHistoryLoadType {
50 WebHistorySameDocumentLoad,
51 WebHistoryDifferentDocumentLoad
54 // Represents a frame-level navigation entry in session history. A
55 // WebHistoryItem is a node in a tree.
57 // Copying a WebHistoryItem is cheap.
59 class WebHistoryItem {
60 public:
61 ~WebHistoryItem() { reset(); }
63 WebHistoryItem() { }
64 WebHistoryItem(const WebHistoryItem& h) { assign(h); }
65 WebHistoryItem& operator=(const WebHistoryItem& h)
67 assign(h);
68 return *this;
71 BLINK_EXPORT void initialize();
72 BLINK_EXPORT void reset();
73 BLINK_EXPORT void assign(const WebHistoryItem&);
75 bool isNull() const { return m_private.isNull(); }
77 BLINK_EXPORT WebString urlString() const;
78 BLINK_EXPORT void setURLString(const WebString&);
80 BLINK_EXPORT WebString referrer() const;
81 BLINK_EXPORT WebReferrerPolicy referrerPolicy() const;
82 BLINK_EXPORT void setReferrer(const WebString&, WebReferrerPolicy);
84 BLINK_EXPORT WebString target() const;
85 BLINK_EXPORT void setTarget(const WebString&);
87 BLINK_EXPORT WebFloatPoint visualViewportScrollOffset() const;
88 BLINK_EXPORT void setVisualViewportScrollOffset(const WebFloatPoint&);
90 // TODO(bokan): Renamed to the above versions. Remove once chromium
91 // callers are renamed.
92 BLINK_EXPORT WebFloatPoint pinchViewportScrollOffset() const;
93 BLINK_EXPORT void setPinchViewportScrollOffset(const WebFloatPoint&);
95 BLINK_EXPORT WebPoint scrollOffset() const;
96 BLINK_EXPORT void setScrollOffset(const WebPoint&);
98 BLINK_EXPORT float pageScaleFactor() const;
99 BLINK_EXPORT void setPageScaleFactor(float);
101 BLINK_EXPORT WebVector<WebString> documentState() const;
102 BLINK_EXPORT void setDocumentState(const WebVector<WebString>&);
104 BLINK_EXPORT long long itemSequenceNumber() const;
105 BLINK_EXPORT void setItemSequenceNumber(long long);
107 BLINK_EXPORT long long documentSequenceNumber() const;
108 BLINK_EXPORT void setDocumentSequenceNumber(long long);
110 BLINK_EXPORT WebHistoryScrollRestorationType scrollRestorationType() const;
111 BLINK_EXPORT void setScrollRestorationType(WebHistoryScrollRestorationType);
113 BLINK_EXPORT WebSerializedScriptValue stateObject() const;
114 BLINK_EXPORT void setStateObject(const WebSerializedScriptValue&);
116 BLINK_EXPORT WebString httpContentType() const;
117 BLINK_EXPORT void setHTTPContentType(const WebString&);
119 BLINK_EXPORT WebHTTPBody httpBody() const;
120 BLINK_EXPORT void setHTTPBody(const WebHTTPBody&);
122 BLINK_EXPORT WebVector<WebString> getReferencedFilePaths() const;
124 #if BLINK_IMPLEMENTATION
125 WebHistoryItem(const PassRefPtrWillBeRawPtr<HistoryItem>&);
126 WebHistoryItem& operator=(const PassRefPtrWillBeRawPtr<HistoryItem>&);
127 operator PassRefPtrWillBeRawPtr<HistoryItem>() const;
128 #endif
130 private:
131 WebPrivatePtr<HistoryItem> m_private;
134 } // namespace blink
136 #endif