OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ |
6 #define CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ | 6 #define CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 static PageState CreateFromEncodedData(const std::string& data); | 29 static PageState CreateFromEncodedData(const std::string& data); |
30 static PageState CreateFromURL(const GURL& url); | 30 static PageState CreateFromURL(const GURL& url); |
31 | 31 |
32 static PageState CreateForTesting( | 32 static PageState CreateForTesting( |
33 const GURL& url, | 33 const GURL& url, |
34 bool body_contains_password_data, | 34 bool body_contains_password_data, |
35 const char* optional_body_data, | 35 const char* optional_body_data, |
36 const base::FilePath* optional_body_file_path); | 36 const base::FilePath* optional_body_file_path); |
37 | 37 |
| 38 // Creates an encoded page state from the |url|, |item_sequence_mnumber| and |
| 39 // |document_sequence_number| parameters. |
| 40 static PageState CreateForTestingWithSequenceNumbers( |
| 41 const GURL& url, |
| 42 int64_t item_sequence_number, |
| 43 int64_t document_sequence_number); |
| 44 |
38 PageState(); | 45 PageState(); |
39 | 46 |
40 bool IsValid() const; | 47 bool IsValid() const; |
41 bool Equals(const PageState& page_state) const; | 48 bool Equals(const PageState& page_state) const; |
42 const std::string& ToEncodedData() const; | 49 const std::string& ToEncodedData() const; |
43 | 50 |
44 std::vector<base::FilePath> GetReferencedFiles() const; | 51 std::vector<base::FilePath> GetReferencedFiles() const; |
45 PageState RemovePasswordData() const; | 52 PageState RemovePasswordData() const; |
46 PageState RemoveScrollOffset() const; | 53 PageState RemoveScrollOffset() const; |
47 PageState RemoveReferrer() const; | 54 PageState RemoveReferrer() const; |
48 | 55 |
49 private: | 56 private: |
50 PageState(const std::string& data); | 57 PageState(const std::string& data); |
51 | 58 |
52 std::string data_; | 59 std::string data_; |
53 }; | 60 }; |
54 | 61 |
55 // Support DCHECK_EQ(a, b), etc. | 62 // Support DCHECK_EQ(a, b), etc. |
56 inline bool operator==(const PageState& a, const PageState& b) { | 63 inline bool operator==(const PageState& a, const PageState& b) { |
57 return a.Equals(b); | 64 return a.Equals(b); |
58 } | 65 } |
59 inline bool operator!=(const PageState& a, const PageState& b) { | 66 inline bool operator!=(const PageState& a, const PageState& b) { |
60 return !(a == b); | 67 return !(a == b); |
61 } | 68 } |
62 | 69 |
63 } // namespace content | 70 } // namespace content |
64 | 71 |
65 #endif // CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ | 72 #endif // CONTENT_PUBLIC_COMMON_PAGE_STATE_H_ |
OLD | NEW |