WebView
APIs for the WebView component. More...
Classes
Name | |
---|---|
struct | MLWebViewCursorState Struct to define the cursor's state. |
struct | MLWebViewEventCallbacks Event handler for MLWebView callbacks. |
struct | MLWebViewSettings Struct to define webview initialization. |
struct | MLWebViewProcessSettings Struct to define webview process initialization. |
Types
Name | |
---|---|
typedef struct MLWebViewCursorState | MLWebViewCursorState Struct to define the cursor's state. |
typedef struct MLWebViewEventCallbacks | MLWebViewEventCallbacks Event handler for MLWebView callbacks. |
typedef struct MLWebViewSettings | MLWebViewSettings Struct to define webview initialization. |
typedef struct MLWebViewProcessSettings | MLWebViewProcessSettings Struct to define webview process initialization. |
Enums
Functions
Name | |
---|---|
void | MLWebViewCursorStateInit(MLWebViewCursorState * inout_cursor_state) Initializes a MLWebViewCursorState with the default parameters. |
void | MLWebViewEventCallbacksInit(MLWebViewEventCallbacks * inout_callback) Initializes a MLWebViewEventCallbacks with the default parameters. |
void | MLWebViewSettingsInit(MLWebViewSettings * inout_settings) Initializes a MLWebViewSettings with the default parameters. |
void | MLWebViewProcessSettingsInit(MLWebViewProcessSettings * inout_settings) Initializes a MLWebViewProcessSettings with the default parameters. |
MLResult | MLWebViewSetProcessSettings(const MLWebViewProcessSettings * settings) Specify the process settings to be used for webviews. |
MLResult | MLWebViewCreate(MLHandle out_handle, const MLWebViewSettings in_settings) Create a MLWebView. |
MLResult | MLWebViewDestroy(MLHandle handle) Destroy a MLWebView. |
MLResult | MLWebViewSetEventCallbacks(MLHandle web_view, const MLWebViewEventCallbacks * callbacks) Specify the callbacks for a MLWebView. |
MLResult | MLWebViewAcquireNextAvailableFrame(MLHandle web_view, struct AHardwareBuffer ** out_native_buffer) Acquires next available frame buffer for rendering. |
MLResult | MLWebViewReleaseFrame(MLHandle web_view, struct AHardwareBuffer * native_buffer) Release a frame acquired by MLWebViewAcquireNextAvailableFrame. |
MLResult | MLWebViewGoTo(MLHandle web_view, const char * url) Go to a URL with the specified MLWebView. |
MLResult | MLWebViewGoBack(MLHandle web_view) Trigger a "Back" action in the MLWebView. |
MLResult | MLWebViewGoForward(MLHandle web_view) Trigger a "Forward" action in the MLWebView. |
MLResult | MLWebViewReload(MLHandle web_view) Trigger a "Reload" action in the MLWebView. |
MLResult | MLWebViewGetUrl(MLHandle web_view, uint32_t inout_size, char inout_url) Get the current URL. Set out_url to NULL to get the length of the current URL. |
MLResult | MLWebViewCanGoBack(MLHandle web_view, bool * out_can_go_back) Checks if the "Back" action is currently valid. |
MLResult | MLWebViewCanGoForward(MLHandle web_view, bool * out_can_go_forward) Checks if the "Forward" action is currently valid. |
MLResult | MLWebViewInjectMouseMove(MLHandle web_view, const MLWebViewCursorState * cursor_state) Moves the WebView mouse. |
MLResult | MLWebViewInjectMouseButtonDown(MLHandle web_view, const MLWebViewCursorState * cursor_state) Sends a mouse button down/pressed event on a specific location on screen. |
MLResult | MLWebViewInjectMouseButtonUp(MLHandle web_view, const MLWebViewCursorState * cursor_state) Sends a mouse button up/released event on a specific location on screen. |
MLResult | MLWebViewInjectChar(MLHandle web_view, uint32_t char_utf32) Sends a printable char keyboard event to MLWebView. |
MLResult | MLWebViewInjectKeyDown(MLHandle web_view, int32_t key_code, uint32_t modifier_mask) Sends a key down/pressed event to MLWebView. |
MLResult | MLWebViewInjectKeyUp(MLHandle web_view, int32_t key_code, uint32_t modifier_mask) Sends a key up/release event to MLWebView. |
MLResult | MLWebViewGetScrollSize(MLHandle web_view, int32_t out_width, int32_t out_height) This API is stubbed out and translates to a no-op. |
MLResult | MLWebViewGetScrollOffset(MLHandle web_view, int32_t out_x, int32_t out_y) This API is stubbed out and translates to a no-op. |
MLResult | MLWebViewScrollBy(MLHandle web_view, const int32_t x_pixels, const int32_t y_pixels) Triggers a mouse "Scroll" event. |
MLResult | MLWebViewGetZoomFactor(MLHandle web_view, double * out_zoom_factor) Get the current zoom factor. The default zoom factor is 1.0. |
MLResult | MLWebViewZoomIn(MLHandle web_view) Zoom in one level. |
MLResult | MLWebViewZoomOut(MLHandle web_view) Zoom out one level. |
MLResult | MLWebViewResetZoom(MLHandle web_view) Reset zoom level to 1.0. |
MLResult | MLWebViewGetFrameTransformMatrix(MLHandle web_view, MLMat4f * out_matrix) Retrieves the 4x4 texture coordinate transform matrix used by all MLWebView frames. |
MLResult | MLWebViewRemoveAllCookies(MLHandle web_view) Remove all webview cookies. |
MLResult | MLWebViewClearCache(MLHandle web_view) Clear the webview cache. |
MLResult | MLWebViewPause(MLHandle web_view, MLWebViewPauseType pause_type) Pause the webview. Call MLWebViewResume to resume. |
MLResult | MLWebViewResume(MLHandle web_view) Resumes a webview after a previous call of the MLWebViewPause. |
Detailed Description
APIs for the WebView component.
MLWebView methods use re-entrant JNI monitors to provide a thread-safe API. See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html#wp5256 for details.
Shared Object:
- webview.magicleap*
Enums Documentation
MLWebViewTextInputType
Enumerator | Value | Description |
---|---|---|
MLWebViewTextInputType_None | 0 | |
MLWebViewTextInputType_Text | ||
MLWebViewTextInputType_Password | ||
MLWebViewTextInputType_Search | ||
MLWebViewTextInputType_Email | ||
MLWebViewTextInputType_Number | ||
MLWebViewTextInputType_Telephone | ||
MLWebViewTextInputType_URL | ||
MLWebViewTextInputType_Date | ||
MLWebViewTextInputType_DateTime | ||
MLWebViewTextInputType_DateTimeLocal | ||
MLWebViewTextInputType_Month | ||
MLWebViewTextInputType_Time | ||
MLWebViewTextInputType_Week | ||
MLWebViewTextInputType_TextArea | ||
MLWebViewTextInputType_ContentEditable | ||
MLWebViewTextInputType_DateTimeField | ||
MLWebViewTextInputType_Ensure32Bits | 0x7FFFFFFF |
The type of text entry selected when on_show_keyboard is called.
API Level:
- 20
MLWebViewTextInputFlags
Enumerator | Value | Description |
---|---|---|
MLWebViewTextInputFlags_None | 0 | |
MLWebViewTextInputFlags_AutocompleteOn | 1 << 0 | |
MLWebViewTextInputFlags_AutocompleteOff | 1 << 1 | |
MLWebViewTextInputFlags_AutocorrectOn | 1 << 2 | |
MLWebViewTextInputFlags_AutocorrectOff | 1 << 3 | |
MLWebViewTextInputFlags_SpellcheckOn | 1 << 4 | |
MLWebViewTextInputFlags_SpellcheckOff | 1 << 5 | |
MLWebViewTextInputFlags_AutocapitalizeNone | 1 << 6 | |
MLWebViewTextInputFlags_AutocapitalizeCharacters | 1 << 7 | |
MLWebViewTextInputFlags_AutocapitalizeWords | 1 << 8 | |
MLWebViewTextInputFlags_AutocapitalizeSentences | 1 << 9 | |
MLWebViewTextInputFlags_HaveNextFocusableElement | 1 << 10 | |
MLWebViewTextInputFlags_HavePreviousFocusableElement | 1 << 11 | |
MLWebViewTextInputFlags_HasBeenPasswordField | 1 << 12 | |
MLWebViewTextInputFlags_Ensure32Bits | 0x7FFFFFFF |
Flags related to a text entry field passed when on_show_keyboard is called.
API Level:
- 20
MLWebViewEventFlags
Enumerator | Value | Description |
---|---|---|
MLWebViewEventFlags_None | 0 | |
MLWebViewEventFlags_CapsLockOn | 1 << 0 | |
MLWebViewEventFlags_ShiftDown | 1 << 1 | |
MLWebViewEventFlags_ControlDown | 1 << 2 | |
MLWebViewEventFlags_AltDown | 1 << 3 | |
MLWebViewEventFlags_LeftMouseButton | 1 << 4 | |
MLWebViewEventFlags_MiddleMouseButton | 1 << 5 | |
MLWebViewEventFlags_RightMouseButton | 1 << 6 | |
MLWebViewEventFlags_CommandDown | 1 << 7 | |
MLWebViewEventFlags_NumLockOn | 1 << 8 | |
MLWebViewEventFlags_IsKeyPad | 1 << 9 | |
MLWebViewEventFlags_IsLeft | 1 << 10 | |
MLWebViewEventFlags_IsRight | 1 << 11 | |
MLWebViewEventFlags_AltGRDown | 1 << 12 | |
MLWebViewEventFlags_Ensure32Bits | 0x7FFFFFFF |
Flags to set special key states during input.
API Level:
- 20
Anonymous Enum 31
Enumerator | Value | Description |
---|---|---|
MLResultAPIPrefix_WebView | ( 0xebf7 << 16) | Defines the prefix for MLWebViewResult codes. |
MLWebViewResult
Enumerator | Value | Description |
---|---|---|
MLWebViewResult_ZoomLimitReached | MLResultAPIPrefix_WebView | |
MLWebViewResult_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Return values for the WebView API calls.
API Level:
- 20
MLWebViewProcessSettingFlags
Enumerator | Value | Description |
---|---|---|
MLWebViewProcessSettingFlags_None | 0 | |
MLWebViewProcessSettingFlags_WebInspectorOn | 1 << 0 | The bit to enable (1) or disable (0) web inspector. |
MLWebViewProcessSettingFlags_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Flags set for the process using webview.
API Level:
- 22
MLWebViewPauseType
Enumerator | Value | Description |
---|---|---|
MLWebViewPauseType_Multimedia | 0 | Pause all multimedia activities of the webview. |
MLWebViewPauseType_Timers | Pause javascript timers of the webview. | |
MLWebViewPauseType_Discard | Pause and discard the webview rendering process. But keep alive the MLWebView handle. | |
MLWebViewPauseType_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
The type of the webview pause.
API Level:
- 22
Types Documentation
MLWebViewCursorState
typedef struct MLWebViewCursorState MLWebViewCursorState;
Struct to define the cursor's state.
This structure must be initialized by calling MLWebViewCursorStateInit before use.
API Level:
- 20
MLWebViewEventCallbacks
typedef struct MLWebViewEventCallbacks MLWebViewEventCallbacks;
Event handler for MLWebView callbacks.
This structure must be initialized by calling MLWebViewEventCallbacksInit before use.
API Level:
- 24
MLWebViewSettings
typedef struct MLWebViewSettings MLWebViewSettings;
Struct to define webview initialization.
This structure must be initialized by calling MLWebViewSettingsInit before use.
API Level:
- 24
MLWebViewProcessSettings
typedef struct MLWebViewProcessSettings MLWebViewProcessSettings;
Struct to define webview process initialization.
This structure must be initialized by calling MLWebViewProcessSettingsInit before use.
API Level:
- 22
Functions Documentation
MLWebViewCursorStateInit
static inline void MLWebViewCursorStateInit(
MLWebViewCursorState * inout_cursor_state
)
Initializes a MLWebViewCursorState with the default parameters.
Parameters
MLWebViewCursorState * | inout_cursor_state | The object to initialize with default values. |
Required Permissions:
- None
API Level:
- 20
MLWebViewEventCallbacksInit
static inline void MLWebViewEventCallbacksInit(
MLWebViewEventCallbacks * inout_callback
)
Initializes a MLWebViewEventCallbacks with the default parameters.
Parameters
MLWebViewEventCallbacks * | inout_callback | The object to initialize with default settings. |
Required Permissions:
- None
API Level:
- 24
MLWebViewSettingsInit
static inline void MLWebViewSettingsInit(
MLWebViewSettings * inout_settings
)
Initializes a MLWebViewSettings with the default parameters.
Parameters
MLWebViewSettings * | inout_settings | The object to initialize with default settings. |
Required Permissions:
- None
API Level:
- 20
MLWebViewProcessSettingsInit
static inline void MLWebViewProcessSettingsInit(
MLWebViewProcessSettings * inout_settings
)
Initializes a MLWebViewProcessSettings with the default parameters.
Parameters
MLWebViewProcessSettings * | inout_settings | The object to initialize with default settings. |
Required Permissions:
- None
API Level:
- 22
MLWebViewSetProcessSettings
MLResult MLWebViewSetProcessSettings(
const MLWebViewProcessSettings * settings
)
Specify the process settings to be used for webviews.
Parameters
const MLWebViewProcessSettings * | settings | The settings to be used for webviews. |
Returns
MLResult | MLResult_InvalidParam | If settings is null. |
MLResult | MLResult_NotImplemented | If called after MLWebViewCreate. |
MLResult | MLResult_Ok | If settings is not null. |
Required Permissions:
- None
Current implementation only supports enabling and disabling web inspector before first call to MLWebViewCreate. If all webviews have been destroyed, it is possible to call this with effect again. Default is to disable.
API Level:
- 22
MLWebViewCreate
MLResult MLWebViewCreate(
MLHandle * out_handle,
const MLWebViewSettings * in_settings
)
Create a MLWebView.
Parameters
MLHandle * | out_handle | Handle that is ready to use with all other MLWebView API calls. |
const MLWebViewSettings * | in_settings | The initialization paramaters for the webview. |
Returns
MLResult | MLResult_InvalidParam | out_handle, in_settings, or application_vm pointer was null. |
MLResult | MLResult_Ok | If version >= 2, returns MLResult_Ok for successful start of asynchronous operation, but any eventual failure will be reported through on_service_failed. If version < 2, this indicates that synchronous creation was successful. |
MLResult | MLResult_PermissionDenied | Missing required permission(s). |
MLResult | MLResult_UnspecifiedFailure | Unable to create the MLWebView, MLWebViewCallbacks struct version < 2. |
Required Permissions:
- com.magicleap.permission.WEBVIEW (protection level: normal)
The MLWebView will be ready to use once this function returns with MLResult_OK.
In version >= 2 for MLWebViewCallbacks struct, MLWebViewCreate launches a separate thread to create a webview. If creation fails and the on_service_failed callback is not null the MLResult code will be passed into the on_service_failed callback. The on_service_connected callback will be called if it is not null and creation was successful. For version < 2 of MLWebViewCallbacks struct, MLWebViewCallbacks will create in synchronous mode.
API Level:
- 24
MLWebViewDestroy
MLResult MLWebViewDestroy(
MLHandle handle
)
Destroy a MLWebView.
Parameters
MLHandle | handle | The handle to invalidate. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The MLWebView was destroyed successfully. |
MLResult | MLResult_UnspecifiedFailure | An error occurred destroying the MLWebView. |
Required Permissions:
- None
The MLWebView will be terminated by this function call and the handle shall no longer be valid.
API Level:
- 21
MLWebViewSetEventCallbacks
MLResult MLWebViewSetEventCallbacks(
MLHandle web_view,
const MLWebViewEventCallbacks * callbacks
)
Specify the callbacks for a MLWebView.
Parameters
MLHandle | web_view | The MLWebView to link the event handler. |
const MLWebViewEventCallbacks * | callbacks | The event handler to link to the MLWebView. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | MLWebView event handler was set. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 24
MLWebViewAcquireNextAvailableFrame
MLResult MLWebViewAcquireNextAvailableFrame(
MLHandle web_view,
struct AHardwareBuffer ** out_native_buffer
)
Acquires next available frame buffer for rendering.
Parameters
MLHandle | web_view | The webview being accessed. |
struct AHardwareBuffer ** | out_native_buffer | Pointer to an AHardwareBuffer. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The frame is ready. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
To use with OpenGL, EGL, and Vulkan please see: https://developer.android.com/ndk/reference/group/a-hardware-buffer for details.
API Level:
- 21
MLWebViewReleaseFrame
MLResult MLWebViewReleaseFrame(
MLHandle web_view,
struct AHardwareBuffer * native_buffer
)
Release a frame acquired by MLWebViewAcquireNextAvailableFrame.
Parameters
MLHandle | web_view | The webview being accessed. |
struct AHardwareBuffer * | native_buffer | The frame being released. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | Frame successfully released. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | An error occurred releasing the frame. |
Required Permissions:
- None
API Level:
- 21
MLWebViewGoTo
MLResult MLWebViewGoTo(
MLHandle web_view,
const char * url
)
Go to a URL with the specified MLWebView.
Parameters
MLHandle | web_view | The webview being accessed. |
const char * | url | The URL that will be loaded. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. MLWebViewResume should be called before this function. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The WebView is attempting to load the specified URL. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Note that success with this call only indicates that a load will be attempted. Caller can be notified about issues loading the URL via the event handler on_load_error.
API Level:
- 21
MLWebViewGoBack
MLResult MLWebViewGoBack(
MLHandle web_view
)
Trigger a "Back" action in the MLWebView.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_Ok | The WebView Back action was initiated or cannot go back any further. |
MLResult | MLResult_IllegalState | WebView was paused. MLWebViewResume should be called before this function. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Query MLWebViewCanGoBack before calling this method. If there is no valid page to go back to, this method will be no-op.
API Level:
- 21
MLWebViewGoForward
MLResult MLWebViewGoForward(
MLHandle web_view
)
Trigger a "Forward" action in the MLWebView.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. MLWebViewResume should be called before this function. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The WebView Forward action was initiated or cannot go forward any further. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Query MLWebViewCanGoForward before calling this method. If there is no valid page to go forward to, this method will be no-op.
API Level:
- 21
MLWebViewReload
MLResult MLWebViewReload(
MLHandle web_view
)
Trigger a "Reload" action in the MLWebView.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. MLWebViewResume should be called before this function. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The WebView Reload action was initiated. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewGetUrl
MLResult MLWebViewGetUrl(
MLHandle web_view,
uint32_t * inout_size,
char * inout_url
)
Get the current URL. Set out_url to NULL to get the length of the current URL.
Parameters
MLHandle | web_view | The webview being accessed. |
uint32_t * | inout_size | The size that has been allocated in out_url to hold the URL. This will be set to the actual length of URL if inout_size and size needed for the URL are different. |
char * | inout_url | The URL up to inout_size of characters. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The WebView URL was acquired. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewCanGoBack
MLResult MLWebViewCanGoBack(
MLHandle web_view,
bool * out_can_go_back
)
Checks if the "Back" action is currently valid.
Parameters
MLHandle | web_view | The webview being accessed. |
bool * | out_can_go_back | True if "Back" has a valid page to go to. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The status of going "Back" was acquired. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewCanGoForward
MLResult MLWebViewCanGoForward(
MLHandle web_view,
bool * out_can_go_forward
)
Checks if the "Forward" action is currently valid.
Parameters
MLHandle | web_view | The webview being accessed. |
bool * | out_can_go_forward | True if "Forward" has a valid page to go to. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The status of going "Forward" was acquired. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewInjectMouseMove
MLResult MLWebViewInjectMouseMove(
MLHandle web_view,
const MLWebViewCursorState * cursor_state
)
Moves the WebView mouse.
Parameters
MLHandle | web_view | The webview being accessed. |
const MLWebViewCursorState * | cursor_state | Information about the mouse movement. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The internal mouse was moved. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Please see MLWebViewInjectMouseButtonDown for behavior.
API Level:
- 21
MLWebViewInjectMouseButtonDown
MLResult MLWebViewInjectMouseButtonDown(
MLHandle web_view,
const MLWebViewCursorState * cursor_state
)
Sends a mouse button down/pressed event on a specific location on screen.
Parameters
MLHandle | web_view | The webview being accessed. |
const MLWebViewCursorState * | cursor_state | Information about the mouse button event. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | If successful. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Behavior: (1) Click behavior: On mouse down, (x, y) is saved and mouse down sent. When mouse up received within 200ms, mouse up sent to previous mouse down (x, y) position so Chromium interprets as click. (2) Drag behavior: On mouse down (x, y) is saved and mouse down sent. When mouse moves within timeout period of 200ms, webview will continue to wait. Otherwise, mouse move sent to current (x, y) location to let Chromium interpret as drag. (3) These click and drag behaviors make it possible to just send mouse events as they are received and the underlying Chromium implementation will work as expected.
MLWebViewInjectMouseButtonUp
MLResult MLWebViewInjectMouseButtonUp(
MLHandle web_view,
const MLWebViewCursorState * cursor_state
)
Sends a mouse button up/released event on a specific location on screen.
Parameters
MLHandle | web_view | The webview being accessed. |
const MLWebViewCursorState * | cursor_state | Information about the mouse button event. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | If successful. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
Please see MLWebViewInjectMouseButtonDown for behavior.
MLWebViewInjectChar
MLResult MLWebViewInjectChar(
MLHandle web_view,
uint32_t char_utf32
)
Sends a printable char keyboard event to MLWebView.
Parameters
MLHandle | web_view | Target webview. |
uint32_t | char_utf32 | Printable char utf code. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The key event was injected. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewInjectKeyDown
MLResult MLWebViewInjectKeyDown(
MLHandle web_view,
int32_t key_code,
uint32_t modifier_mask
)
Sends a key down/pressed event to MLWebView.
Parameters
MLHandle | web_view | Target webview. |
int32_t | key_code | Key code. |
uint32_t | modifier_mask | Should be one or combination of MLWebViewEventFlags. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The key event was injected. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewInjectKeyUp
MLResult MLWebViewInjectKeyUp(
MLHandle web_view,
int32_t key_code,
uint32_t modifier_mask
)
Sends a key up/release event to MLWebView.
Parameters
MLHandle | web_view | Target webview. |
int32_t | key_code | Key code. |
uint32_t | modifier_mask | Should be one or combination of MLWebViewEventFlags. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The key event was injected. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewGetScrollSize
MLResult MLWebViewGetScrollSize(
MLHandle web_view,
int32_t * out_width,
int32_t * out_height
)
This API is stubbed out and translates to a no-op.
Parameters
MLHandle | web_view | The webview being accessed. |
int32_t * | out_width | The number representing the entire width of the webview, in pixels. |
int32_t * | out_height | The number representing the entire height of the webview, in pixels. |
Returns
MLResult | MLResult_NotImplemented | This API is stubbed out and translates to a no-op. |
Required Permissions:
- None
Deprecated since 1.2.0. Scheduled for removal.
API Level:
- 21
MLWebViewGetScrollOffset
MLResult MLWebViewGetScrollOffset(
MLHandle web_view,
int32_t * out_x,
int32_t * out_y
)
This API is stubbed out and translates to a no-op.
Parameters
MLHandle | web_view | The webview being accessed. |
int32_t * | out_x | The number representing the horizontal offset of the webview, in pixels. |
int32_t * | out_y | The number representing the vertical offset of the webview, in pixels. |
Returns
MLResult | MLResult_NotImplemented | This API is stubbed out and translates to a no-op. |
Required Permissions:
- None
Deprecated since 1.2.0. Scheduled for removal.
API Level:
- 21
MLWebViewScrollBy
MLResult MLWebViewScrollBy(
MLHandle web_view,
const int32_t x_pixels,
const int32_t y_pixels
)
Triggers a mouse "Scroll" event.
Parameters
MLHandle | web_view | The webview being accessed. |
const int32_t | x_pixels | The number of pixels to scroll on the x axis. |
const int32_t | y_pixels | The number of pixels to scroll on the y axis. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The MLWebView was scrolled. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
API Level:
- 21
MLWebViewGetZoomFactor
MLResult MLWebViewGetZoomFactor(
MLHandle web_view,
double * out_zoom_factor
)
Get the current zoom factor. The default zoom factor is 1.0.
Parameters
MLHandle | web_view | The webview being accessed. |
double * | out_zoom_factor | Current numeric value for zoom factor. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The out_zoom_factor parameter was updated with the current zoom value. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Failed to get the zoom factor due to an internal error. |
Required Permissions:
- None
API Level:
- 21
MLWebViewZoomIn
MLResult MLWebViewZoomIn(
MLHandle web_view
)
Zoom in one level.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The MLWebView zoomed in. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Failed to zoom in due to an internal error. |
MLResult | MLWebViewResult_ZoomLimitReached | if cannot zoom in any further. |
Required Permissions:
- None
API Level:
- 21
MLWebViewZoomOut
MLResult MLWebViewZoomOut(
MLHandle web_view
)
Zoom out one level.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The MLWebView zoomed out. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Failed to zoom out due to an internal error. |
MLResult | MLWebViewResult_ZoomLimitReached | if cannot zoom out any further. |
Required Permissions:
- None
API Level:
- 21
MLWebViewResetZoom
MLResult MLWebViewResetZoom(
MLHandle web_view
)
Reset zoom level to 1.0.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | The MLWebView zoom was reset. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Failed to reset zoom due to an internal error. |
Required Permissions:
- None
API Level:
- 21
MLWebViewGetFrameTransformMatrix
MLResult MLWebViewGetFrameTransformMatrix(
MLHandle web_view,
MLMat4f * out_matrix
)
Retrieves the 4x4 texture coordinate transform matrix used by all MLWebView frames.
Parameters
MLHandle | web_view | The webview being accessed. |
MLMat4f * | out_matrix | The retrieved matrix. |
Returns
MLResult | MLResult_Ok | The constant matrix was retrieved. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
Required Permissions:
- None
This transform matrix maps 2D homogeneous texture coordinates of the form (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture coordinate that should be used to sample that location from the texture. Sampling the texture outside of the range of this transform is undefined.
The matrix is stored in column-major order so that it may be passed directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv functions.
API Level:
- 21
MLWebViewRemoveAllCookies
MLResult MLWebViewRemoveAllCookies(
MLHandle web_view
)
Remove all webview cookies.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | If all cookies removed successfully. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Removing all cookies failed due to an internal error. |
Required Permissions:
- None
API Level:
- 21
MLWebViewClearCache
MLResult MLWebViewClearCache(
MLHandle web_view
)
Clear the webview cache.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_IllegalState | WebView was paused. See MLWebViewPause. |
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | If cache cleared successfully. |
MLResult | MLResult_Pending | If the MLWebView handle is not ready to use if asynchronous creation was used, MLWebViewCallbacks struct version >= 2. |
MLResult | MLResult_UnspecifiedFailure | Clearing cache failed due to an internal error. |
Required Permissions:
- None
API Level:
- 21
MLWebViewPause
MLResult MLWebViewPause(
MLHandle web_view,
MLWebViewPauseType pause_type
)
Pause the webview. Call MLWebViewResume to resume.
Parameters
MLHandle | web_view | The webview being accessed. |
MLWebViewPauseType | pause_type | The webview pause type MLWebViewPauseType. MLWebViewPauseType_Multimedia Is a simple pause for all multimedia of the webview. MLWebViewPauseType_Timers Intended to stop animation of the webview content. MLWebViewPauseType_Discard Uses to free the webview rendering process but keep alive the MLWebView handle. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle or invalid MLWebViewPauseType value. |
MLResult | MLResult_Ok | If paused successfully. |
MLResult | MLResult_Pending | MLWebView handle is not ready to use. See an asynchronous mode of the MLWebViewCreate. |
MLResult | MLResult_UnspecifiedFailure | Pause failed due to an internal error. |
This method provides a multiple pause types to the webview.
API Level:
- 22
MLWebViewResume
MLResult MLWebViewResume(
MLHandle web_view
)
Resumes a webview after a previous call of the MLWebViewPause.
Parameters
MLHandle | web_view | The webview being accessed. |
Returns
MLResult | MLResult_InvalidParam | Unable to find the specified MLWebView handle. |
MLResult | MLResult_Ok | If resumed successfully. |
MLResult | MLResult_Pending | MLWebView handle is not ready to use. See an asynchronous mode of the MLWebViewCreate. |
MLResult | MLResult_UnspecifiedFailure | Resume failed due to an internal error. |
Resume webview to the normal operation for all webview pause types.
API Level:
- 22