OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module web_view; | 5 module web_view.mojom; |
6 | 6 |
7 import "network/public/interfaces/url_loader.mojom"; | 7 import "network/public/interfaces/url_loader.mojom"; |
8 | 8 |
9 // This files defines the interfaces and structures used for frames. | 9 // This files defines the interfaces and structures used for frames. |
10 // | 10 // |
11 // When a client in the frame tree is connected to by way of the ViewManager a | 11 // When a client in the frame tree is connected to by way of the ViewManager a |
12 // FrameTreeClient is obtained (from the ServiceProvider interface request | 12 // FrameClient is obtained (from the ServiceProvider interface request passed |
13 // passed in ViewManager::OnEmbed()). The FrameTreeClient is told the frame | 13 // in ViewManager::OnEmbed()). The FrameClient is told the frame tree (by way |
14 // tree (by way of OnConnection()), which allows the client to use other | 14 // of OnConnection()), which allows the client to use other frames in the tree |
15 // frames in the tree (assuming the client has the appropriate permissions). | 15 // (assuming the client has the appropriate permissions). |
16 // | 16 // |
17 // frame_ids are the same as views ids. This means that when a client creates | 17 // frame_ids are the same as views ids. This means that when a client creates |
18 // a new view to be part of the frame tree it immediately knows the id to use | 18 // a new view to be part of the frame tree it immediately knows the id to use |
19 // for FrameTreeServer calls. | 19 // for Frame calls. |
20 // | 20 // |
21 // The server provides an id that may be used to identify the state of the | 21 // The server provides an id that may be used to identify the state of the |
22 // tree. The change id is an integer that is incremented every time the | 22 // tree. The change id is an integer that is incremented every time the |
23 // structure of the tree changes. The change id is not used by the server; the | 23 // structure of the tree changes. The change id is not used by the server; the |
24 // server only updates the change id and notifies clients of the new id (by | 24 // server only updates the change id and notifies clients of the new id (by |
25 // way of structure change functions such as OnFrameAdded()). | 25 // way of structure change functions such as OnFrameAdded()). |
26 | 26 |
27 // Expresses a preference for where a navigation should occur. | 27 // Expresses a preference for where a navigation should occur. |
28 enum NavigationTargetType { | 28 enum NavigationTargetType { |
29 // No preference. | 29 // No preference. |
(...skipping 29 matching lines...) Expand all Loading... |
59 | 59 |
60 // The origin for the message's target. | 60 // The origin for the message's target. |
61 string? target_origin; | 61 string? target_origin; |
62 | 62 |
63 // TODO(sky): these two are not implemented. Figure out what they should be. | 63 // TODO(sky): these two are not implemented. Figure out what they should be. |
64 // Information about the MessagePorts this message contains. | 64 // Information about the MessagePorts this message contains. |
65 // IPC_STRUCT_MEMBER(std::vector<content::TransferredMessagePort>, message_por
ts) | 65 // IPC_STRUCT_MEMBER(std::vector<content::TransferredMessagePort>, message_por
ts) |
66 // IPC_STRUCT_MEMBER(std::vector<int>, new_routing_ids) | 66 // IPC_STRUCT_MEMBER(std::vector<int>, new_routing_ids) |
67 }; | 67 }; |
68 | 68 |
69 interface FrameTreeServer { | 69 interface Frame { |
70 // Requests the server to message the specified frame with |event|. If the | 70 // Requests the server to message the specified frame with |event|. If the |
71 // operation is allowed OnPostMessageEvent() is called on the appropriate | 71 // operation is allowed OnPostMessageEvent() is called on the appropriate |
72 // FrameTreeClient. | 72 // FrameClient. |
73 PostMessageEventToFrame(uint32 target_frame_id, HTMLMessageEvent event); | 73 PostMessageEventToFrame(uint32 target_frame_id, HTMLMessageEvent event); |
74 | 74 |
75 // Notifies the server that the loading state and progress changed. | 75 // Notifies the server that the loading state and progress changed. |
76 LoadingStateChanged(bool loading, double progress); | 76 LoadingStateChanged(bool loading, double progress); |
77 | 77 |
78 // Called when the title becomes available or changes. | 78 // Called when the title becomes available or changes. |
79 TitleChanged(string? title); | 79 TitleChanged(string? title); |
80 | 80 |
81 // Called when the response body has been received. | 81 // Called when the response body has been received. |
82 DidCommitProvisionalLoad(); | 82 DidCommitProvisionalLoad(); |
83 | 83 |
84 // Sets the value of the specified client property, notifying clients if the | 84 // Sets the value of the specified client property, notifying clients if the |
85 // value changed. If |value| is null the property is removed. | 85 // value changed. If |value| is null the property is removed. |
86 SetClientProperty(string name, array<uint8>? value); | 86 SetClientProperty(string name, array<uint8>? value); |
87 | 87 |
88 // Called when the client creates a new frame. |frame_id| corresponds to | 88 // Called when the client creates a new frame. |frame_id| corresponds to |
89 // the id of the view hosting the frame, and |parent_id| the id of the | 89 // the id of the view hosting the frame, and |parent_id| the id of the |
90 // parent. See FrameData::client_properties for details of | 90 // parent. See FrameData::client_properties for details of |
91 // |client_properties|. | 91 // |client_properties|. |
92 // | 92 // |
93 // Note that the FrameTreeClient still gets an OnConnect(), but the only | 93 // Note that the FrameClient still gets an OnConnect(), but the only thing of |
94 // thing of interest is the callback. | 94 // interest is the callback. |
95 OnCreatedFrame(FrameTreeServer& server_request, | 95 OnCreatedFrame(Frame& frame_request, |
96 FrameTreeClient client, | 96 FrameClient client, |
97 uint32 frame_id, | 97 uint32 frame_id, |
98 map<string, array<uint8>> client_properties); | 98 map<string, array<uint8>> client_properties); |
99 | 99 |
100 // Requests a navigation. If |target_TYPE| is |EXISTING_FRAME|, then | 100 // Requests a navigation. If |target_TYPE| is |EXISTING_FRAME|, then |
101 // |target_frame_id| identifies the frame to navigate in. Otherwise | 101 // |target_frame_id| identifies the frame to navigate in. Otherwise |
102 // |target_frame_id| is unused. | 102 // |target_frame_id| is unused. |
103 RequestNavigate(NavigationTargetType target_type, | 103 RequestNavigate(NavigationTargetType target_type, |
104 uint32 target_frame_id, | 104 uint32 target_frame_id, |
105 mojo.URLRequest request); | 105 mojo.URLRequest request); |
106 | 106 |
107 // The frame navigated locally, for example, pushState() navigations in an | 107 // The frame navigated locally, for example, pushState() navigations in an |
108 // HTML application. | 108 // HTML application. |
109 DidNavigateLocally(string url); | 109 DidNavigateLocally(string url); |
110 | 110 |
111 // Dispatches a load event to the parent of the frame. | 111 // Dispatches a load event to the parent of the frame. |
112 DispatchLoadEventToParent(); | 112 DispatchLoadEventToParent(); |
113 }; | 113 }; |
114 | 114 |
115 enum ViewConnectType { | 115 enum ViewConnectType { |
116 // Indicates the app is already a ViewTreeClient and the existing view should | 116 // Indicates the app is already a ViewTreeClient and the existing view should |
117 // be used. In this case the app is not asked for a new ViewTreeClient. | 117 // be used. In this case the app is not asked for a new ViewTreeClient. |
118 USE_EXISTING, | 118 USE_EXISTING, |
119 | 119 |
120 // Indicates a new ViewTreeClient is obtained and the View provided to | 120 // Indicates a new ViewTreeClient is obtained and the View provided to |
121 // OnEmbed() should be used. | 121 // OnEmbed() should be used. |
122 USE_NEW | 122 USE_NEW |
123 }; | 123 }; |
124 | 124 |
125 interface FrameTreeClient { | 125 interface FrameClient { |
126 // Called once per client. |frame_data| gives the contents of the tree. | 126 // Called once per client. |frame_data| gives the contents of the tree. |
127 // |view_id| is the id of the view the FrameTreeClient should render to. If | 127 // |view_id| is the id of the view the FrameClient should render to. If a |
128 // a ViewTreeClient is asked for then |view_id| is the same id as that of the | 128 // ViewTreeClient is asked for then |view_id| is the same id as that of the |
129 // View supplied to ViewTreeClient::OnEmbed(). | 129 // View supplied to ViewTreeClient::OnEmbed(). |
130 OnConnect(FrameTreeServer? server, | 130 OnConnect(Frame? frame, |
131 uint32 change_id, | 131 uint32 change_id, |
132 uint32 view_id, | 132 uint32 view_id, |
133 ViewConnectType view_connect_type, | 133 ViewConnectType view_connect_type, |
134 array<FrameData>? frame_data) => (); | 134 array<FrameData>? frame_data) => (); |
135 | 135 |
136 // Called when a new frame is added to the tree. | 136 // Called when a new frame is added to the tree. |
137 OnFrameAdded(uint32 change_id, FrameData frame_data); | 137 OnFrameAdded(uint32 change_id, FrameData frame_data); |
138 | 138 |
139 // Called when a frame is removed from the tree. | 139 // Called when a frame is removed from the tree. |
140 OnFrameRemoved(uint32 change_id, uint32 frame_id); | 140 OnFrameRemoved(uint32 change_id, uint32 frame_id); |
141 | 141 |
142 // Called when a client property changes. | 142 // Called when a client property changes. |
143 OnFrameClientPropertyChanged(uint32 frame_id, | 143 OnFrameClientPropertyChanged(uint32 frame_id, |
144 string name, | 144 string name, |
145 array<uint8>? new_value); | 145 array<uint8>? new_value); |
146 | 146 |
147 // See description in PostMessageEventToFrame(). | 147 // See description in PostMessageEventToFrame(). |
148 OnPostMessageEvent(uint32 source_frame_id, | 148 OnPostMessageEvent(uint32 source_frame_id, |
149 uint32 target_frame_id, | 149 uint32 target_frame_id, |
150 HTMLMessageEvent event); | 150 HTMLMessageEvent event); |
151 | 151 |
152 // Called prior to starting a new navigation. This is only called on the | 152 // Called prior to starting a new navigation. This is only called on the |
153 // FrameTreeClient that is rendering to the frame, and only when another | 153 // FrameClient that is rendering to the frame, and only when another content |
154 // content handler is going to start handling the rendering. | 154 // handler is going to start handling the rendering. |
155 OnWillNavigate(); | 155 OnWillNavigate(); |
156 | 156 |
157 // Called to notify that |frame_id|'s loading state has changed. This is only | 157 // Called to notify that |frame_id|'s loading state has changed. This is only |
158 // called on the FrameTreeClient rendering the parent of |frame_id|. | 158 // called on the FrameClient rendering the parent of |frame_id|. |
159 OnFrameLoadingStateChanged(uint32 frame_id, bool loading); | 159 OnFrameLoadingStateChanged(uint32 frame_id, bool loading); |
160 | 160 |
161 // Called to dispatch a load event of |frame_id| in its parent. This is only | 161 // Called to dispatch a load event of |frame_id| in its parent. This is only |
162 // called on the FrameTreeClient rendering the parent of |frame_id|. | 162 // called on the FrameClient rendering the parent of |frame_id|. |
163 OnDispatchFrameLoadEvent(uint32 frame_id); | 163 OnDispatchFrameLoadEvent(uint32 frame_id); |
164 }; | 164 }; |
OLD | NEW |