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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
|
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module content.mojom;
import "cc/mojom/browser_controls_state.mojom";
import "content/common/frame_messages.mojom";
import "content/common/navigation_client.mojom";
import "content/common/web_ui.mojom";
import "content/public/common/extra_mojo_js_features.mojom";
import "content/public/common/window_container_type.mojom";
import "ipc/constants.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
import "skia/public/mojom/skcolor.mojom";
import "services/network/public/mojom/attribution.mojom";
import "services/network/public/mojom/content_security_policy.mojom";
import "services/network/public/mojom/url_loader.mojom";
import "services/network/public/mojom/url_loader_completion_status.mojom";
import "services/network/public/mojom/url_loader_factory.mojom";
import "services/network/public/mojom/url_request.mojom";
import "services/network/public/mojom/url_response_head.mojom";
import "services/service_manager/public/mojom/interface_provider.mojom";
import "services/viz/public/mojom/compositing/surface_id.mojom";
import "third_party/blink/public/mojom/associated_interfaces/associated_interfaces.mojom";
import "third_party/blink/public/mojom/blob/blob_url_store.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "third_party/blink/public/mojom/commit_result/commit_result.mojom";
import "third_party/blink/public/mojom/conversions/conversions.mojom";
import "third_party/blink/public/mojom/devtools/console_message.mojom";
import "third_party/blink/public/mojom/fenced_frame/fenced_frame.mojom";
import "third_party/blink/public/mojom/fenced_frame/fenced_frame_config.mojom";
import "third_party/blink/public/mojom/frame/frame_owner_properties.mojom";
import "third_party/blink/public/mojom/frame/frame_policy.mojom";
import "third_party/blink/public/mojom/frame/frame_replication_state.mojom";
import "third_party/blink/public/mojom/frame/lifecycle.mojom";
import "third_party/blink/public/mojom/frame/policy_container.mojom";
import "third_party/blink/public/mojom/frame/remote_frame.mojom";
import "third_party/blink/public/mojom/frame/tree_scope_type.mojom";
import "third_party/blink/public/mojom/loader/referrer.mojom";
import "third_party/blink/public/mojom/navigation/navigation_policy.mojom";
import "third_party/blink/public/mojom/loader/resource_load_info.mojom";
import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
import "third_party/blink/public/mojom/messaging/transferable_message.mojom";
import "third_party/blink/public/mojom/navigation/navigation_params.mojom";
import "third_party/blink/public/mojom/navigation/navigation_initiator_activation_and_ad_status.mojom";
import "third_party/blink/public/mojom/page/page.mojom";
import "third_party/blink/public/mojom/page/prerender_page_param.mojom";
import "third_party/blink/public/mojom/partitioned_popins/partitioned_popin_params.mojom";
import "third_party/blink/public/mojom/picture_in_picture_window_options/picture_in_picture_window_options.mojom";
import "third_party/blink/public/mojom/widget/platform_widget.mojom";
import "third_party/blink/public/mojom/page/widget.mojom";
import "third_party/blink/public/mojom/renderer_preferences.mojom";
import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom";
import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";
import "third_party/blink/public/mojom/webpreferences/web_preferences.mojom";
import "third_party/blink/public/mojom/widget/visual_properties.mojom";
import "third_party/blink/public/mojom/window_features/window_features.mojom";
import "ui/accessibility/mojom/ax_tree_update.mojom";
import "ui/base/mojom/window_open_disposition.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/scheme_host_port.mojom";
import "url/mojom/url.mojom";
// A View (i.e. a "main frame") can be created for a few different cases, these
// values are used to specify which it is.
enum ViewWidgetType {
// A standard view that's the top-level widget in a frame hierarchy.
kTopLevel,
// A GuestView used to render contents inside a <webview> element.
kGuestView,
// A view used to render contents inside a <fencedframe> element.
kFencedFrame
};
// The type of the frame owner element for a child frame. In cross-process
// frames, this would be the type of the HTMLFrameOwnerElement for the remote
// child frame in the parent process. Note that only HTMLFrameOwnerElements for
// which CreateChildFrame is used are included here. Other
// HTMLFrameOwnerElements such as fenced frames do not use this.
enum ChildFrameOwnerElementType {
kIframe,
kObject,
kEmbed,
kFrame,
};
struct CreateViewParams {
// Renderer-wide preferences.
blink.mojom.RendererPreferences renderer_preferences;
// Preferences for this view.
blink.mojom.WebPreferences web_preferences;
// The session storage namespace ID this view should use.
string session_storage_namespace_id;
// The frame token of the opener frame if one exists, or std::nullopt
// otherwise.
blink.mojom.FrameToken? opener_frame_token;
// Information that needs to be replicated to the view's main frame, e.g.
// frame name and sandbox flags.
blink.mojom.FrameReplicationState replication_state;
// Used for devtools instrumentation and trace-ability. The token is shared
// across all frames (local or remotes) representing the same logical frame
// tree node, and is used by Blink and content to tag calls and requests for
// instrumentation purposes, allowing them to be attributed to a context
// frame.
//
// Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
// in the browser process, as the token is shared, making the mapping
// ambiguous and non-authoritative.
mojo_base.mojom.UnguessableToken devtools_main_frame_token;
CreateMainFrameUnion main_frame;
// Whether the `blink::WebView` should initially be hidden.
bool hidden;
// Prerender2: This field is set iff the blink::WebView is for a prerendering
// page.
blink.mojom.PrerenderParam? prerender_param;
// When true, all RenderWidgets under this `blink::WebView` will never be
// shown to the user, and thus never composited, and will not need to produce
// pixels for display. This allows the renderer to optimize and avoid
// resources used for displaying graphical output.
bool never_composited;
// Whether the window associated with this view was created by another window.
bool window_was_opened_by_another_window;
// Indicates whether the view is a regular top-level widget or some other
// nested "main frame" widget type.
ViewWidgetType type;
// If the frame being created is a fenced frame, stores the mode the fenced
// frame is set to. For all other frame types (type != kFencedFrame), this
// value will always be set to kDefault. Frames embedded in fenced frames
// will also have this value set to kDefault.
// Used by fenced frames to determine various security restrictions such as
// top-level navigation/popups.
blink.mojom.DeprecatedFencedFrameMode fenced_frame_mode;
// If the view is created embedded inside an extension, what the outermost
// origin is. This is not set for non-extensions to avoid leaking
// information into other renderers about what the embedding page is,
// however it is required for extensions.
url.mojom.Origin? outermost_origin;
// Endpoint for any messages that are broadcast to all views in a WebContents.
pending_associated_receiver<blink.mojom.PageBroadcast> blink_page_broadcast;
// Base background color of this view. Only used by a local main frame.
skia.mojom.SkColor? base_background_color;
// The ColorProviderColorMaps for this view.
blink.mojom.ColorProviderColorMaps color_provider_colors;
// Indicates which browsing context group the page in this view belongs to.
mojo_base.mojom.UnguessableToken browsing_context_group_token;
// Indicates whether web or OS-level Attribution Reporting is supported. See
// https://github.com/WICG/attribution-reporting-api/blob/main/app_to_web.md
network.mojom.AttributionSupport attribution_support;
// This must be null unless the view being created is a partitioned popin.
// See https://explainers-by-googlers.github.io/partitioned-popins/
blink.mojom.PartitionedPopinParams? partitioned_popin_params;
// Identifies the navigation that triggered this view creation, if any. Used
// for collecting metrics.
mojo_base.mojom.UnguessableToken? navigation_metrics_token;
};
// A union to distinguish between parameters specific to local main frame
// creation and remote main frame creation.
union CreateMainFrameUnion {
CreateLocalMainFrameParams local_params;
CreateProvisionalLocalMainFrameParams provisional_local_params;
CreateRemoteMainFrameParams remote_params;
};
// Parameters used for browser-initiated local main frame creation.
struct CreateLocalMainFrameParams {
// The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
blink.mojom.LocalFrameToken frame_token;
// The ID of the main frame hosted in the view. Must not be kRoutingIdNone.
int32 routing_id = IPC.mojom.kRoutingIdNone;
// The communication interfaces for the WebLocalFrame in blink.
pending_associated_receiver<content.mojom.Frame> frame;
pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
// The `AssociatedInterfaceProvider` that the main `RenderFrameImpl` will use
// to request associated interfaces from its corresponding
// `RenderFrameHostImpl`.
pending_associated_remote<blink.mojom.AssociatedInterfaceProvider>
associated_interface_provider_remote;
// Whether the frame is still on the initial empty document or not.
bool is_on_initial_empty_document = true;
// The document token to use for the initial document in the created frame.
// Note that this is independent of `is_on_initial_empty_document`: every
// fully-initialized frame always contains a document, even a provisional
// frame that is not yet swapped in.
blink.mojom.DocumentToken document_token;
// Null when the main frame has no policy container yet (for example, because
// it is a speculative RenderFrameHost), and the policy container will be
// sent during CommitNavigation.
blink.mojom.PolicyContainer? policy_container;
CreateFrameWidgetParams widget_params;
// Subresource loader factories to be used by the initial empty document.
blink.mojom.URLLoaderFactoryBundle subresource_loader_factories;
};
// Parameters used for browser-initiated provisional local main frame creation.
struct CreateProvisionalLocalMainFrameParams {
CreateLocalMainFrameParams local_params;
// The FrameToken of the previous LocalFrame that this new LocalFrame will
// replace. Will only be set when RenderDocument is enabled, for main frame
// LocalFrame <-> LocalFrame swap.
blink.mojom.FrameToken? previous_frame_token;
};
// Parameters used for brower-initiated remote main frame creation.
struct CreateRemoteMainFrameParams {
blink.mojom.RemoteFrameToken token;
// The communication channels for the Remote/RemoteMainFrame in this view.
blink.mojom.RemoteFrameInterfacesFromBrowser frame_interfaces;
blink.mojom.RemoteMainFrameInterfaces main_frame_interfaces;
};
// Parameters used for creating a new frame widget for a local root.
struct CreateFrameWidgetParams {
// Gives the routing ID for the RenderWidget that will be attached to the
// new RenderFrame.
int32 routing_id;
// The communication interfaces for the WebFrameWidget in blink.
pending_associated_remote<blink.mojom.FrameWidgetHost> frame_widget_host;
pending_associated_receiver<blink.mojom.FrameWidget> frame_widget;
pending_associated_remote<blink.mojom.WidgetHost> widget_host;
pending_associated_receiver<blink.mojom.Widget> widget;
// The initial visual properties of the widget.
blink.mojom.VisualProperties visual_properties;
// If true, reuse the compositor by taking it from the current local root's
// frame widget when this frame widget's frame commits and is swapped in.
bool reuse_compositor;
};
// Used for recreating child frames after a crash (does this still happen?) and
// speculative/provisional frames (including main frame).
//
// "Normal" child frame creation (via inserting a new frame owner element into
// the active document) does not use these params and is routed via
// CreateChildFrame().
//
// "Normal" main frame creation (whether browser-initiated, e.g. opening a new
// tab, or renderer-initiated, e.g. window.open()) also do not use these params
// and are routed via CreateView() and CreateNewWindow() respectively.
//
struct CreateFrameParams {
// The frame token. Used to map between LocalFrame and RenderFrameHostImpl.
blink.mojom.LocalFrameToken frame_token;
// Specifies the routing ID of the new RenderFrame object.
int32 routing_id;
// If a valid |previous_frame_token| is provided, the new frame will be
// configured to replace either the previous frame or the previous proxy on
// commit.
blink.mojom.FrameToken? previous_frame_token;
// Specifies the new frame's opener. The opener will be null if this is
// std::nullopt.
blink.mojom.FrameToken? opener_frame_token;
// The new frame should be created as a child of the object identified by
// `parent_frame_token`. If this is not specified it will be a a top level
// frame.
blink.mojom.FrameToken? parent_frame_token;
// Identifies the previous sibling of the new frame, so that the new frame is
// inserted into the correct place in the frame tree. If this is
// not specified the frame will be created as the leftmost child of its
// parent frame, in front of any other children.
blink.mojom.FrameToken? previous_sibling_frame_token;
pending_remote<blink.mojom.BrowserInterfaceBroker> interface_broker;
blink.mojom.TreeScopeType tree_scope_type;
// When the new frame has a parent, |replication_state| holds the new frame's
// properties replicated from the process rendering the parent frame, such as
// the new frame's sandbox flags.
blink.mojom.FrameReplicationState replication_state;
// Used for devtools instrumentation and trace-ability. The token is
// propagated to Blink's LocalFrame and both Blink and content/
// can tag calls and requests with this instrumentation token in order to
// attribute them to the context frame.
// |devtools_frame_token| is only defined by the browser and is never
// sent back from the renderer in the control calls.
mojo_base.mojom.UnguessableToken devtools_frame_token;
// When the new frame has a parent, |frame_owner_properties| holds the
// properties of the HTMLFrameOwnerElement from the parent process.
// Note that unlike FrameReplicationState, this is not replicated for remote
// frames.
blink.mojom.FrameOwnerProperties frame_owner_properties;
// Specifies properties for a new RenderWidget that will be attached to the
// new RenderFrame (if one is needed).
CreateFrameWidgetParams? widget_params;
// Whether the frame is still on the initial empty document or not.
bool is_on_initial_empty_document = true;
// The document token to use for the initial document in the created frame.
// Note that this is independent of `is_on_initial_empty_document`: every
// fully-initialized frame always contains a document, even a provisional
// frame that is not yet swapped in.
blink.mojom.DocumentToken document_token;
// The policy container for the frame to be created. This can be null if we
// could not determine a policy container yet, for example in case of a
// speculative RenderFrameHost. In that case, the final policy container will
// be sent along CommitNavigation.
blink.mojom.PolicyContainer? policy_container;
// The mojo connection to the mojom::Frame in the renderer.
pending_associated_receiver<content.mojom.Frame> frame;
// The `AssociatedInterfaceProvider` that the `RenderFrameImpl` will use to
// request associated interfaces from its corresponding `RenderFrameHostImpl`.
pending_associated_remote<blink.mojom.AssociatedInterfaceProvider>
associated_interface_provider_remote;
// Set if this frame corresponds to the main frame for a non top-level
// FrameTree (GuestView, fenced frame etc.).
bool is_for_nested_main_frame;
// Identifies the navigation that triggered this frame creation, if any. Used
// for collecting metrics.
mojo_base.mojom.UnguessableToken? navigation_metrics_token;
};
// Provided with each call to Frame::GetSerializedHtmlWithLocalLinks() so that
// the renderer can notify the browser process each time that a chunk of HTML
// data gets serialized, as well as when the entire process is finished.
interface FrameHTMLSerializerHandler {
// Sent by the renderer as a response to GetSerializedHtmlWithLocalLinks() to
// indicate that HTML data has been serialized, included in |data_buffer|.
DidReceiveData(string data_buffer);
// Reports that the serialization process is finished. It is expected to
// receive this message right after the last time DidReceiveData() is called.
Done();
};
struct SnapshotAccessibilityTreeParams {
// See ui/accessibility/ax_mode.h for valid values of |ax_mode|.
uint32 ax_mode;
// The maximum number of nodes to snapshot before exiting early.
// Note that this is not a hard limit; once this limit is reached a
// few more nodes may be added in order to ensure a well-formed
// tree is returned. Use 0 for no max. The corresponding C++ code
// uses size_t.
uint64 max_nodes;
// The maximum amount of time to spend snapshotting the tree. Like
// max_nodes, this is not a hard limit, and once this limit is reached
// a few more nodes may be added in order to ensure a well-formed tree.
// Use 0 for no timeout.
mojo_base.mojom.TimeDelta timeout;
};
// An enumeration specifying the reason of the frame deletion.
enum FrameDeleteIntention {
// The frame being deleted isn't a (speculative) main frame.
kNotMainFrame,
// The frame being deleted is a speculative main frame, and it is being
// deleted as part of the shutdown for that WebContents. The entire RenderView
// etc will be destroyed by a separate IPC sent later.
kSpeculativeMainFrameForShutdown,
// The frame being deleted is a speculative main frame, and it is being
// deleted because the speculative navigation was cancelled. This is not part
// of shutdown.
kSpeculativeMainFrameForNavigationCancelled,
};
// Implemented by the frame provider, and must be associated with other content
// mojoms bound to frames, widgets, views, and currently also with the legacy
// IPC channel.
// KEEP THE COMMIT FUNCTIONS IN SYNC in content/common/navigation_client.mojom.
// These will eventually be removed from Frame.
interface Frame {
// Tells the renderer that a same-document navigation should be committed.
// The renderer will return a status value indicating whether the commit
// could proceed as expected or not. In particular, it might be necessary to
// restart the navigation if it is no-longer same-document, which can happen
// if the renderer committed another navigation in the meantime.
//
// The [SupportsUrgent] attribute enables marking this message as urgent by
// calling the method in an UrgentMessageScope. Urgent messages cause the
// renderer to prioritize the IPC task queue while there are urgent messages
// pending, which increases their priority while maintaining ordering
// guarantees. See also mojo/public/tools/bindings/README.md.
[SupportsUrgent]
CommitSameDocumentNavigation(
blink.mojom.CommonNavigationParams common_params,
blink.mojom.CommitNavigationParams request_params)
=> (blink.mojom.CommitResult commit_result);
// Provides the renderer an updated |subresource_loader_factories|.
//
// This method is intended to fix broken loaders after a Network Service
// crash, and is only used when Network Service is enabled.
//
// The new bundle contains replacement factories for a subset of the
// receiver's existing bundle.
UpdateSubresourceLoaderFactories(
blink.mojom.URLLoaderFactoryBundle subresource_loader_factories);
// Indicates that the frame host (browser) wants the |untrusted_stack_trace|
// parameter of DidAddMessageToConsole() filled in for Error messages if at
// all possible.
SetWantErrorMessageStackTrace();
// Unload this RenderFrame and replace it by a RenderFrameProxy, so the frame
// can navigate to a document rendered by a different process. The unload can
// fail if the RenderFrame is currently detached (it was removed from the
// frame tree before the Unload was received). If successful this message will
// send back AgentSchedulingGroupHost::DidUnloadRenderFrame message. This
// cannot be a standard reply callback because the unload acknowledgement must
// be posted back to the event loop to be invoked later. This is to ensure
// that any postMessage() calls executed by JS during unload are dispatched,
// since postMessage dispatch is always scheduled asynchronously.
//
// `new_remote_frame_replication_state`, `new_remote_frame_token`,
// and `new_remote_main_frame_interfaces` are used to construct the new
// RenderFrameProxy. `is_loading` mirrors the loading state of the
// FrameTreeNode's current RenderFrameHost and determines whether
// the newly-constructed RenderFrameProxy is marked as loading or not.
// `devtools_frame_token` is optional and only set when Unload is called for
// the placeholder frame when attaching a guest (it is the guest's main
// frame's devtools_frame_token and is created in the browser process).
Unload(
bool is_loading,
blink.mojom.FrameReplicationState new_remote_frame_replication_state,
blink.mojom.RemoteFrameToken new_remote_frame_token,
blink.mojom.RemoteFrameInterfacesFromBrowser new_remote_frame_interfaces,
blink.mojom.RemoteMainFrameInterfaces new_remote_main_frame_interfaces,
mojo_base.mojom.UnguessableToken? devtools_frame_token);
// Delete the frame. This is only called for child frames that the browser
// wants to detach, or for speculative main frames which are owned by the
// browser process. Committed main frames are owned by the renderer's WebView
// and can not be deleted directly.
Delete(FrameDeleteIntention intention);
// Requests that a speculative RenderFrameHost which the browser has already
// sent a `CommitNavigation()` to should swap itself back out for a
// RenderFrameProxy to effectively undo the `CommitNavigation()`.
//
// This is needed when discarding a speculative RenderFrameHost that's already
// been asked to commit a navigation, as the state between the browser and
// renderer would otherwise be out of sync:
//
// - from the perspective of the browser process, the speculative
// RenderFrameHost has not yet committed as it has not yet acknowledged the
// `CommitNavigation()` with `DidCommitNavigation()`.
// - but any IPCs sent from the browser to the renderer will see that the
// provisional RenderFrame has already been swapped in and the
// RenderFrameProxy it replaced destroyed.
//
// Note: This, of course, does not work for RenderDocument, since the
// provisional RenderFrame replaces *another* RenderFrame when it commits. The
// state associated with the replaced RenderFrame is already gone, and it's
// impossible to restore it. Fixing this issue for RenderDocument will
// require serious reworking of how navigations are committed.
//
// While this is very similar to `Unload()`, the renderer will not send any
// unload ACK back to the browser on completion. As a result, there is no
// special handling to ensure messages queued by Window.postMessage() are
// forwarded.
//
// `new_remote_frame_replication_state`, `new_remote_frame_token`, and
// `new_remote_main_frame_interfaces` are used to construct the new
// RenderFrameProxy. `is_loading` mirrors the loading state of the
// FrameTreeNode's current RenderFrameHost and determines whether
// the newly-constructed RenderFrameProxy is marked as loading or not.
//
// TODO(dcheng): It's unclear if `is_loading` is necessary; presently, it
// always seems to be true when this IPC is called.
UndoCommitNavigation(
bool is_loading,
blink.mojom.FrameReplicationState new_remote_frame_replication_state,
blink.mojom.RemoteFrameToken new_remote_frame_token,
blink.mojom.RemoteFrameInterfacesFromBrowser new_remote_frame_interfaces,
blink.mojom.RemoteMainFrameInterfaces new_remote_main_frame_interfaces);
GetInterfaceProvider(
pending_receiver<service_manager.mojom.InterfaceProvider> interfaces);
// Requests a one-time snapshot of the accessibility tree without enabling
// accessibility if it wasn't already enabled.
SnapshotAccessibilityTree(SnapshotAccessibilityTreeParams params)
=> (ax.mojom.AXTreeUpdate snapshot);
// Get HTML data by serializing the target frame and replacing all resource
// links with a path to the local copy passed in the message payload. In order
// to report progress to the the browser process, a pending remote is passed
// via |callback_remote|, so that direct communication with the SavePackage
// object that initiated the process can be established.
GetSerializedHtmlWithLocalLinks(
map<url.mojom.Url, mojo_base.mojom.FilePath> url_map,
map<blink.mojom.FrameToken, mojo_base.mojom.FilePath>
frame_token_map, bool save_with_empty_url,
pending_remote<FrameHTMLSerializerHandler> handler_remote);
};
// Implemented by the frame (e.g. renderer processes).
// Instances of this interface must be associated with (i.e., FIFO with) the
// legacy IPC channel.
interface FrameBindingsControl {
// Used to tell a render frame whether it should expose various bindings
// that allow JS content extended privileges. See BindingsPolicy for valid
// flag values.
AllowBindings(int64 enabled_bindings_flags);
// Used to tell the RenderFrame to enable Mojo JS bindings, which allows
// JS code running in the renderer process to connect to Mojo interfaces
// and make method calls on them.
//
// ExtraMojoJsFeatures describes a set of additional features that can be
// used with MojoJs. For example, helper methods for MojoJs to better work
// with Web API objects.
//
// This is used for WebUI only at this time.
EnableMojoJsBindings(ExtraMojoJsFeatures? features);
// Used to enable MojoJS bindings, exposing only the interfaces provided
// by `broker`.
EnableMojoJsBindingsWithBroker(
pending_remote<blink.mojom.BrowserInterfaceBroker> broker);
// Used to bind WebUI and WebUIHost mojo connections.
BindWebUI(pending_associated_receiver<content.mojom.WebUI> receiver,
pending_associated_remote<content.mojom.WebUIHost> remote);
};
struct CreateNewWindowParams {
// True if ContentRendererClient allows popups. This is the case only for
// extensions.
bool allow_popup;
// Type of window requested.
WindowContainerType window_container_type;
// The session storage namespace ID this window should use.
string session_storage_namespace_id;
// The session storage namespace ID this window should clone from.
// TODO(dmurph): Remove this once session storage is fully mojo'd, as the
// clone call happens on a different interface. https://crbug.com/716490
string clone_from_session_storage_namespace_id;
// The name of the resulting frame that should be created (empty if none
// has been specified). UTF8 encoded string.
string frame_name;
// Whether the opener will be suppressed in the new window, in which case
// scripting the new window is not allowed.
bool opener_suppressed;
// Whether new window is created for a form submission.
bool is_form_submission;
// Whether a user gesture will be consumed by the opener.
bool consumes_user_activation;
// Body of HTTP POST request for form submission.
network.mojom.URLRequestBody? form_submission_post_data;
// The content type from the request headers for POST requests.
string form_submission_post_content_type;
// Whether the window should be opened in the foreground, background, etc.
ui.mojom.WindowOpenDisposition disposition;
// The URL that will be loaded in the new window (empty if none has been
// specified).
url.mojom.Url target_url;
// The referrer that will be used to load |target_url| (empty if none has
// been specified).
blink.mojom.Referrer referrer;
// The window features to use for the new window.
blink.mojom.WindowFeatures features;
// The impression associated with the navigation in the new window, if
// one is specified.
blink.mojom.Impression? impression;
// Governs how downloads are handled if `target_url` results in a download.
blink.mojom.NavigationDownloadPolicy download_policy;
// Additional parameters for creating picture-in-picture windows.
blink.mojom.PictureInPictureWindowOptions? pip_options;
// The navigation initiator's user activation and ad status.
blink.mojom.NavigationInitiatorActivationAndAdStatus
initiator_activation_and_ad_status;
// The pending mojo connection to the Frame implementation in the renderer.
pending_associated_remote<content.mojom.Frame> frame_remote;
// The communication interfaces for the PageBroadcast.
pending_associated_remote<blink.mojom.PageBroadcast> page_broadcast_remote;
pending_receiver<blink.mojom.BrowserInterfaceBroker>
main_frame_interface_broker;
// The `AssociatedInterfaceProvider` that the main `RenderFrameImpl` will use
// to request associated interfaces from its corresponding
// `RenderFrameHostImpl`.
pending_associated_receiver<blink.mojom.AssociatedInterfaceProvider>
associated_interface_provider;
// The communication interfaces for the WebFrameWidget in blink.
pending_associated_receiver<blink.mojom.WidgetHost> widget_host;
pending_associated_remote<blink.mojom.Widget> widget;
pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host;
pending_associated_remote<blink.mojom.FrameWidget> frame_widget;
};
// Operation result when the renderer asks the browser to create a new window.
enum CreateNewWindowStatus {
// Creation of the new window was blocked, e.g. because the source frame
// doesn't have user activation.
kBlocked,
// Ignore creation of the new window, e.g. because noopener is in effect.
kIgnore,
// Reuse the current window rather than creating a new window.
kReuse,
// Create a new window using the corresponding params in |reply|.
kSuccess,
};
// All routing IDs in this struct must be set to a valid routing ID.
// TODO(dcheng): It's almost possible to use CreateLocalMainFrameParams here.
// See if there's a reasonable way to factor out state here by splitting things
// into browser-created params vs renderer-created params.
struct CreateNewWindowReply {
// The unique identifier of the RenderFrameHost
blink.mojom.LocalFrameToken main_frame_token;
// The ID of the main frame hosted in the view.
int32 main_frame_route_id;
int32 widget_routing_id;
// The initial visual properties of the widget.
blink.mojom.VisualProperties visual_properties;
// Duplicated from CreateNewWindowParams because legacy code.
string cloned_session_storage_namespace_id;
// Used for devtools instrumentation and trace-ability. The token is shared
// across all frames (local or remotes) representing the same logical frame
// tree node, and is used by Blink and content to tag calls and requests for
// instrumentation purposes, allowing them to be attributed to a context
// frame.
//
// Must not be used to look up a RenderFrameHostImpl or RenderFrameProxyHost
// in the browser process, as the token is shared, making the mapping
// ambiguous and non-authoritative.
mojo_base.mojom.UnguessableToken devtools_main_frame_token;
// Used by devtools instrumentation to tell devtools agent in the renderer
// that it should pause created window and wait for an explicit resume command
// from the client.
bool wait_for_debugger;
blink.mojom.DocumentToken document_token;
// The policy container for the new frame that will be created by Blink in
// response.
blink.mojom.PolicyContainer policy_container;
// Indicates which browsing context group the page in this view belongs to.
mojo_base.mojom.UnguessableToken browsing_context_group_token;
// The ColorProviderColorMaps for this view.
blink.mojom.ColorProviderColorMaps color_provider_colors;
// This must be null unless the view being created is a partitioned popin.
// See https://explainers-by-googlers.github.io/partitioned-popins/
blink.mojom.PartitionedPopinParams? partitioned_popin_params;
// Initial window geometry.
gfx.mojom.Rect? widget_screen_rect;
gfx.mojom.Rect? window_screen_rect;
};
// A per-navigation interface passed along with the BeginNavigation call, used
// to listen to the end of the renderer-initiated navigation cancelation window
// for that navigation. See comment below for more details.
interface NavigationRendererCancellationListener {
// Called when the navigation cancellation window for a renderer-initiated
// navigation ended, as the JS task in which the navigation started had
// finished running. Renderer-initiated navigations need to wait for this
// message before they can commit, as those navigations can be canceled by
// script (e.g. through calling window.stop() or document.open()) that runs
// on the same task. See RendererCancellationThrottle for more details.
RendererCancellationWindowEnded();
};
// Implemented by the frame server (i.e. the browser process). For messages that
// must be associated with the IPC channel.
interface FrameHost {
// Sent by the renderer to request the browser to create a new window. |reply|
// is only non-null on when status == CreateNewWindowStatus::kSuccess.
[Sync] CreateNewWindow(CreateNewWindowParams params)
=> (CreateNewWindowStatus status, CreateNewWindowReply? reply);
// Asynchronously creates a child frame. A blink.mojom.LocalFrameToken must
// be allocated first by calling
// `RenderMessageFilter::GenerateSingleFrameRoutingInfo`. Each of these
// messages will have a corresponding mojom::FrameHost::Detach API sent when
// the frame is detached from the DOM.
CreateChildFrame(blink.mojom.LocalFrameToken child_frame_token,
pending_associated_remote<content.mojom.Frame> frame,
pending_receiver<blink.mojom.BrowserInterfaceBroker>
browser_interface_broker,
blink.mojom.PolicyContainerBindParams
policy_container_bind_params,
pending_associated_receiver<blink.mojom.AssociatedInterfaceProvider>
associated_interface_provider,
blink.mojom.TreeScopeType scope,
string frame_name,
string frame_unique_name,
bool is_created_by_script,
blink.mojom.FramePolicy frame_policy,
blink.mojom.FrameOwnerProperties frame_owner_properties,
ChildFrameOwnerElementType child_frame_owner_element_type,
int64 document_ukm_source_id);
// Sent by the renderer when a navigation commits in the frame.
// If |interface_params| is non-empty, the FrameHost implementation
// must unbind the old BrowserInterfaceBroker connections, and drop any
// interface requests pending on them. Then it should bind the appropriate
// requests and start servicing GetInterface messages coming in on these new
// connections in a security context that is appropriate for the committed
// navigation.
//
// The FrameHost implementation must enforce that |interface_params|
// is set for cross-document navigations. This prevents origin confusion by
// ensuring that interface requests racing with navigation commit will be
// either ignored, or serviced correctly in the security context of the
// document they originated from (based on which BrowserInterfaceBroker
// connection the GetInterface messages arrive on).
DidCommitProvisionalLoad(
DidCommitProvisionalLoadParams params,
DidCommitProvisionalLoadInterfaceParams? interface_params);
// Sent by the renderer to indicate that a same document navigation
// committed in the renderer process.
DidCommitSameDocumentNavigation(
DidCommitProvisionalLoadParams params,
DidCommitSameDocumentNavigationParams same_document_params);
// Sent by the renderer to indicate that the document input stream has
// been updated using document.open() and that the URL for the current
// document in the frame should be updated to `url` per step 12 of
// https://whatwg.org/C/dynamic-markup-insertion.html#document-open-steps.
DidOpenDocumentInputStream(url.mojom.Url url);
// Sent by the renderer to request a navigation.
// |blob_url_token| should be non-null when this is a navigation to a blob:
// URL. The token will then be used to look up the blob associated with the
// blob URL. Without this by the time the navigation code starts fetching
// the URL the blob URL might no longer be valid. |blob_url_token| is
// not part of BeginNavigationParams because that struct needs to be
// cloneable, and thus can't contain mojo interfaces.
// If an invalid BlobURLToken is passed in, or if the token doesn't match the
// url in |common_params|, the navigation will result in a network error.
// |navigation_client| is passed to the renderer to allow for further control
// of the navigation. Allows for Commit and Cancels/Aborts.
// Passing the |initiator_navigation_state_keep_alive_handle| is just a means
// to ensure that the NavigationStateKeepAlive of the initiator
// RenderFrameHost is kept alive, even if the RenderFrameHost itself has
// already been deleted in the meantime. If this can be ensured in other ways,
// it is safe to pass a mojo::NullRemote. In particular, if the initiator
// LocalFrame is alive when issuing this mojo call, there is no need to pass
// |initiator_navigation_state_keep_alive_handle|, since the initiator
// NavigationStateKeepAlive is kept alive by LocalFrame's PolicyContainer.
// TODO(crbug.com/40276805): |navigation_client| should not be
// optional. Make it mandatory.
// |renderer_cancellation_listener| is a per-navigation interface used to
// listen to the end of the renderer-initiated navigation cancelation window
// for this navigation. See comment for NavigationRendererCancellationListener
// for more details.
BeginNavigation(
blink.mojom.CommonNavigationParams common_params,
blink.mojom.BeginNavigationParams begin_params,
pending_remote<blink.mojom.BlobURLToken>? blob_url_token,
pending_associated_remote<NavigationClient>? navigation_client,
pending_remote<blink.mojom.NavigationStateKeepAliveHandle>?
initiator_navigation_state_keep_alive_handle,
pending_receiver<NavigationRendererCancellationListener>
renderer_cancellation_listener);
// Sent when a subresource response has started.
//
// |final_response_url| is the final (after all redirects) URL of the
// subresource response. The full URL is not available, because in some
// cases the path and query may be sanitized away
// - see https://crbug.com/973885.
//
// |cert_status| is the bitmask of status info of the SSL certificate. (see
// net/cert/cert_status_flags.h).
SubresourceResponseStarted(
url.mojom.SchemeHostPort final_response_url,
uint32 cert_status);
// Sent when a resource load finished, successfully or not.
ResourceLoadComplete(blink.mojom.ResourceLoadInfo url_load_info);
// Sent when the frame changes its window.name.
DidChangeName(string name, string unique_name);
// If a cross-process navigation was started for the initial history load in
// this subframe, this tries to cancel it to allow a client redirect to happen
// instead.
CancelInitialHistoryLoad();
// Change the encoding name of the page in UI when the page has detected
// proper encoding name. Sent for top-level frames.
UpdateEncoding(string encoding_name);
// Updates information to determine whether a user gesture should carryover to
// future navigations. This is needed so navigations within a certain
// timeframe of a request initiated by a gesture will be treated as if they
// were initiated by a gesture too, otherwise the navigation may be blocked.
[EnableIf=is_android]
UpdateUserGestureCarryoverInfo();
// Notifies the browser that this frame has new session history information.
//
// NOTE: PageState can be quite large when serialized, and its message
// structure must remain stable; hence [UnlimitedSize] for this message.
[UnlimitedSize]
UpdateState(PageState state);
// Requests that the given URL be opened in the specified manner.
OpenURL(blink.mojom.OpenURLParams params);
// Called when the renderer is done loading a frame.
DidStopLoading();
};
|