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/WebHistoryScrollRestorationType.h"
14 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
15 #include "ui/gfx/geometry/point.h"
16 #include "ui/gfx/geometry/point_f.h"
21 struct CONTENT_EXPORT ExplodedHttpBodyElement
{
22 blink::WebHTTPBody::Element::Type type
;
24 base::NullableString16 file_path
;
28 double file_modification_time
;
29 std::string blob_uuid
;
31 ExplodedHttpBodyElement();
32 ~ExplodedHttpBodyElement();
35 struct CONTENT_EXPORT ExplodedHttpBody
{
36 base::NullableString16 http_content_type
;
37 std::vector
<ExplodedHttpBodyElement
> elements
;
39 bool contains_passwords
;
46 struct CONTENT_EXPORT ExplodedFrameState
{
47 base::NullableString16 url_string
;
48 base::NullableString16 referrer
;
49 base::NullableString16 target
;
50 base::NullableString16 state_object
;
51 std::vector
<base::NullableString16
> document_state
;
52 blink::WebHistoryScrollRestorationType scroll_restoration_type
;
53 gfx::PointF pinch_viewport_scroll_offset
;
54 gfx::Point scroll_offset
;
55 int64 item_sequence_number
;
56 int64 document_sequence_number
;
57 double page_scale_factor
;
58 blink::WebReferrerPolicy referrer_policy
;
59 ExplodedHttpBody http_body
;
60 std::vector
<ExplodedFrameState
> children
;
63 ExplodedFrameState(const ExplodedFrameState
& other
);
64 ~ExplodedFrameState();
65 void operator=(const ExplodedFrameState
& other
);
68 void assign(const ExplodedFrameState
& other
);
71 struct CONTENT_EXPORT ExplodedPageState
{
72 // TODO(creis): Move referenced_files to ExplodedFrameState.
73 // It currently contains a list from all frames, but cannot be deserialized
74 // into the files referenced by each frame. See http://crbug.com/441966.
75 std::vector
<base::NullableString16
> referenced_files
;
76 ExplodedFrameState top
;
82 CONTENT_EXPORT
bool DecodePageState(const std::string
& encoded
,
83 ExplodedPageState
* exploded
);
84 CONTENT_EXPORT
bool EncodePageState(const ExplodedPageState
& exploded
,
85 std::string
* encoded
);
87 #if defined(OS_ANDROID)
88 CONTENT_EXPORT
bool DecodePageStateWithDeviceScaleFactorForTesting(
89 const std::string
& encoded
,
90 float device_scale_factor
,
91 ExplodedPageState
* exploded
);
94 } // namespace content
96 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_