[M120 Migration] Introduces network loading API
[platform/framework/web/chromium-efl.git] / third_party / blink / public / mojom / widget / platform_widget.mojom
1 // Copyright 2021 The Chromium Authors
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 blink.mojom;
6
7 import "cc/mojom/render_frame_metadata.mojom";
8 import "mojo/public/mojom/base/string16.mojom";
9 import "mojo/public/mojom/base/text_direction.mojom";
10 import "mojo/public/mojom/base/time.mojom";
11 import "services/viz/public/mojom/compositing/compositor_frame_sink.mojom";
12 import "skia/public/mojom/skcolor.mojom";
13 import "ui/base/cursor/mojom/cursor.mojom";
14 import "ui/gfx/geometry/mojom/geometry.mojom";
15 import "third_party/blink/public/mojom/input/input_handler.mojom";
16 import "third_party/blink/public/mojom/widget/visual_properties.mojom";
17 import "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom";
18 import "ui/base/ime/mojom/text_input_state.mojom";
19
20 [EnableIf=is_efl]
21 import "skia/public/mojom/bitmap.mojom";
22
23 [EnableIf=is_efl]
24 import "mojo/public/mojom/base/file_path.mojom";
25
26 // This interface is bound on the compositor thread.
27 interface WidgetCompositor {
28   // Requests that the RenderWidget sends back a response after the next main
29   // frame is generated and presented in the display compositor.
30   VisualStateRequest() => ();
31 };
32
33 // Implemented in Browser, this interface defines widget-specific methods that
34 // will be invoked from the render process (e.g. content::RenderWidgetHostImpl).
35 interface WidgetHost {
36   // Updates the current cursor to be used by the browser for indicating the
37   // location of a pointing device.
38   SetCursor(ui.mojom.Cursor cursor);
39
40   [EnableIf=is_tizen_tv]
41   //Browser edge scroll
42   DidEdgeScrollBy(gfx.mojom.Point offset, bool handled);
43
44   // Sent by a widget to the browser to set the tooltip text for the current
45   // cursor position. An empty |tooltip_text| will hide the tooltip view.
46   UpdateTooltipUnderCursor(mojo_base.mojom.String16 tooltip_text,
47                            mojo_base.mojom.TextDirection text_direction_hint);
48
49   //Notitfy trackinfo to browser process
50   [EnableIf=is_tizen_tv]
51   NotifyTrackInfoToBrowser(int32 active_track_id, string url, string lang);
52
53   // Sent by a widget to the browser to set the tooltip text and trigger a
54   // tooltip to show up, aligned with the bounds (in widget-relative DIPS)
55   // passed by parameter. An empty |tooltip_text| will hide the tooltip view.
56   UpdateTooltipFromKeyboard(mojo_base.mojom.String16 tooltip_text,
57                             mojo_base.mojom.TextDirection text_direction_hint,
58                             gfx.mojom.Rect bounds);
59
60   // Sent by a widget to the browser to clear any keyboard-triggered tooltip.
61   // This is needed because a keyboard-triggered tooltip follows the focused
62   // element set by the user from a keypress, but the focus could change
63   // programmatically to another element. In such a case, because of this
64   // dependency on focus, we want to hide keyboard-triggered tooltips but not
65   // the cursor-triggered ones, which don't rely on focus.
66   ClearKeyboardTriggeredTooltip();
67
68   // Sent when the text input state is changed. This usually happens when
69   // a text input entry is focused.
70   TextInputStateChanged(ui.mojom.TextInputState state);
71
72   // Sent when the current selection bounds are changed.
73   SelectionBoundsChanged(gfx.mojom.Rect anchor_rect,
74              mojo_base.mojom.TextDirection anchor_dir,
75              gfx.mojom.Rect focus_rect,
76              mojo_base.mojom.TextDirection focus_dir,
77              gfx.mojom.Rect bounding_box_rect,
78              bool is_anchor_first);
79
80   // Create a CompositorFrameSink that is associated with this widget.
81   // The renderer compositor will use the returned sink to submit
82   // CompositorFrames for this widget.
83   CreateFrameSink(
84       pending_receiver<viz.mojom.CompositorFrameSink>
85           compositor_frame_sink_receiver,
86       pending_remote<viz.mojom.CompositorFrameSinkClient>
87           compositor_frame_sink_client);
88
89   // Register compositor RenderFrameMetadataObserver and client.
90   // This call will be made in conjunction with calling CreateFrameSink.
91   // The renderer compositor will invoke the RenderFrameMetadataObserver
92   // apis when it produces a frame that changes the metadata.
93   RegisterRenderFrameMetadataObserver(
94       pending_receiver<cc.mojom.RenderFrameMetadataObserverClient>
95         render_frame_metadata_observer_client_receiver,
96       pending_remote<cc.mojom.RenderFrameMetadataObserver>
97         render_frame_metadata_observer);
98 };
99
100 // Implemented in Blink, this interface defines widget-specific methods that
101 // will be invoked from the browser process (e.g. blink::WebWidget).
102 interface Widget {
103   // Sent by the browser to ask the renderer to redraw. Robust to events that
104   // can happen in renderer (abortion of the commit or draw, loss of output
105   // surface etc.).
106   ForceRedraw() => ();
107
108   // Setup the input channel for this widget. If the widget is a frame,
109   // then it can also obtain a FrameWidgetInputHandler from the
110   // WidgetInputHandler interface.
111   GetWidgetInputHandler(
112     pending_receiver<blink.mojom.WidgetInputHandler> request,
113     pending_remote<blink.mojom.WidgetInputHandlerHost> host);
114
115   // Update the visual properties of the widget.
116   UpdateVisualProperties(VisualProperties visual_properties);
117
118   // Informs the widget of its position on the user's screen, as well as
119   // the position of the native window holding the widget.
120   // TODO(danakj): These should be part of UpdateVisualProperties.
121   UpdateScreenRects(gfx.mojom.Rect widget_screen_rect,
122                     gfx.mojom.Rect window_screen_rect) => ();
123
124   [EnableIf=is_efl]
125   SetMainFrameScrollbarVisible(bool visible);
126
127   [EnableIf=is_efl]
128   RequestMainFrameScrollbarVisible() => (bool visible);
129
130   [EnableIf=is_efl]
131   GetBackgroundColor() => (skia.mojom.SkColor bg_color);
132
133   [EnableIf=is_efl]
134   GetContentSnapshot(gfx.mojom.Rect snapshot_rect, float page_scale_factor)
135       => (skia.mojom.BitmapN32? bitmap);
136
137   [EnableIf=is_efl]
138   UpdateFocusedNodeBounds() => (gfx.mojom.RectF rect);
139
140   [EnableIf=is_efl]
141   SetLongPollingGlobalTimeout(uint64 timeout);
142
143   [EnableIf=is_efl]
144   ResetLastInteractedElements();
145
146   [EnableIf=is_tizen_tv]
147   IsVideoPlaying() => (bool is_video_playing);
148
149   [EnableIf=is_tizen_tv]
150   SetTranslatedURL(string url);
151
152   [EnableIf=is_tizen_tv]
153   SetParentalRatingResult(string url, bool is_pass);
154
155   [EnableIf=is_tizen_tv]
156   SetPreferSubtitleLang(string lang_list);
157
158   [EnableIf=is_efl]
159   PrintToPdf(uint32 width, uint32 height, mojo_base.mojom.FilePath filename);
160
161   [EnableIf=is_tizen]
162   PauseScheduledTasks();
163
164   [EnableIf=is_tizen]
165   UnPauseScheduledTasks();
166
167   [EnableIf=is_efl]
168   QueryInputType() => (bool input_type);
169
170   [EnableIf=is_efl]
171   SelectClosestWord(uint32 x, uint32 y);
172
173   [EnableIf=is_efl]
174   SelectFocusedLink();
175
176   [EnableIf=is_efl]
177   RequestSelectionRect() => (gfx.mojom.Rect rect);
178
179   [EnableIf=is_tizen_tv]
180   SetFloatVideoWindowState(bool enabled);
181
182   [EnableIf=is_tizen_tv]
183   SuspendNetworkLoading();
184
185   [EnableIf=is_tizen_tv]
186   ResumeNetworkLoading();
187
188   // Informs the widget that it was hidden. This allows it to reduce its
189   // resource utilization, and will cancel any pending
190   // RecordContentToVisibleTimeRequest that was set with WasShown or
191   // RequestSuccessfulPresentationTimeForNextFrame.
192   WasHidden();
193
194   // Tells the render view that it is no longer hidden (see WasHidden).
195   WasShown(bool was_evicted,
196            RecordContentToVisibleTimeRequest? record_tab_switch_time_request);
197
198   // Asks the render view to report the time its next frame is presented to
199   // the compositor. If the view is not visible this will do nothing.
200   RequestSuccessfulPresentationTimeForNextFrame(
201     RecordContentToVisibleTimeRequest visible_time_request);
202
203   // Cancels any pending RecordContentToVisibleTimeRequest that was set with
204   // WasShown or RequestSuccessfulPresentationTimeForNextFrame. If there are
205   // none this will do nothing.
206   CancelSuccessfulPresentationTimeRequest();
207 };
208