| // Copyright 2017 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module chrome.mojom; |
| |
| [EnableIfNot=is_android] |
| import "chrome/common/actor.mojom"; |
| import "components/lens/lens_metadata.mojom"; |
| import "mojo/public/mojom/base/string16.mojom"; |
| import "skia/public/mojom/bitmap.mojom"; |
| import "third_party/blink/public/mojom/window_features/window_features.mojom"; |
| import "ui/gfx/geometry/mojom/geometry.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| const int32 kDefaultQuality = 90; |
| |
| enum ImageFormat { |
| JPEG, |
| PNG, |
| WEBP, |
| // ORIGINAL means request basic image formats, JPG/PNG/GIF, if the original |
| // image format is not one of them, encode the image to JPG and return. |
| ORIGINAL, |
| }; |
| |
| // Messages sent from chrome to the render frame. |
| interface ChromeRenderFrame { |
| // Updates the window features of the main frame's render view. |
| SetWindowFeatures(blink.mojom.WindowFeatures window_features); |
| |
| // Reloads the image selected by the most recently opened context menu |
| // (if there indeed is an image at that location). |
| RequestReloadImageForContextNode(); |
| |
| // Requests the bitmap selected by the most recently opened context menu. |
| RequestBitmapForContextNode() => (skia.mojom.BitmapN32? bitmap); |
| |
| // Requests the bitmap and bounds of the image selected by the most recently |
| // opened context menu. Note that the bounds originate from the DOM layer, are |
| // in DIP and are relative to the local root's widget |
| // (see Element::BoundsInWidget()). No guarantee is made about their |
| // correlation with the bounds of the image as displayed in the presentation |
| // layer. The returned bounds are also not guaranteed to correspond to the |
| // result of returned image. |
| RequestBitmapForContextNodeWithBoundsHint() |
| => (skia.mojom.BitmapN32? bitmap, gfx.mojom.Rect bounds); |
| |
| // Requests the bounds of all images found in the DOM of the render frame. |
| // Note that the bounds originate from the DOM layer, use window coordinates |
| // which are device scale independent, and have been adjusted to include |
| // any transformations, including page scale. No guarantee is made about |
| // their correlation with the bounds of the image as displayed in the |
| // presentation layer. The returned bounds are also not guaranteed to |
| // correspond to the result of calling RequestBitmapForContextNode() on each |
| // image. |
| RequestBoundsHintForAllImages() => (array<gfx.mojom.Rect> all_bounds); |
| |
| // Requests an encoded image selected by the most recently opened context |
| // menu. The encoding format is specified as a parameter. If no image is |
| // selected or there's an error capturing the image, |image_data| will be |
| // empty. If the image area is larger than |image_min_area_pixels| it will be |
| // downscaled to fit within |image_max_size_pixels|. |
| // If |image_format| is ORIGINAL, return original image data except image |
| // larger than size specified as a parameter. In that case, returns a resized |
| // JPEG static image. |quality| is an integer between 0-100 where 100 |
| // is the highest quality. Higher encoding quality results in a better visual |
| // image, but takes longer to encode and yields a larger image. |
| // |quality| only affects lossy |image_formats| (aka JPEG/WebP). |
| RequestImageForContextNode(int32 image_min_area_pixels, |
| gfx.mojom.Size image_max_size_pixels, |
| ImageFormat image_format, |
| int32 quality) |
| => (array<uint8> image_data, |
| gfx.mojom.Size original_size, |
| gfx.mojom.Size downscaled_size, |
| string mime_type, |
| array<lens.mojom.LatencyLog> log_data); |
| |
| // For WebUI testing, this message requests JavaScript to be executed at a |
| // time which is late enough to not be thrown out, and early enough to be |
| // before onload events are fired. |
| ExecuteWebUIJavaScript(mojo_base.mojom.String16 javascript); |
| |
| // Sets a header identifying the CCT session. |
| [EnableIf=is_android] |
| SetCCTClientHeader(string header); |
| |
| // Requests the Media Feed Url from the renderer (if the page has one). |
| GetMediaFeedURL() => (url.mojom.Url? url); |
| |
| // Tells the render frame to load any blocked plugins matching the given |
| // identifier (empty string matches all). |
| LoadBlockedPlugins(string identifier); |
| |
| // Sets whether the frame needs to defer media loading when it is in |
| // background. |
| SetShouldDeferMediaLoad(bool should_defer); |
| |
| // Requests invoking of a tool from the actor automation framework. See |
| // chrome/browser/actor |
| [EnableIfNot=is_android] |
| InvokeTool(actor.mojom.ToolInvocation request) => |
| (actor.mojom.ActionResult result); |
| |
| // Requests actor automation framework journaling. Journaling can be |
| // stopped by disconnecting the passed in remote. We use an associated |
| // remote here to keep this consistent with navigation events. The |
| // journal will record the last committed URL in the logs. |
| [EnableIfNot=is_android] StartActorJournal( |
| pending_associated_remote<actor.mojom.JournalClient> client); |
| |
| // Creates page stability monitor in the renderer to monitor for page |
| // stability. Multiple calls will clobber a PageStabilityMonitor previously |
| // created and it's the caller's responsibility to ensure the monitor is |
| // unneeded before creating a new one. This interface may be disconnected |
| // when the browser-side `ObservationDelayController` that owns the remote is |
| // destroyed. This could happen when the tool invocation failed and therefore |
| // there's no need to wait. |
| // |
| // `task_id` identifies the ID of the active actor tool. |
| // `supports_paint_stability` indicates whether to include paint stability in |
| // page stability heuristics. |
| [EnableIfNot=is_android] |
| CreatePageStabilityMonitor( |
| pending_receiver<actor.mojom.PageStabilityMonitor> monitor, |
| actor.mojom.TaskId task_id, bool supports_paint_stability); |
| }; |