summaryrefslogtreecommitdiff
path: root/chromium/content/common/page_state.mojom
blob: ef6e9e5ba7a5afcf982884d983e6514ad76e6c80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module content.history.mojom;

// WARNING: Please read the comments below, before including other Mojo types.
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "services/network/public/mojom/referrer_policy.mojom";
import "url/mojom/url.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// This file contains the mojo IDL definitions for PageState and its constituent
// parts. The resultant generated code is used to serialize and deserialize
// PageState for the purpose of history restore.
//
// All structures here must maintain backward-compatibility (and hence must be
// marked [Stable]) according to mojom backward-compatibility rules. Namely,
// when adding new fields:
// - Assign your new field an explicit ordinal(@n) and prefer to add fields to
//   the end of the struct to simplify finding the latest ordinal.
// - New fields must be tagged with a [MinVersion=x] attribute where x is larger
//   than the MinVersion for any existing fields. The next available MinVersion
//   value is specified at the bottom of this comment block for convenience.
// - Only builtin mojom types or other user-defined [Stable] types are allowed
//   as transitive dependencies here. This is enforced at build time.
// - You'll also need to read/write the new field's value when decoding and
//   encoding PageState, update PageStateSerializationTest to check that your
//   new field is preserved across serialization, and add a BackwardsCompat
//   test with associated serialized_vxx.dat file. Look for
//   DumpExpectedPageStateForBackwardsCompat in
//   page_state_serialization_unittest for how to do this.
//
// Don't remove, or change the type of fields; this will break
// compatibility. If re-ordering fields, make sure to retain the original
// ordinal value.
//
// Finally, note that any backward-incomptable changes will be caught by a
// presubmit check.
//
// Update the below value if your change introduces fields using it.
// Next MinVersion: 3

// Next Ordinal: 4
// FileSystemFile is no longer supported.
[Stable]
struct DEPRECATED_FileSystemFile {
  url.mojom.Url filesystem_url@0;
  uint64 offset@1;
  uint64 length@2;
  mojo_base.mojom.Time modification_time@3;
};

// Next Ordinal: 4
[Stable]
struct File {
  mojo_base.mojom.String16 path@0;
  uint64 offset@1;
  uint64 length@2;
  mojo_base.mojom.Time modification_time@3;
};

// Next Ordinal: 4
[Stable]
union Element {
  string blob_uuid@0;
  array<uint8> bytes@1;
  File file@2;
  // FileSystemFile is no longer supported.
  DEPRECATED_FileSystemFile DEPRECATED_file_system_file@3;
};

// Next Ordinal: 3
[Stable]
struct RequestBody {
  array<Element> elements@0;
  int64 identifier@1;
  bool contains_sensitive_info@2;
};

// Next Ordinal: 3
[Stable]
struct HttpBody {
  mojo_base.mojom.String16? http_content_type@0;
  RequestBody? request_body@1;
  bool contains_passwords@2 = false;
};

// This enum's values must match blink::WebHistoryScrollRestorationType. This
// is enforced with static asserts in page_state_serialization.cc.
[Stable, Extensible]
enum ScrollRestorationType {
  kAuto = 0,
  kManual = 1
};

// Next Ordinal: 6
[Stable]
struct ViewState {
  gfx.mojom.PointF visual_viewport_scroll_offset@0;
  gfx.mojom.Point scroll_offset@1;
  double page_scale_factor@2;
  // Serialized scroll anchor fields
  [MinVersion=1] mojo_base.mojom.String16? scroll_anchor_selector@3;
  [MinVersion=1] gfx.mojom.PointF? scroll_anchor_offset@4;
  [MinVersion=1] uint64 scroll_anchor_simhash@5 = 0;
};

// Next Ordinal: 13
[Stable]
struct FrameState {
  mojo_base.mojom.String16? url_string@0;
  mojo_base.mojom.String16? referrer@1;
  mojo_base.mojom.String16? target@2;
  mojo_base.mojom.String16? state_object@3;
  array<mojo_base.mojom.String16?> document_state@4;
  ScrollRestorationType scroll_restoration_type@5;
  ViewState? view_state@6;
  int64 item_sequence_number@7;
  int64 document_sequence_number@8;
  network.mojom.ReferrerPolicy referrer_policy@9;
  HttpBody http_body@10;
  array<FrameState> children@11;
  [MinVersion=2] string? initiator_origin@12;
};

// Next Ordinal: 2
[Stable]
struct PageState {
  array<mojo_base.mojom.String16?> referenced_files@0;
  FrameState top@1;
};