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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_
6 #define CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_
10 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebHTTPBody.h"
13 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
14 #include "ui/gfx/point.h"
19 struct CONTENT_EXPORT ExplodedHttpBodyElement
{
20 blink::WebHTTPBody::Element::Type type
;
22 base::NullableString16 file_path
;
26 double file_modification_time
;
27 std::string blob_uuid
;
29 ExplodedHttpBodyElement();
30 ~ExplodedHttpBodyElement();
33 struct CONTENT_EXPORT ExplodedHttpBody
{
34 base::NullableString16 http_content_type
;
35 std::vector
<ExplodedHttpBodyElement
> elements
;
37 bool contains_passwords
;
44 struct CONTENT_EXPORT ExplodedFrameState
{
45 base::NullableString16 url_string
;
46 base::NullableString16 original_url_string
;
47 base::NullableString16 referrer
;
48 base::NullableString16 target
;
49 base::NullableString16 state_object
;
50 std::vector
<base::NullableString16
> document_state
;
51 gfx::Point scroll_offset
;
52 int64 item_sequence_number
;
53 int64 document_sequence_number
;
54 int64 target_frame_id
;
55 double page_scale_factor
;
56 blink::WebReferrerPolicy referrer_policy
;
57 ExplodedHttpBody http_body
;
58 std::vector
<ExplodedFrameState
> children
;
61 ~ExplodedFrameState();
64 struct CONTENT_EXPORT ExplodedPageState
{
65 std::vector
<base::NullableString16
> referenced_files
;
66 ExplodedFrameState top
;
72 CONTENT_EXPORT
bool DecodePageState(const std::string
& encoded
,
73 ExplodedPageState
* exploded
);
74 CONTENT_EXPORT
bool EncodePageState(const ExplodedPageState
& exploded
,
75 std::string
* encoded
);
77 #if defined(OS_ANDROID)
78 CONTENT_EXPORT
bool DecodePageStateWithDeviceScaleFactorForTesting(
79 const std::string
& encoded
,
80 float device_scale_factor
,
81 ExplodedPageState
* exploded
);
84 } // namespace content
86 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_