Add ICU message format support
[chromium-blink-merge.git] / content / common / page_state_serialization.h
blob4d60e14e53d13de186b32408f5d7ae4ecc7e48c6
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_
8 #include <vector>
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"
17 #include "url/gurl.h"
19 namespace content {
21 struct CONTENT_EXPORT ExplodedHttpBodyElement {
22 blink::WebHTTPBody::Element::Type type;
23 std::string data;
24 base::NullableString16 file_path;
25 GURL filesystem_url;
26 int64 file_start;
27 int64 file_length;
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;
38 int64 identifier;
39 bool contains_passwords;
40 bool is_null;
42 ExplodedHttpBody();
43 ~ExplodedHttpBody();
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;
62 ExplodedFrameState();
63 ExplodedFrameState(const ExplodedFrameState& other);
64 ~ExplodedFrameState();
65 void operator=(const ExplodedFrameState& other);
67 private:
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;
78 ExplodedPageState();
79 ~ExplodedPageState();
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);
92 #endif
94 } // namespace content
96 #endif // CONTENT_COMMON_PAGE_STATE_SERIALIZATION_H_