Provides an interface to a platform web view, if available.
CYIWebViewController is used to control a platform native web view.
For the web view to appear in the application, CYIWebView must be used. A CYIWebViewController is automatically constructed when a CYIWebView is created, and it can be retrieved using CYIWebView::GetWebViewController(). The web view controller can also be used without a visual representation.
This example shows how to retrieve the CYIWebViewController from a CYIWebView.
This is an example of using the webview without a visual representation for an authentication flow.
#include <platform/YiWebViewController.h>

Classes | |
| struct | Resource |
| Represents a resource that has been loaded. More... | |
Public Types | |
| enum | RESOURCE_TYPE { WEB_VIEW_HTTP_URL, WEB_VIEW_FILE_URL, WEB_VIEW_HTML_DOC } |
| Supported resource types. More... | |
Public Member Functions | |
| virtual | ~CYIWebViewController () |
| void | LoadUrl (const CYIUrl &url) |
| void | LoadFile (const CYIString &pathToDocument) |
| void | LoadHTML (const CYIString &htmlString) |
| virtual void | NavigateBack ()=0 |
| virtual void | NavigateForward ()=0 |
| virtual bool | CanNavigateBack ()=0 |
| virtual bool | CanNavigateForward ()=0 |
| virtual void | ClearCache ()=0 |
| const Resource & | GetLastLoadedResource () const |
| virtual void | Authenticate (const CYIString &username, const CYIString &password)=0 |
| virtual void | CancelAuthentication ()=0 |
| virtual void | SetOverpullEnabled (bool bEnabled)=0 |
| CYIPlatformViewProxy * | GetPlatformViewProxy () const |
Public Member Functions inherited from CYISignalHandler | |
| CYISignalHandler () | |
| CYISignalHandler (const CYISignalHandler &rSignalHandler) | |
| virtual | ~CYISignalHandler () |
| CYISignalHandler & | operator= (const CYISignalHandler &rSignalHandler) |
| void | MoveToThread (CYIThread *pThread) |
| This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More... | |
| CYIThreadHandle | GetThreadAffinity () const |
| void | SetThreadAffinity (const CYIThreadHandle &rThreadAffinity) |
| virtual bool | IsConnected () const |
| virtual bool | IsConnected (const CYISignalBase &rSignal) const |
| void | Disconnect (CYISignalBase &rSignal) |
| void | DisconnectFromAllSignals () |
Public Member Functions inherited from CYIThread::Listener | |
| Listener () | |
| virtual | ~Listener () |
| virtual void | OnThreadStarted (CYIThread *) |
| virtual void | OnThreadTerminated (CYIThread *) |
| virtual void | OnThreadFinished (CYIThread *) |
Static Public Member Functions | |
| static std::unique_ptr< CYIWebViewController > | CreateIfSupported () |
Public Attributes | |
| CYISignal< CYIString, CYIString > | AuthenticationRequired |
| CYISignal< Resource > | LoadingCancelled |
| CYISignal< Resource > | LoadingStarted |
| CYISignal< Resource > | LoadingFinished |
| CYISignal< Resource, CYIString > | LoadingErrorOccurred |
| CYISignal< Resource > | RedirectOccurred |
Protected Member Functions | |
| CYIWebViewController () | |
| void | NotifyLoadingStarted (const CYIString &webRequest) |
| void | NotifyLoadingFinished () |
| void | NotifyLoadingErrorOccurred (const CYIString &errorMessage) |
| void | NotifyAuthenticationRequired (const CYIString &realm, const CYIString &host) |
| void | NotifyLoadingCancelled () |
| virtual void | Load (const Resource &webViewResource)=0 |
|
virtual |
|
protected |
|
pure virtual |
Authenticates with username and password in response to an authentication request. Calling this function is only valid if there is an ongoing authentication request. It will have no effect otherwise.
Invalid credentials will result in AuthenticationRequired being emitted again.
|
pure virtual |
Cancels an ongoing authentication and releases resources being used for the authentication. Calling this function is only valid if there is an ongoing authentication request. It will have no effect otherwise.
|
pure virtual |
Indicates if it is possible to navigate back.
|
pure virtual |
Indicates if it is possible to navigate forward.
|
pure virtual |
Clears all cached data, including cookies. Affects all web view instances.
|
static |
Returns a new instance of CYIWebViewController, or nullptr if unsupported on the platform.
| const Resource& CYIWebViewController::GetLastLoadedResource | ( | ) | const |
Returns the last resource successfully loaded by this web view.
| CYIPlatformViewProxy* CYIWebViewController::GetPlatformViewProxy | ( | ) | const |
Returns the platform view proxy representation of the platform native web view.
From the returned CYIPlatfromViewProxy a CYIPlatformViewHandle may be obtained. This allows access to the platform native web view which this controller controls. This is useful for advanced configuration of the native web view such as enabling or disabling platform specific features of the web view.
|
protectedpure virtual |
Loads webViewResource.
| void CYIWebViewController::LoadFile | ( | const CYIString & | pathToDocument | ) |
Loads the local resource located at absolute path pathToDocument. The resource can be located in the assets directory, in which case the path can be constructed using CYIApp::GetAssetsPath. The resource may also be stored in the data or external directory, and the path can be constructed using CYIApp::GetDataPath or CYIApp::GetExternalPath, respectively.
| void CYIWebViewController::LoadHTML | ( | const CYIString & | htmlString | ) |
Loads htmlString as a document.
| void CYIWebViewController::LoadUrl | ( | const CYIUrl & | url | ) |
Loads the remote resource located at url.
|
pure virtual |
Navigates back in the web view history. Has no effect if it is not possible to navigate back.
|
pure virtual |
Navigates forward in the web view history. Has no effect if it is not possible to navigate forward.
|
protected |
Implementations must call this function when authentication is required.
|
protected |
Implementaitons must call this function when authentication request is cancelled.
|
protected |
Implementations must call this function when an error is encountered when loading.
|
protected |
Implementations must call this function when the web view has completed loading the resource.
|
protected |
Implementations must call this function when the web view begins loading the resource.
|
pure virtual |
Enables or disables a visual indication when the user scrolls beyond the bounds of the scrolling limits.
Emitted when the resource being loaded requires authentication to view. Users should respond to this signal by calling either Authenticate or CancelAuthentication.
The first signal parameter represents the host, and the second parameter represents the realm.
Emitted when an authentication request has been cancelled for the specified resource.
Emitted when the web view has encountered an error while loading the specified resource. The error message is provided as the second signal parameter.
Emitted when the web view has finished loading the specified resource.
Emitted when the web view begins loading the specified resource.
Emitted when the web view has encountered a redirect while loading the specified resource. The resource with the new path is provided as the signal parameter.