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 "ui/gfx/point.h"
18 struct CONTENT_EXPORT ExplodedHttpBodyElement
{
19 WebKit::WebHTTPBody::Element::Type type
;
21 base::NullableString16 file_path
;
25 double file_modification_time
;
26 std::string blob_uuid
;
28 ExplodedHttpBodyElement();
29 ~ExplodedHttpBodyElement();
32 struct CONTENT_EXPORT ExplodedHttpBody
{
33 base::NullableString16 http_content_type
;
34 std::vector
<ExplodedHttpBodyElement
> elements
;
36 bool contains_passwords
;
43 struct CONTENT_EXPORT ExplodedFrameState
{
44 base::NullableString16 url_string
;
45 base::NullableString16 original_url_string
;
46 base::NullableString16 referrer
;
47 base::NullableString16 target
;
48 base::NullableString16 state_object
;
49 std::vector
<base::NullableString16
> document_state
;
50 gfx::Point scroll_offset
;
51 int64 item_sequence_number
;
52 int64 document_sequence_number
;
53 double page_scale_factor
;
54 ExplodedHttpBody http_body
;
55 std::vector
<ExplodedFrameState
> children
;
58 ~ExplodedFrameState();
61 struct CONTENT_EXPORT ExplodedPageState
{
62 std::vector
<base::NullableString16
> referenced_files
;
63 ExplodedFrameState top
;
69 CONTENT_EXPORT
bool DecodePageState(const std::string
& encoded
,
70 ExplodedPageState
* exploded
);
71 CONTENT_EXPORT
bool EncodePageState(const ExplodedPageState
& exploded
,
72 std::string
* encoded
);
74 #if defined(OS_ANDROID)
75 CONTENT_EXPORT
bool DecodePageStateWithDeviceScaleFactorForTesting(
76 const std::string
& encoded
,
77 float device_scale_factor
,
78 ExplodedPageState
* exploded
);
81 } // namespace content
83 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_