ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 1 | // Copyright 2014 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 | |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame^] | 7 | import "content/public/common/window_container_type.mojom"; |
rockot | 734fb66 | 2016-10-15 16:41:30 | [diff] [blame] | 8 | import "services/service_manager/public/interfaces/interface_provider.mojom"; |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame^] | 9 | import "third_party/WebKit/public/platform/referrer.mojom"; |
| 10 | import "third_party/WebKit/public/web/window_features.mojom"; |
| 11 | import "ui/base/mojo/window_open_disposition.mojom"; |
| 12 | import "url/mojo/url.mojom"; |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 13 | |
ben | 275a565 | 2016-10-28 16:55:50 | [diff] [blame] | 14 | // The name of the InterfaceProviderSpec in service manifests used by the |
| 15 | // frame tree to expose frame-specific interfaces between renderer and browser. |
| 16 | const string kNavigation_FrameSpec = "navigation:frame"; |
| 17 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 18 | // Implemented by the frame provider (e.g. renderer processes). |
| 19 | interface Frame { |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 20 | GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 21 | }; |
| 22 | |
sammc | 7f6c6a0 | 2017-01-30 00:53:51 | [diff] [blame] | 23 | // Implemented by the frame (e.g. renderer processes). |
| 24 | // Instances of this interface must be associated with (i.e., FIFO with) the |
| 25 | // legacy IPC channel. |
| 26 | interface FrameBindingsControl { |
| 27 | // Used to tell a render frame whether it should expose various bindings |
| 28 | // that allow JS content extended privileges. See BindingsPolicy for valid |
| 29 | // flag values. |
| 30 | AllowBindings(int32 enabled_bindings_flags); |
| 31 | }; |
| 32 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 33 | // Implemented by the frame server (i.e. the browser process). |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame^] | 34 | interface FrameHostInterfaceBroker { |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 35 | GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | // Implemented by a service that provides implementations of the Frame |
| 39 | // interface. (e.g. renderer processes). |
| 40 | interface FrameFactory { |
csharrison | 95f01e92 | 2017-04-24 18:52:35 | [diff] [blame^] | 41 | CreateFrame(int32 frame_routing_id, Frame& frame, FrameHostInterfaceBroker host); |
| 42 | }; |
| 43 | |
| 44 | // TODO(csharrison): Clean up this struct. Some of the entries (like |
| 45 | // opener_top_level_frame_url) are better suited to be computed in the browser |
| 46 | // process. See http://crbug.com/674307. |
| 47 | struct CreateNewWindowParams { |
| 48 | // True if this open request came in the context of a user gesture. |
| 49 | bool user_gesture; |
| 50 | |
| 51 | // Type of window requested. |
| 52 | WindowContainerType window_container_type; |
| 53 | |
| 54 | // The session storage namespace ID this window should use. |
| 55 | int64 session_storage_namespace_id; |
| 56 | |
| 57 | // The name of the resulting frame that should be created (empty if none |
| 58 | // has been specified). UTF8 encoded string. |
| 59 | string frame_name; |
| 60 | |
| 61 | // The URL of the frame initiating the open. |
| 62 | url.mojom.Url opener_url; |
| 63 | |
| 64 | // The URL of the top frame containing the opener. |
| 65 | url.mojom.Url opener_top_level_frame_url; |
| 66 | |
| 67 | // The security origin of the frame initiating the open. |
| 68 | url.mojom.Url opener_security_origin; |
| 69 | |
| 70 | // Whether the opener will be suppressed in the new window, in which case |
| 71 | // scripting the new window is not allowed. |
| 72 | bool opener_suppressed; |
| 73 | |
| 74 | // Whether the window should be opened in the foreground, background, etc. |
| 75 | ui.mojom.WindowOpenDisposition disposition; |
| 76 | |
| 77 | // The URL that will be loaded in the new window (empty if none has been |
| 78 | // specified). |
| 79 | url.mojom.Url target_url; |
| 80 | |
| 81 | // The referrer that will be used to load |target_url| (empty if none has |
| 82 | // been specified). |
| 83 | blink.mojom.Referrer referrer; |
| 84 | |
| 85 | // The window features to use for the new window. |
| 86 | blink.mojom.WindowFeatures features; |
| 87 | }; |
| 88 | |
| 89 | struct CreateNewWindowReply { |
| 90 | // The ID of the view to be created. If the ID is MSG_ROUTING_NONE, then the |
| 91 | // opener RenderFrame should not create a RenderView in its process. |
| 92 | // MSG_ROUTING_NONE does not necessarily indicate failure; it may also occur |
| 93 | // in cases where a window was created, but the opener relationship is |
| 94 | // severed. |
| 95 | int32 route_id; |
| 96 | |
| 97 | // The ID of the main frame hosted in the view. |
| 98 | int32 main_frame_route_id; |
| 99 | |
| 100 | // The ID of the widget for the main frame. |
| 101 | int32 main_frame_widget_route_id; |
| 102 | |
| 103 | // Duplicated from CreateNewWindowParams because legacy code. |
| 104 | int64 cloned_session_storage_namespace_id; |
| 105 | }; |
| 106 | |
| 107 | // Implemented by the frame server (i.e. the browser process). For messages that |
| 108 | // must be associated with the IPC channel. |
| 109 | interface FrameHost { |
| 110 | // Sent by the renderer when it is creating a new window. The browser creates |
| 111 | // a tab for it. If |reply.route_id| is MSG_ROUTING_NONE, the window couldn't |
| 112 | // be created. |
| 113 | [Sync] CreateNewWindow(CreateNewWindowParams params) |
| 114 | => (CreateNewWindowReply reply); |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 115 | }; |