/*
* Copyright (c) 2023 ETH Zürich, Educational Development and Technology (LET)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.UserInterface.Contracts.Browser.Data;
using SafeExamBrowser.UserInterface.Contracts.Browser.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Browser
{
///
/// Defines the functionality of a browser control (i.e. an instance of the browser resp. its user interface) and is normally embedded
/// within an .
///
public interface IBrowserControl
{
///
/// The address which is currently loaded.
///
string Address { get; }
///
/// Indicates whether a backward navigation can be performed.
///
bool CanNavigateBackwards { get; }
///
/// Indicates whether a forward navigation can be performed.
///
bool CanNavigateForwards { get; }
///
/// The user interface control to be embedded in an .
///
object EmbeddableControl { get; }
///
/// Event fired when the address of the browser control changes.
///
event AddressChangedEventHandler AddressChanged;
///
/// Event fired when a load error occurs.
///
event LoadFailedEventHandler LoadFailed;
///
/// Event fired when the loading state of the browser control changes.
///
event LoadingStateChangedEventHandler LoadingStateChanged;
///
/// Event fired when the current page (and thus the title) of the browser control changes.
///
event TitleChangedEventHandler TitleChanged;
///
/// Finalizes the browser control (e.g. stops audio / video playback) and releases all used resources.
///
void Destroy();
///
/// Executes the given JavaScript code in the browser.
///
void ExecuteJavascript(string code, Action callback);
///
/// Attempts to find the given term on the current page according to the specified parameters.
///
void Find(string term, bool isInitial, bool caseSensitive, bool forward = true);
///
/// Initializes the browser control.
///
void Initialize();
///
/// Navigates to the previous page in the browser control history.
///
void NavigateBackwards();
///
/// Navigates to the next page in the browser control history.
///
void NavigateForwards();
///
/// Navigates to the specified web address.
///
void NavigateTo(string address);
///
/// Opens the developer console or actives it, if it is already open.
///
void ShowDeveloperConsole();
///
/// Reloads the current web page.
///
void Reload();
///
/// Sets the page zoom to the given level. A value of 0 resets the page zoom.
///
void Zoom(double level);
}
}