fidl_fuchsia_web

Struct FrameProxy

Source
pub struct FrameProxy { /* private fields */ }

Implementations§

Source§

impl FrameProxy

Source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.web/Frame.

Source

pub fn take_event_stream(&self) -> FrameEventStream

Get a Stream of events from the remote end of the protocol.

§Panics

Panics if the event stream was already taken.

Source

pub fn create_view(&self, view_token: ViewToken) -> Result<(), Error>

Creates a new view using the specified view_token. Caller should pass the other end of the token to [fuchsia.ui.gfx/ViewHolderArgs] to attach the new view to a view tree.

See the description of [CreateContextParams.service_directory] for additional services that must be present when using this method.

Source

pub fn create_view_with_view_ref( &self, view_token: ViewToken, view_ref_control: ViewRefControl, view_ref: ViewRef, ) -> Result<(), Error>

Creates a new view using the specified view_token. Caller should pass the other end of the token to [fuchsia.ui.gfx/ViewHolderArgs] to attach the new view to a view tree. view_ref can be cloned before passing it to this method, which will allow clients to track the view.

view_ref_control must not have the ZX_RIGHT_DUPLICATE set, or view creation will fail and view_token will be closed.

See the description of [CreateContextParams.service_directory] for additional services that must be present when using this method.

Source

pub fn create_view2(&self, args: CreateView2Args) -> Result<(), Error>

Creates a new Flatland view using the specified view_creation_token defined under args. Caller should pass the other end of the token to [fuchsia.ui.composition/Flatland.CreateViewport] to attach the new Flatland view to its graph.

Source

pub fn enable_headless_rendering(&self) -> Result<(), Error>

Enables headless rendering of the Frame.

This is used when content depends on layout and/or animation events firing normally. May only be used on a Context created with [ContextFeatureFlags.HEADLESS].

Source

pub fn disable_headless_rendering(&self) -> Result<(), Error>

Stops headless rendering of the Frame.

May only be used on a Context created with [ContextFeatureFlags.HEADLESS].

Source

pub fn get_media_player( &self, player: ServerEnd<PlayerMarker>, ) -> Result<(), Error>

Returns a [fuchsia.media.sessions2/Player] interface through which media (i.e. video/audio) playback in the frame may be observed, and/or controlled. Only one [fuchsia.media.sessions2/Player] may be active at a time, for each [Frame].

Source

pub fn get_navigation_controller( &self, controller: ServerEnd<NavigationControllerMarker>, ) -> Result<(), Error>

Returns an interface through which the [Frame] may be navigated to a desired URL, reloaded, etc.

  • controller: An asynchronous interface request for the [Frame]’s [NavigationController].
Source

pub fn execute_java_script( &self, origins: &[String], script: Buffer, ) -> QueryResponseFut<FrameExecuteJavaScriptResult, DefaultFuchsiaResourceDialect>

Executes a UTF-8 encoded script in the [Frame] if the [Frame]’s URL has an origin which matches entries in origins.

At least one origins entry must be specified. If a wildcard "*" is specified in origins, then the script will be evaluated unconditionally.

Returns the result of executing script, as a JSON-encoded string.

Note that scripts share the same execution context as the document, meaning that document may modify variables, classes, or objects set by the script in arbitrary or unpredictable ways.

If an error occurred, the FrameError will be set to one of these values:

  • BUFFER_NOT_UTF8: script is not UTF-8 encoded.
  • INVALID_ORIGIN: The [Frame]’s current URL does not match any of the values in origins or origins is an empty vector.
Source

pub fn execute_java_script_no_result( &self, origins: &[String], script: Buffer, ) -> QueryResponseFut<FrameExecuteJavaScriptNoResultResult, DefaultFuchsiaResourceDialect>

Variant of [Frame.ExecuteJavaScript] which executes the supplied script without returning a result.

Source

pub fn add_before_load_java_script( &self, id: u64, origins: &[String], script: Buffer, ) -> QueryResponseFut<FrameAddBeforeLoadJavaScriptResult, DefaultFuchsiaResourceDialect>

Executes a UTF-8 encoded script for every subsequent page load where the [Frame]’s URL has an origin reflected in origins. The script is executed early, prior to the execution of the document’s scripts.

Scripts are identified by a client-managed identifier id. Any script previously injected using the same id will be replaced.

The order in which multiple bindings are executed is the same as the order in which the bindings were added. If a script is added which clobbers an existing script of the same id, the previous script’s precedence in the injection order will be preserved.

At least one origins entry must be specified. If a wildcard "*" is specified in origins, then the script will be evaluated unconditionally.

If an error occurred, the FrameError will be set to one of these values:

  • BUFFER_NOT_UTF8: script is not UTF-8 encoded.
  • INVALID_ORIGIN: origins is an empty vector.
Source

pub fn remove_before_load_java_script(&self, id: u64) -> Result<(), Error>

Removes a previously added JavaScript snippet identified by id. This is a no-op if there is no JavaScript snippet identified by id.

Source

pub fn post_message( &self, target_origin: &str, message: WebMessage, ) -> QueryResponseFut<FramePostMessageResult, DefaultFuchsiaResourceDialect>

Posts a message to the frame’s onMessage handler.

target_origin restricts message delivery to the specified origin. If target_origin is "*", then the message will be sent to the document regardless of its origin. See the HTML spec section 9.4.3 for more details on how the target origin policy is applied.

If an error occurred, the FrameError will be set to one of these values:

  • INTERNAL_ERROR: The WebEngine failed to create a message pipe.
  • BUFFER_NOT_UTF8: The script in message’s data property is not UTF-8 encoded.
  • INVALID_ORIGIN: origins is an empty vector.
  • NO_DATA_IN_MESSAGE: The data property is missing in message.
Source

pub fn set_navigation_event_listener( &self, listener: Option<ClientEnd<NavigationEventListenerMarker>>, ) -> Result<(), Error>

Sets the listener for handling page navigation events.

  • listener: The observer to use. Unregisters any existing listener if null.
Source

pub fn set_navigation_event_listener2( &self, listener: Option<ClientEnd<NavigationEventListenerMarker>>, flags: NavigationEventListenerFlags, ) -> Result<(), Error>

Sets the listener for handling page navigation events. The listener will receive the current navigation state immediately. After that, it’s notified whenever the state changes.

  • listener: The observer to use. Unregisters any existing listener if null.
  • flags: Flags for optional features that should be enabled for the listener.
Source

pub fn set_java_script_log_level( &self, level: ConsoleLogLevel, ) -> Result<(), Error>

If set to a value other than [ConsoleLogLevel.NONE], allows web content to log messages to the [fuchsia.logger/LogSink] configured for this [Frame], via the console object (e.g. using debug(), log(), info(), warn() and error()). The default value is [ConsoleLogLevel.NONE].

As the system log may be persisted, it is recommended that [ConsoleLogLevel.NONE] be used in Incognito and other private browsing modes.

Log lines are written to the [fuchsia.logger/LogsSink] configured for this [fuchsia.web/Frame], with severities mapped as follows:

  • debug(), log() and info() are logged at [fuchsia.logger/LogLevelFilter.INFO] severity.
  • warn() is logged at [fuchsia.logger/LogLevelFilter.WARN] severity.
  • error() is logged at [fuchsia.logger/LogLevelFilter.ERROR] severity.
Source

pub fn set_console_log_sink( &self, sink: Option<ClientEnd<LogSinkMarker>>, ) -> Result<(), Error>

Specifies where to emit console log output to. By default log output will be routed to a [fuchsia.logger/LogSink] obtained via the [fuchsia.web/Context]’s service directory.

  • sink: The [fuchsia.logger/LogSink] to use to emit logs. Passing a null handle resets logging to use the default [fuchsia.logger/LogSink].
Source

pub fn configure_input_types( &self, types: InputTypes, allow: AllowInputState, ) -> Result<(), Error>

Enables or disables the processing of the specified types of user inputs. allow specifies whether to enable or disable the specified types. All input types are enabled by default.

Source

pub fn set_popup_frame_creation_listener( &self, listener: Option<ClientEnd<PopupFrameCreationListenerMarker>>, ) -> Result<(), Error>

Sets the listener for handling popup frame opened by web content. If no listener is present, then any new popup frame will be blocked.

  • listener: The listener to use. Unregisters any existing listener if null.
Source

pub fn set_url_request_rewrite_rules( &self, rules: &[UrlRequestRewriteRule], ) -> QueryResponseFut<(), DefaultFuchsiaResourceDialect>

Supplies a set of UrlRequestRewriteRule to apply on every subsequent URL request.

  • rules are cumulative and applied in order.
  • rules are only applied on the first URL request in a redirect chain.
  • rules will be validated before being applied. If rules are invalid, the [Frame] will be closed with ERR_INVALID_ARGS.
  • [Frame.SetUrlRequestRewriteRules] must not be called again until its acknowledgement callback has been processed. If this happens, the [Frame] will be closed with ERR_BAD_STATE.
Source

pub fn set_media_settings( &self, settings: &FrameMediaSettings, ) -> Result<(), Error>

Sets [fuchsia.media/FrameMediaSettings] for the frame. The specified parameters are applied to audio streams that started after this message is processed. Should be called before the Frame is navigated to content in order to ensure that the settings applied to all media streams. Due to request pipelining, this means doing so before calling [Frame.GetNavigationController()] and [NavigationController.LoadUrl()].

Source

pub fn force_content_dimensions( &self, web_dips: Option<&Vec2>, ) -> Result<(), Error>

Overrides the dimensions reported to web content. The devicePixelRatio reported to web content will be adjusted in response to changes in the pixel size of the View, rather than changing the size reported to the content. Call with null web_dips to remove any prior forced content dimensions.

Source

pub fn set_permission_state( &self, permission: &PermissionDescriptor, web_origin: &str, state: PermissionState, ) -> Result<(), Error>

Sets the permission state for the specified permission and web_origin. By default, all permissions are denied.

Source

pub fn set_block_media_loading(&self, blocked: bool) -> Result<(), Error>

Sets whether to block all HTMLMediaElements in the frame from fetching and loading media resources.

May be used, for example, to prevent loading media in frames that are not visible.

While media loading is blocked, elements with autoplay set to true will not start playback. The promises returned by calls to play() will remain unresolved until loading is unblocked by a call to this method.

When media loading is unblocked, elements will begin fetching, resource, loading, and playing as appropriate.

Any elements that have begun fetching or loading media resources for the current source before media loading was blocked will continue to fetch, load, and start playback as appropriate. This includes calls to play() even after media loading is blocked.

Source

pub fn get_private_memory_size( &self, ) -> QueryResponseFut<u64, DefaultFuchsiaResourceDialect>

Returns the amount of private (non-shared) physical memory used by the Frame’s main document. The returned size might not reflect the memory usage of embedded iframes.

Source

pub fn set_navigation_policy_provider( &self, params: &NavigationPolicyProviderParams, provider: ClientEnd<NavigationPolicyProviderMarker>, ) -> Result<(), Error>

Sets the navigation policy provider for the [Frame]. When set, the [Frame] sends [NavigationPolicyProvider.EvaluateRequestedNavigation] when processing navigation requests. params defines when the message is sent. After sending the EvaluateRequestedNavigation message, the [Frame] blocks the corresponding navigation until it receives a response.

Should be called before GetNavigationController to ensure that it is applied to all navigations including the first [NavigationController.LoadURL] request.

Source

pub fn set_content_area_settings( &self, settings: &ContentAreaSettings, ) -> Result<(), Error>

Sets various settings for how web content should be run in the Frame. May be called at any time, including after the URL has loaded. Each call changes only the specified fields, overwriting any prior value.

This method will fail with ZX_ERR_NOT_SUPPORTED if any value in ContentAreaSettings is not supported by the Frame.

Source

pub fn reset_content_area_settings(&self) -> Result<(), Error>

Reset the Frame’s ContentAreaSettings to default values.

Source

pub fn close(&self, payload: &FrameCloseRequest) -> Result<(), Error>

Request graceful or immediate teardown of the Frame content and notification of completion via Frame epitaph.

Graceful teardown allows unload and cleanup tasks in the implementation and web content (e.g., unload event handlers) to run for up to the specified period of time. Immediate teardown only runs the minimum cleanup tasks in the implementation and does not allow web content to run event handlers.

  • If timeout is zero, an immediate teardown is initiated. The channel will close with ZX_OK. This is equivalent to the caller closing the Frame channel.

  • If timeout is non-zero, a graceful teardown is initiated. The channel will close with ZX_OK if the Frame closes within the specified timeout and with ZX_ERR_TIMED_OUT otherwise.

  • If timeout is not specified, a reasonable implementation-specific timeout is applied.

Subsequent calls to Close() will override any previously specified Close() timeout.

Trait Implementations§

Source§

impl Clone for FrameProxy

Source§

fn clone(&self) -> FrameProxy

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FrameProxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FrameProxyInterface for FrameProxy

Source§

type ExecuteJavaScriptResponseFut = QueryResponseFut<Result<Buffer, FrameError>>

Source§

type ExecuteJavaScriptNoResultResponseFut = QueryResponseFut<Result<(), FrameError>>

Source§

type AddBeforeLoadJavaScriptResponseFut = QueryResponseFut<Result<(), FrameError>>

Source§

type PostMessageResponseFut = QueryResponseFut<Result<(), FrameError>>

Source§

type SetUrlRequestRewriteRulesResponseFut = QueryResponseFut<()>

Source§

type GetPrivateMemorySizeResponseFut = QueryResponseFut<u64>

Source§

fn create_view(&self, view_token: ViewToken) -> Result<(), Error>

Source§

fn create_view_with_view_ref( &self, view_token: ViewToken, view_ref_control: ViewRefControl, view_ref: ViewRef, ) -> Result<(), Error>

Source§

fn create_view2(&self, args: CreateView2Args) -> Result<(), Error>

Source§

fn enable_headless_rendering(&self) -> Result<(), Error>

Source§

fn disable_headless_rendering(&self) -> Result<(), Error>

Source§

fn get_media_player(&self, player: ServerEnd<PlayerMarker>) -> Result<(), Error>

Source§

fn get_navigation_controller( &self, controller: ServerEnd<NavigationControllerMarker>, ) -> Result<(), Error>

Source§

fn execute_java_script( &self, origins: &[String], script: Buffer, ) -> Self::ExecuteJavaScriptResponseFut

Source§

fn execute_java_script_no_result( &self, origins: &[String], script: Buffer, ) -> Self::ExecuteJavaScriptNoResultResponseFut

Source§

fn add_before_load_java_script( &self, id: u64, origins: &[String], script: Buffer, ) -> Self::AddBeforeLoadJavaScriptResponseFut

Source§

fn remove_before_load_java_script(&self, id: u64) -> Result<(), Error>

Source§

fn post_message( &self, target_origin: &str, message: WebMessage, ) -> Self::PostMessageResponseFut

Source§

fn set_navigation_event_listener( &self, listener: Option<ClientEnd<NavigationEventListenerMarker>>, ) -> Result<(), Error>

Source§

fn set_navigation_event_listener2( &self, listener: Option<ClientEnd<NavigationEventListenerMarker>>, flags: NavigationEventListenerFlags, ) -> Result<(), Error>

Source§

fn set_java_script_log_level(&self, level: ConsoleLogLevel) -> Result<(), Error>

Source§

fn set_console_log_sink( &self, sink: Option<ClientEnd<LogSinkMarker>>, ) -> Result<(), Error>

Source§

fn configure_input_types( &self, types: InputTypes, allow: AllowInputState, ) -> Result<(), Error>

Source§

fn set_popup_frame_creation_listener( &self, listener: Option<ClientEnd<PopupFrameCreationListenerMarker>>, ) -> Result<(), Error>

Source§

fn set_url_request_rewrite_rules( &self, rules: &[UrlRequestRewriteRule], ) -> Self::SetUrlRequestRewriteRulesResponseFut

Source§

fn set_media_settings(&self, settings: &FrameMediaSettings) -> Result<(), Error>

Source§

fn force_content_dimensions(&self, web_dips: Option<&Vec2>) -> Result<(), Error>

Source§

fn set_permission_state( &self, permission: &PermissionDescriptor, web_origin: &str, state: PermissionState, ) -> Result<(), Error>

Source§

fn set_block_media_loading(&self, blocked: bool) -> Result<(), Error>

Source§

fn get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut

Source§

fn set_navigation_policy_provider( &self, params: &NavigationPolicyProviderParams, provider: ClientEnd<NavigationPolicyProviderMarker>, ) -> Result<(), Error>

Source§

fn set_content_area_settings( &self, settings: &ContentAreaSettings, ) -> Result<(), Error>

Source§

fn reset_content_area_settings(&self) -> Result<(), Error>

Source§

fn close(&self, payload: &FrameCloseRequest) -> Result<(), Error>

Source§

impl Proxy for FrameProxy

Source§

type Protocol = FrameMarker

The protocol which this Proxy controls.
Source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
Source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
Source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, Handle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> ProxyHasClient for T
where T: Proxy,

§

fn client(&self) -> Result<ZirconClient, Infallible>

Get a “client” for this proxy. This is just an object which has methods for a few common handle creation operations.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more