blob: c6d8e3fd9415ca555f5f9ff3d8e6741d9638ea56 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module extensions.mojom;
import "extensions/common/mojom/action_type.mojom";
import "extensions/common/mojom/css_origin.mojom";
import "extensions/common/mojom/host_id.mojom";
import "extensions/common/mojom/run_location.mojom";
import "extensions/common/mojom/view_type.mojom";
import "mojo/public/mojom/base/values.mojom";
import "url/mojom/url.mojom";
// Allows an extension to execute code in a tab.
struct ExecuteCodeParams {
// The extension API request id, for responding.
int32 request_id;
// The ID of the requesting injection host.
HostID host_id;
// Whether the code is JavaScript or CSS.
ActionType action_type;
// String of code to execute.
string code;
// The webview guest source who calls to execute code.
url.mojom.Url webview_src;
// Whether to inject into about:blank (sub)frames.
bool match_about_blank;
// When to inject the code.
RunLocation run_at;
// Whether the request is coming from a <webview>.
bool is_web_view;
// Whether the caller is interested in the result value. Manifest-declared
// content scripts and executeScript() calls without a response callback
// are examples of when this will be false.
bool wants_result;
// The URL of the script that was injected, if any.
url.mojom.Url script_url;
// Whether the code to be executed should be associated with a user gesture.
bool user_gesture;
// The origin of the CSS.
CSSOrigin css_origin;
// The autogenerated key for the CSS injection.
string? injection_key;
};
// Implemented in the renderer, this interface defines the local frame specific
// methods.
interface LocalFrame {
// Sets the top-level frame to the provided name.
SetFrameName(string frame_name);
// Enables or disables spatial navigation.
SetSpatialNavigationEnabled(bool spatial_nav_enabled);
// Tells the render view what its tab ID is.
SetTabId(int32 tab_id);
// Notifies the renderer that its window has closed.
AppWindowClosed(bool send_onclosed);
// Tells the renderer which type this view is.
NotifyRenderViewType(ViewType view_type);
// Asks the renderer to invoke |function_name| with |args| in |module_name|.
// If |extension_id| is non-empty, the function will be invoked only in
// contexts owned by the extension. |args| is a list of primitive Value types
// that are passed to the function.
MessageInvoke(string extension_id,
string module_name,
string function_name,
mojo_base.mojom.ListValue args);
// Trigger to execute declarative content script under browser control.
ExecuteDeclarativeScript(int32 tab_id,
string extension_id,
string script_id,
url.mojom.Url url);
};