// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
namespace UnityEngine.XR.MagicLeap
{
using System;
///
/// MLWebView class exposes static functions that allows an application to instantiate a hardware
/// accelerated WebView and interact with it(via "mouse" and "keyboard" events).
///
public partial class MLWebView
{
///
/// The delegate for the before reasource loaded event.
///
/// The MLWebView associated with this callback.
/// The url of the resource about to be loaded.
public delegate void OnBeforeResourceLoadDelegate(MLWebView webView, string resourceURL);
///
/// The delegate for the reasource loaded event.
///
/// The MLWebView associated with this callback.
/// Whether this event was for the main frame.
/// The standard http status code.
public delegate void OnLoadEndDelegate(MLWebView webView, bool isMainFrame, int httpStatusCode);
///
/// The delegate for the reasource load error event.
///
/// The MLWebView associated with this callback.
/// True if this event was for the main frame.
/// Http status code for the URL load failure.
/// The stringified version of the error code.
/// The url that caused the load error.
public delegate void OnLoadErrorDelegate(MLWebView webView, bool isMainFrame, int httpStatusCode, string errorStr, string failedUrl);
///
/// The delegate for the certificate error event.
///
/// The MLWebView associated with this callback.
/// Error code for ssl error.
/// The url associated to the certificate error.
/// Certificate error short description.
/// Certificate error details.
public delegate void OnCertificateErrorDelegate(MLWebView webView, int errorCode, string url, string errorMessage, string details, bool certificateErrorIgnored);
///
/// The delegate for the keyboard show event.
///
/// The MLWebView associated with this callback.
/// Data about the clicked input field.
public delegate void OnShowKeyboardDelegate(MLWebView webView, InputFieldData keyboardShowData);
///
/// The delegate for the keyboard dismiss event.
///
/// The MLWebView associated with this callback.
public delegate void OnKeyboardDismissDelegate(MLWebView webView);
///
/// The delegate for the webview destroy event.
///
/// The MLWebView associated with this callback.
public delegate void OnDestroyDelegate(MLWebView webView);
///
/// The delegate for the webview service connected event.
///
/// The MLWebView associated with this callback.
public delegate void OnServiceConnectedDelegate(MLWebView webView);
///
/// The delegate for the webview service disconnected event.
///
/// The MLWebView associated with this callback.
public delegate void OnServiceDisconnectedDelegate(MLWebView webView);
///
/// The delegate for the webview service failed event.
///
/// The MLWebView associated with this callback.
/// The MLResult code associated with the failure.
public delegate void OnServiceFailedDelegate(MLWebView webView, MLResult result);
///
/// The delegate for the webview before popup event.
///
/// The MLWebView associated with this callback.
/// The URL for the popup to load.
public delegate void OnBeforePopupDelegate(MLWebView webView, string url, bool popupAccepted);
///
/// The delegate for the webview popup opened event.
///
/// The MLWebView associated with this callback.
/// The ID of the popup.
/// The URL associated with the popup.
public delegate void OnPopupOpenedDelegate(MLWebView webView, ulong popupID, string url);
///
/// The delegate fpr the webview popup closed event.
///
/// The MLWebView associated with this callback.
/// The webview handle of the popup being closed.
public delegate void OnPopupClosedDelegate(MLWebView webView, ulong handle);
///
/// Event raised just before resources are loaded.
///
public event OnBeforeResourceLoadDelegate OnBeforeResourceLoaded = delegate { };
///
/// Event raised when resources finish loading.
///
public event OnLoadEndDelegate OnLoadEnded = delegate { };
///
/// Event raised when there was an error during loading.
///
public event OnLoadErrorDelegate OnErrorLoaded = delegate { };
///
/// Event raised when there was an error during certification loading.
///
public event OnCertificateErrorDelegate OnCertificateErrorLoaded = delegate { };
///
/// Event raised if user clicked inputfield and keyboard should be displayed.
///
public event OnShowKeyboardDelegate OnKeyboardShown = delegate { };
///
/// Event rasied if Keyboard should be dismissed.
///
public event OnKeyboardDismissDelegate OnKeyboardDismissed = delegate { };
///
/// Event raised when WebView is destroyed.
///
public event OnDestroyDelegate OnWebViewDestroyed = delegate { };
///
/// Event raised when WebView service is connected.
///
public event OnServiceConnectedDelegate OnServiceConnected = delegate { };
///
/// Event raised when WebView service is disconnected.
///
public event OnServiceDisconnectedDelegate OnServiceDisconnected = delegate { };
///
/// Event raised when WebView service fails to connect.
///
public event OnServiceFailedDelegate OnServiceFailed = delegate { };
///
/// Event raised when WebView checks if a URL is OK to load in a popup.
///
public event OnBeforePopupDelegate OnBeforePopup = delegate { };
///
/// Event raised when WebView opened a popup.
///
public event OnPopupOpenedDelegate OnPopupOpened = delegate { };
///
/// Event raised when Webview is closing a popup.
///
public event OnPopupClosedDelegate OnPopupClosed = delegate { };
}
}