Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: content/public/common/page_state.h

Issue 14985014: Introduce content::PageState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to the top of page_state.h Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_PUBLIC_COMMON_PAGE_STATE_H_
6 #define CONTENT_PUBLIC_COMMON_PAGE_STATE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "content/common/content_export.h"
12
13 class GURL;
14
15 namespace base {
16 class FilePath;
17 }
18
19 namespace content {
20
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.
25 //
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
Tom Sepez 2013/05/24 17:46:49 Is this true if the browser is going to crack this
28 // using methods found in public/renderer/history_item_serialization.h.
29 class CONTENT_EXPORT PageState {
30 public:
31 static PageState CreateFromEncodedData(const std::string& data);
32 static PageState CreateFromURL(const GURL& url);
33
34 static PageState CreateForTesting(
35 const GURL& url,
36 bool body_contains_password_data,
37 const char* optional_body_data,
38 const base::FilePath* optional_body_file_path);
39
40 PageState();
41
42 bool IsValid() const;
43 bool Equals(const PageState& page_state) const;
brettw 2013/05/23 23:38:39 I guess I don't feel that strongly, but since we'r
44 const std::string& ToEncodedData() const;
45
46 std::vector<base::FilePath> GetReferencedFiles() const;
47 PageState RemovePasswordData() const;
48 PageState RemoveScrollOffset() const;
49
50 private:
51 PageState(const std::string& data);
52
53 std::string data_;
Tom Sepez 2013/05/24 17:46:49 I had imagined that in addition to the string, the
54 };
55
56 // Support DCHECK_EQ(a, b), etc.
57 inline bool operator==(const PageState& a, const PageState& b) {
58 return a.Equals(b);
59 }
60 inline bool operator!=(const PageState& a, const PageState& b) {
61 return !(a == b);
62 }
63
64 } // namespace content
65
66 #endif // CONTENT_PUBLIC_COMMON_PAGE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698