rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 1 | // Copyright 2016 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. |
| 4 | |
| 5 | module content.mojom; |
| 6 | |
| 7 | import "content/common/native_types.mojom"; |
Makoto Shimazu | 7af43ee | 2017-08-25 10:20:40 | [diff] [blame] | 8 | import "content/common/service_worker/embedded_worker.mojom"; |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 9 | import "ipc/constants.mojom"; |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 10 | import "mojo/common/time.mojom"; |
Pavel Feldman | 2523472 | 2017-10-11 02:49:06 | [diff] [blame] | 11 | import "mojo/common/unguessable_token.mojom"; |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 12 | import "services/service_manager/public/interfaces/interface_provider.mojom"; |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 13 | import "ui/gfx/geometry/mojo/geometry.mojom"; |
| 14 | import "ui/gfx/mojo/icc_profile.mojom"; |
| 15 | |
| 16 | struct CreateViewParams { |
| 17 | // Renderer-wide preferences. |
| 18 | RendererPreferences renderer_preferences; |
| 19 | |
| 20 | // Preferences for this view. |
| 21 | WebPreferences web_preferences; |
| 22 | |
| 23 | // The ID of the view to be created. |
| 24 | int32 view_id = IPC.mojom.kRoutingIdNone; |
| 25 | |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 26 | // The ID of the main frame hosted in the view, or None if creating a view to |
| 27 | // host a main frame proxy. |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 28 | int32 main_frame_routing_id = IPC.mojom.kRoutingIdNone; |
| 29 | |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 30 | // The InterfaceProvider through which the main RenderFrame can access |
| 31 | // services exposed by its RenderFrameHost. |
| 32 | // |
| 33 | // This is null precisely when |main_frame_routing_id| is MSG_ROUTING_NONE, |
| 34 | // that is, when creating a RenderView for a remote main frame. |
| 35 | service_manager.mojom.InterfaceProvider? main_frame_interface_provider; |
| 36 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 37 | // The ID of the widget for the main frame. |
| 38 | int32 main_frame_widget_routing_id = IPC.mojom.kRoutingIdNone; |
| 39 | |
| 40 | // The session storage namespace ID this view should use. |
| 41 | int64 session_storage_namespace_id; |
| 42 | |
| 43 | // The route ID of the opener RenderFrame or RenderFrameProxy, if we need to |
| 44 | // set one (MSG_ROUTING_NONE otherwise). |
| 45 | int32 opener_frame_route_id = IPC.mojom.kRoutingIdNone; |
| 46 | |
| 47 | // Whether the RenderView should initially be swapped out. |
| 48 | bool swapped_out; |
| 49 | |
| 50 | // Carries replicated information, such as frame name and sandbox flags, for |
| 51 | // this view's main frame, which will be a proxy in |swapped_out| |
| 52 | // views when in --site-per-process mode, or a RenderFrame in all other |
| 53 | // cases. |
| 54 | FrameReplicationState replicated_frame_state; |
| 55 | |
Pavel Feldman | 2523472 | 2017-10-11 02:49:06 | [diff] [blame] | 56 | // Used for devtools instrumentation and trace-ability. The token is |
| 57 | // propagated to Blink's LocalFrame and both Blink and content/ |
| 58 | // can tag calls and requests with this instrumentation token in order to |
| 59 | // attribute them to the context frame. |
| 60 | // |devtools_main_frame_token| is only defined by the browser and is never |
| 61 | // sent back from the renderer in the control calls. |
| 62 | mojo.common.mojom.UnguessableToken devtools_main_frame_token; |
| 63 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 64 | // The ID of the proxy object for the main frame in this view. It is only |
| 65 | // used if |swapped_out| is true. |
| 66 | int32 proxy_routing_id = IPC.mojom.kRoutingIdNone; |
| 67 | |
| 68 | // Whether the RenderView should initially be hidden. |
| 69 | bool hidden; |
| 70 | |
| 71 | // Whether the RenderView will never be visible. |
| 72 | bool never_visible; |
| 73 | |
| 74 | // Whether the window associated with this view was created with an opener. |
| 75 | bool window_was_created_with_opener; |
| 76 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 77 | // The initial renderer size. |
| 78 | ResizeParams initial_size; |
| 79 | |
| 80 | // Whether to enable auto-resize. |
| 81 | bool enable_auto_resize; |
| 82 | |
| 83 | // The minimum size to layout the page if auto-resize is enabled. |
| 84 | gfx.mojom.Size min_size; |
| 85 | |
| 86 | // The maximum size to layout the page if auto-resize is enabled. |
| 87 | gfx.mojom.Size max_size; |
| 88 | |
| 89 | // The page zoom level. |
| 90 | double page_zoom_level; |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 91 | }; |
| 92 | |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 93 | struct CreateFrameWidgetParams { |
| 94 | // Gives the routing ID for the RenderWidget that will be attached to the |
| 95 | // new RenderFrame. If the RenderFrame does not need a RenderWidget, this |
| 96 | // is MSG_ROUTING_NONE and the other parameters are not read. |
| 97 | int32 routing_id; |
| 98 | |
| 99 | // Tells the new RenderWidget whether it is initially hidden. |
| 100 | bool hidden; |
| 101 | }; |
| 102 | |
| 103 | struct CreateFrameParams { |
| 104 | // Specifies the routing ID of the new RenderFrame object. |
| 105 | int32 routing_id; |
| 106 | |
| 107 | // If a valid |proxy_routing_id| is provided, the new frame will be |
| 108 | // configured to replace the proxy on commit. |
| 109 | int32 proxy_routing_id; |
| 110 | |
| 111 | // Specifies the new frame's opener. The opener will be null if this is |
| 112 | // MSG_ROUTING_NONE. |
| 113 | int32 opener_routing_id; |
| 114 | |
| 115 | // The new frame should be created as a child of the object |
| 116 | // identified by |parent_routing_id| or as top level if that is |
| 117 | // MSG_ROUTING_NONE. |
| 118 | int32 parent_routing_id; |
| 119 | |
| 120 | // Identifies the previous sibling of the new frame, so that the new frame is |
| 121 | // inserted into the correct place in the frame tree. If this is |
| 122 | // MSG_ROUTING_NONE, the frame will be created as the leftmost child of its |
| 123 | // parent frame, in front of any other children. |
| 124 | int32 previous_sibling_routing_id; |
| 125 | |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 126 | // The InterfaceProvider through which the RenderFrame can access services |
| 127 | // exposed by its RenderFrameHost. |
| 128 | service_manager.mojom.InterfaceProvider interface_provider; |
| 129 | |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 130 | // When the new frame has a parent, |replication_state| holds the new frame's |
| 131 | // properties replicated from the process rendering the parent frame, such as |
| 132 | // the new frame's sandbox flags. |
| 133 | FrameReplicationState replication_state; |
| 134 | |
Pavel Feldman | 2523472 | 2017-10-11 02:49:06 | [diff] [blame] | 135 | // Used for devtools instrumentation and trace-ability. The token is |
| 136 | // propagated to Blink's LocalFrame and both Blink and content/ |
| 137 | // can tag calls and requests with this instrumentation token in order to |
| 138 | // attribute them to the context frame. |
| 139 | // |devtools_frame_token| is only defined by the browser and is never |
| 140 | // sent back from the renderer in the control calls. |
| 141 | mojo.common.mojom.UnguessableToken devtools_frame_token; |
| 142 | |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 143 | // When the new frame has a parent, |frame_owner_properties| holds the |
| 144 | // properties of the HTMLFrameOwnerElement from the parent process. |
| 145 | // Note that unlike FrameReplicationState, this is not replicated for remote |
| 146 | // frames. |
| 147 | FrameOwnerProperties frame_owner_properties; |
| 148 | |
| 149 | // Specifies properties for a new RenderWidget that will be attached to the |
| 150 | // new RenderFrame (if one is needed). |
| 151 | CreateFrameWidgetParams widget_params; |
| 152 | }; |
| 153 | |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 154 | struct UpdateScrollbarThemeParams { |
| 155 | float initial_button_delay; |
| 156 | float autoscroll_button_delay; |
| 157 | bool jump_on_track_click; |
| 158 | ScrollerStyle preferred_scroller_style; |
| 159 | bool redraw; |
| 160 | ScrollbarButtonsPlacement button_placement; |
Greg Kerr | a7b943b | 2017-07-24 23:17:17 | [diff] [blame] | 161 | bool scroll_view_rubber_banding; |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 162 | }; |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 163 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 164 | // The primordial Channel-associated interface implemented by a render process. |
| 165 | // This should be used for implementing browser-to-renderer control messages |
| 166 | // which need to retain FIFO with respect to legacy IPC messages. |
| 167 | interface Renderer { |
| 168 | // Tells the renderer to create a new view. |
| 169 | CreateView(CreateViewParams params); |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 170 | |
| 171 | // Tells the renderer to create a new RenderFrame. |
| 172 | CreateFrame(CreateFrameParams params); |
| 173 | |
Makoto Shimazu | 7af43ee | 2017-08-25 10:20:40 | [diff] [blame] | 174 | // Tells the renderer to create an EmbeddedWorkerInstanceClient, which is what |
| 175 | // manages service worker startup and shutdown. |
| 176 | // TODO(shimazu): Create a service worker's execution context by this method |
| 177 | // instead of just creating an instance of EmbeddedWorkerInstanceClient. |
| 178 | SetUpEmbeddedWorkerChannelForServiceWorker( |
| 179 | associated EmbeddedWorkerInstanceClient& client_request); |
| 180 | |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 181 | // Tells the renderer to create a new RenderFrameProxy object with |
| 182 | // |routing_id|. |render_view_routing_id| identifies the |
| 183 | // RenderView to be associated with this proxy. The new proxy's opener should |
| 184 | // be set to the object identified by |opener_routing_id|, or to null if that |
| 185 | // is MSG_ROUTING_NONE. The new proxy should be created as a child of the |
| 186 | // object identified by |parent_routing_id| or as top level if that is |
| 187 | // MSG_ROUTING_NONE. |
| 188 | CreateFrameProxy(int32 routing_id, int32 render_view_routing_id, |
| 189 | int32 opener_routing_id, int32 parent_routing_id, |
| 190 | FrameReplicationState replication_state); |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 191 | |
| 192 | // Tells the renderer that the network type has changed so that |
| 193 | // navigator.onLine and navigator.connection can be updated. |
| 194 | OnNetworkConnectionChanged(NetworkConnectionType connection_type, |
| 195 | double max_bandwidth_mbps); |
| 196 | |
tbansal | 15973c3 | 2017-05-10 18:40:44 | [diff] [blame] | 197 | // Tells the renderer process that the network quality estimate has changed. |
tbansal | b612c5d | 2017-05-25 18:53:06 | [diff] [blame] | 198 | // EffectiveConnectionType is the connection type whose typical performance is |
| 199 | // most similar to the measured performance of the network in use. |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 200 | // The downstream throughput is computed in kilobits per second. If an |
Ken Rockot | fd90763 | 2017-09-14 04:23:41 | [diff] [blame] | 201 | // estimate of the HTTP or transport RTT is unavailable, it will be set to |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 202 | // net::nqe::internal::InvalidRTT(). If the throughput estimate is |
zhuoyu.qian | d80590e5 | 2017-10-30 10:23:51 | [diff] [blame] | 203 | // unavailable, it will be set to net::nqe::internal::INVALID_RTT_THROUGHPUT. |
tbansal | b612c5d | 2017-05-25 18:53:06 | [diff] [blame] | 204 | OnNetworkQualityChanged(EffectiveConnectionType effective_connection_type, |
| 205 | mojo.common.mojom.TimeDelta http_rtt, |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 206 | mojo.common.mojom.TimeDelta transport_rtt, |
| 207 | double bandwidth_kbps); |
tbansal | 15973c3 | 2017-05-10 18:40:44 | [diff] [blame] | 208 | |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 209 | // Tells the renderer to suspend/resume the webkit timers. Only for use on |
| 210 | // Android. |
| 211 | SetWebKitSharedTimersSuspended(bool suspend); |
| 212 | |
| 213 | // Tells the renderer about a scrollbar appearance change. Only for use on |
| 214 | // OS X. |
| 215 | UpdateScrollbarTheme(UpdateScrollbarThemeParams params); |
| 216 | |
| 217 | // Notification that the OS X Aqua color preferences changed. |
| 218 | OnSystemColorsChanged(int32 aqua_color_variant, string highlight_text_color, |
| 219 | string highlight_color); |
| 220 | |
| 221 | // Tells the renderer to empty its plugin list cache, optional reloading |
| 222 | // pages containing plugins. |
| 223 | PurgePluginListCache(bool reload_pages); |
Nicholas Verne | 5420564d | 2017-10-27 07:37:54 | [diff] [blame] | 224 | |
| 225 | |
| 226 | // Tells the renderer process to enter or leave background mode. |
| 227 | // TODO(crbug:676224) Make this conditional on IPC_MESSAGE_LOG_ENABLED. |
| 228 | SetProcessBackgrounded(bool background); |
| 229 | |
| 230 | // Tells the renderer process to purge and suspend. |
| 231 | ProcessPurgeAndSuspend(); |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 232 | }; |