1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_COMMON_PAGE_STATE_H_
6 #define CONTENT_PUBLIC_COMMON_PAGE_STATE_H_
11 #include "content/common/content_export.h"
21 // The PageState class represents the information needed by the rendering
22 // engine to reconstruct a web page (and its tree of frames), including for
23 // example the URLs of the documents and the values of any form fields. This
24 // information is used when navigating back & forward through session history.
26 // The browser process only sees the encoded form of the data, which is
27 // designed as an archival format. The renderer process can decode the data
28 // using methods found in public/renderer/history_item_serialization.h.
29 class CONTENT_EXPORT PageState
{
31 static PageState
CreateFromEncodedData(const std::string
& data
);
32 static PageState
CreateFromURL(const GURL
& url
);
34 static PageState
CreateForTesting(
36 bool body_contains_password_data
,
37 const char* optional_body_data
,
38 const base::FilePath
* optional_body_file_path
);
43 bool Equals(const PageState
& page_state
) const;
44 const std::string
& ToEncodedData() const;
46 std::vector
<base::FilePath
> GetReferencedFiles() const;
47 PageState
RemovePasswordData() const;
48 PageState
RemoveScrollOffset() const;
51 PageState(const std::string
& data
);
56 // Support DCHECK_EQ(a, b), etc.
57 inline bool operator==(const PageState
& a
, const PageState
& b
) {
60 inline bool operator!=(const PageState
& a
, const PageState
& b
) {
64 } // namespace content
66 #endif // CONTENT_PUBLIC_COMMON_PAGE_STATE_H_