OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_COMMON_PAGE_STATE_SERIALIZATION_H_ | 5 #ifndef CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_ |
6 #define CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_ | 6 #define CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/strings/nullable_string16.h" | 12 #include "base/strings/nullable_string16.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/common/resource_request_body.h" |
15 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 16 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
16 #include "third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h" | 17 #include "third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h" |
17 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 18 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
18 #include "ui/gfx/geometry/point.h" | 19 #include "ui/gfx/geometry/point.h" |
19 #include "ui/gfx/geometry/point_f.h" | 20 #include "ui/gfx/geometry/point_f.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 struct CONTENT_EXPORT ExplodedHttpBodyElement { | 25 struct CONTENT_EXPORT ExplodedHttpBodyElement { |
(...skipping 12 matching lines...) Expand all Loading... |
37 }; | 38 }; |
38 | 39 |
39 struct CONTENT_EXPORT ExplodedHttpBody { | 40 struct CONTENT_EXPORT ExplodedHttpBody { |
40 base::NullableString16 http_content_type; | 41 base::NullableString16 http_content_type; |
41 std::vector<ExplodedHttpBodyElement> elements; | 42 std::vector<ExplodedHttpBodyElement> elements; |
42 int64_t identifier; | 43 int64_t identifier; |
43 bool contains_passwords; | 44 bool contains_passwords; |
44 bool is_null; | 45 bool is_null; |
45 | 46 |
46 ExplodedHttpBody(); | 47 ExplodedHttpBody(); |
| 48 ExplodedHttpBody(const ExplodedHttpBody& other); |
47 ~ExplodedHttpBody(); | 49 ~ExplodedHttpBody(); |
48 }; | 50 }; |
49 | 51 |
50 struct CONTENT_EXPORT ExplodedFrameState { | 52 struct CONTENT_EXPORT ExplodedFrameState { |
51 base::NullableString16 url_string; | 53 base::NullableString16 url_string; |
52 base::NullableString16 referrer; | 54 base::NullableString16 referrer; |
53 base::NullableString16 target; | 55 base::NullableString16 target; |
54 base::NullableString16 state_object; | 56 base::NullableString16 state_object; |
55 std::vector<base::NullableString16> document_state; | 57 std::vector<base::NullableString16> document_state; |
56 blink::WebHistoryScrollRestorationType scroll_restoration_type; | 58 blink::WebHistoryScrollRestorationType scroll_restoration_type; |
(...skipping 24 matching lines...) Expand all Loading... |
81 | 83 |
82 ExplodedPageState(); | 84 ExplodedPageState(); |
83 ~ExplodedPageState(); | 85 ~ExplodedPageState(); |
84 }; | 86 }; |
85 | 87 |
86 CONTENT_EXPORT bool DecodePageState(const std::string& encoded, | 88 CONTENT_EXPORT bool DecodePageState(const std::string& encoded, |
87 ExplodedPageState* exploded); | 89 ExplodedPageState* exploded); |
88 CONTENT_EXPORT bool EncodePageState(const ExplodedPageState& exploded, | 90 CONTENT_EXPORT bool EncodePageState(const ExplodedPageState& exploded, |
89 std::string* encoded); | 91 std::string* encoded); |
90 | 92 |
| 93 // If |exploded| is not null, initializes |http_body| with the data from |
| 94 // |exploded|. Returns false otherwise. |
| 95 bool GeneratePostData(const ExplodedHttpBody exploded, |
| 96 ResourceRequestBody* http_body); |
| 97 |
91 #if defined(OS_ANDROID) | 98 #if defined(OS_ANDROID) |
92 CONTENT_EXPORT bool DecodePageStateWithDeviceScaleFactorForTesting( | 99 CONTENT_EXPORT bool DecodePageStateWithDeviceScaleFactorForTesting( |
93 const std::string& encoded, | 100 const std::string& encoded, |
94 float device_scale_factor, | 101 float device_scale_factor, |
95 ExplodedPageState* exploded); | 102 ExplodedPageState* exploded); |
96 #endif | 103 #endif |
97 | 104 |
98 } // namespace content | 105 } // namespace content |
99 | 106 |
100 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_ | 107 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_ |
OLD | NEW |