1// Copyright 2021 The Chromium Embedded Framework 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 5module cef.mojom; 6 7import "mojo/public/mojom/base/shared_memory.mojom"; 8import "mojo/public/mojom/base/string16.mojom"; 9import "mojo/public/mojom/base/values.mojom"; 10import "services/network/public/mojom/site_for_cookies.mojom"; 11import "services/network/public/mojom/url_request.mojom"; 12import "third_party/blink/public/mojom/loader/referrer.mojom"; 13import "ui/gfx/geometry/mojom/geometry.mojom"; 14import "url/mojom/url.mojom"; 15 16// Structure passed to UpdateDraggableRegions(). 17struct DraggableRegionEntry { 18 gfx.mojom.Rect bounds; 19 bool draggable; 20}; 21 22// Structure passed to LoadRequest(). 23struct RequestParams { 24 // Request method. 25 string method; 26 27 // The URL to be loaded. 28 url.mojom.Url url; 29 30 // The referrer for the request. 31 blink.mojom.Referrer referrer; 32 33 // Usually the URL of the document in the top-level window, which may be 34 // checked by the third-party cookie blocking policy. Leaving it empty may 35 // lead to undesired cookie blocking. Third-party cookie blocking can be 36 // bypassed by setting site_for_cookies = url, but this should ideally 37 // only be done if there really is no way to determine the correct value. 38 network.mojom.SiteForCookies site_for_cookies; 39 40 // Additional HTTP request headers. 41 string headers; 42 43 // net::URLRequest load flags (0 by default). 44 int32 load_flags; 45 46 // Upload data (may be empty). 47 network.mojom.URLRequestBody? upload_data; 48}; 49 50// Interface for communicating with a frame in the renderer process. 51interface RenderFrame { 52 // Browser process has received the FrameAttached() message. 53 FrameAttachedAck(); 54 55 // Send a message to the render process. 56 SendMessage(string name, mojo_base.mojom.ListValue arguments); 57 58 // Send a command. 59 SendCommand(string command); 60 61 // Send a command that returns an async response. 62 // The returned |response| format is command-specific and will be invalid if 63 // an error occurred. 64 SendCommandWithResponse(string command) => 65 (mojo_base.mojom.ReadOnlySharedMemoryRegion? response); 66 67 // Send JavaScript for execution. 68 SendJavaScript(mojo_base.mojom.String16 jsCode, string scriptUrl, 69 int32 startLine); 70 71 // Load a request. 72 LoadRequest(RequestParams params); 73 74 // Loading has stopped. 75 DidStopLoading(); 76 77 // Move or resize of the renderer's containing window has started. Used on 78 // Windows and Linux with the Alloy runtime. 79 MoveOrResizeStarted(); 80}; 81 82// Interface for communicating with a frame in the browser process. 83interface BrowserFrame { 84 // Send a message to the browser process. 85 SendMessage(string name, mojo_base.mojom.ListValue arguments); 86 87 // The render frame is ready to begin handling actions. 88 FrameAttached(pending_remote<RenderFrame> render_frame, 89 bool reattached); 90 91 // The render frame has finished loading. 92 DidFinishFrameLoad(url.mojom.Url validated_url, int32 http_status_code); 93 94 // Draggable regions have updated. 95 UpdateDraggableRegions(array<DraggableRegionEntry>? regions); 96}; 97 98struct CrossOriginWhiteListEntry { 99 string source_origin; 100 string target_protocol; 101 string target_domain; 102 bool allow_target_subdomains; 103}; 104 105struct NewRenderThreadInfo { 106 array<CrossOriginWhiteListEntry>? cross_origin_whitelist_entries; 107}; 108 109struct NewBrowserInfo { 110 int32 browser_id; 111 bool is_popup; 112 bool is_windowless; 113 bool is_guest_view; 114 mojo_base.mojom.DictionaryValue? extra_info; 115}; 116 117// Interface for communicating with browser management in the browser process. 118interface BrowserManager { 119 // Retrieve info for a new RenderThread. 120 [Sync] 121 GetNewRenderThreadInfo() => (NewRenderThreadInfo info); 122 123 // Retrieve info for a new CefBrowser. 124 [Sync] 125 GetNewBrowserInfo(int32 render_frame_routing_id) => (NewBrowserInfo info); 126}; 127 128// Interface for communicating with browser management to the render process. 129interface RenderManager { 130 // Manage cross-origin whitelist contents during the render process lifespan. 131 ModifyCrossOriginWhitelistEntry(bool add, CrossOriginWhiteListEntry entry); 132 ClearCrossOriginWhitelist(); 133}; 134