Cleaned and restructured browser settings namespace.

This commit is contained in:
dbuechel 2019-12-18 08:24:55 +01:00
parent 5b3a2a3861
commit 42eccef565
32 changed files with 140 additions and 132 deletions

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters namespace SafeExamBrowser.Browser.Contracts.Filters
{ {

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters namespace SafeExamBrowser.Browser.Contracts.Filters
{ {

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Contracts.Filters namespace SafeExamBrowser.Browser.Contracts.Filters
{ {

View file

@ -11,7 +11,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq; using Moq;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Browser.Filters; using SafeExamBrowser.Browser.Filters;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.UnitTests.Filters namespace SafeExamBrowser.Browser.UnitTests.Filters
{ {

View file

@ -10,7 +10,7 @@ using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using SafeExamBrowser.Browser.Filters; using SafeExamBrowser.Browser.Filters;
using SafeExamBrowser.Browser.Filters.Rules; using SafeExamBrowser.Browser.Filters.Rules;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.UnitTests.Filters namespace SafeExamBrowser.Browser.UnitTests.Filters
{ {

View file

@ -11,7 +11,7 @@ using System.Text.RegularExpressions;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Browser.Filters.Rules; using SafeExamBrowser.Browser.Filters.Rules;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules
{ {

View file

@ -11,7 +11,7 @@ using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Browser.Filters.Rules; using SafeExamBrowser.Browser.Filters.Rules;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules
{ {

View file

@ -21,6 +21,7 @@ using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Browser.Proxy;
using SafeExamBrowser.Settings.Logging; using SafeExamBrowser.Settings.Logging;
using SafeExamBrowser.UserInterface.Contracts; using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.MessageBox;

View file

@ -21,6 +21,7 @@ using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Browser.Filter;
using SafeExamBrowser.UserInterface.Contracts; using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Browser; using SafeExamBrowser.UserInterface.Contracts.Browser;
using SafeExamBrowser.UserInterface.Contracts.MessageBox; using SafeExamBrowser.UserInterface.Contracts.MessageBox;
@ -44,7 +45,7 @@ namespace SafeExamBrowser.Browser
private string url; private string url;
private double zoomLevel; private double zoomLevel;
private BrowserWindowSettings WindowSettings private WindowSettings WindowSettings
{ {
get { return isMainInstance ? settings.MainWindow : settings.AdditionalWindow; } get { return isMainInstance ? settings.MainWindow : settings.AdditionalWindow; }
} }

View file

@ -9,7 +9,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Filters namespace SafeExamBrowser.Browser.Filters
{ {

View file

@ -9,7 +9,7 @@
using System; using System;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Browser.Filters.Rules; using SafeExamBrowser.Browser.Filters.Rules;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Filters namespace SafeExamBrowser.Browser.Filters
{ {

View file

@ -9,7 +9,7 @@
using System; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Filters.Rules namespace SafeExamBrowser.Browser.Filters.Rules
{ {

View file

@ -9,7 +9,7 @@
using System; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using SafeExamBrowser.Browser.Contracts.Filters; using SafeExamBrowser.Browser.Contracts.Filters;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Filters.Rules namespace SafeExamBrowser.Browser.Filters.Rules
{ {

View file

@ -13,7 +13,7 @@ using SafeExamBrowser.Browser.Events;
using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter;
using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings; using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings;
namespace SafeExamBrowser.Browser.Handlers namespace SafeExamBrowser.Browser.Handlers

View file

@ -17,20 +17,21 @@ using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.Logging.Contracts; using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Browser.Handlers namespace SafeExamBrowser.Browser.Handlers
{ {
internal class ResourceHandler : CefSharp.Handler.ResourceRequestHandler internal class ResourceHandler : CefSharp.Handler.ResourceRequestHandler
{ {
private AppConfig appConfig; private AppConfig appConfig;
private BrowserFilterSettings settings; private FilterSettings settings;
private ILogger logger; private ILogger logger;
private IRequestFilter filter; private IRequestFilter filter;
private IResourceHandler contentHandler; private IResourceHandler contentHandler;
private IResourceHandler pageHandler; private IResourceHandler pageHandler;
private IText text; private IText text;
internal ResourceHandler(AppConfig appConfig, BrowserFilterSettings settings, IRequestFilter filter, ILogger logger, IText text) internal ResourceHandler(AppConfig appConfig, FilterSettings settings, IRequestFilter filter, ILogger logger, IText text)
{ {
this.appConfig = appConfig; this.appConfig = appConfig;
this.filter = filter; this.filter = filter;

View file

@ -9,6 +9,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using SafeExamBrowser.Settings; using SafeExamBrowser.Settings;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Browser.Filter;
using SafeExamBrowser.Settings.Browser.Proxy;
using SafeExamBrowser.Settings.UserInterface; using SafeExamBrowser.Settings.UserInterface;
namespace SafeExamBrowser.Configuration.ConfigurationData namespace SafeExamBrowser.Configuration.ConfigurationData
@ -272,7 +274,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private void MapFtpProxy(AppSettings settings, IDictionary<string, object> data) private void MapFtpProxy(AppSettings settings, IDictionary<string, object> data)
{ {
var proxy = new ProxySettings { Protocol = ProxyProtocol.Ftp }; var proxy = new ProxyConfiguration { Protocol = ProxyProtocol.Ftp };
if (data.TryGetValue(Keys.Browser.Proxy.Ftp.Host, out var v) && v is string host) if (data.TryGetValue(Keys.Browser.Proxy.Ftp.Host, out var v) && v is string host)
{ {
@ -304,7 +306,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private void MapHttpProxy(AppSettings settings, IDictionary<string, object> data) private void MapHttpProxy(AppSettings settings, IDictionary<string, object> data)
{ {
var proxy = new ProxySettings { Protocol = ProxyProtocol.Http }; var proxy = new ProxyConfiguration { Protocol = ProxyProtocol.Http };
if (data.TryGetValue(Keys.Browser.Proxy.Http.Host, out var v) && v is string host) if (data.TryGetValue(Keys.Browser.Proxy.Http.Host, out var v) && v is string host)
{ {
@ -336,7 +338,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private void MapHttpsProxy(AppSettings settings, IDictionary<string, object> data) private void MapHttpsProxy(AppSettings settings, IDictionary<string, object> data)
{ {
var proxy = new ProxySettings { Protocol = ProxyProtocol.Https }; var proxy = new ProxyConfiguration { Protocol = ProxyProtocol.Https };
if (data.TryGetValue(Keys.Browser.Proxy.Https.Host, out var v) && v is string host) if (data.TryGetValue(Keys.Browser.Proxy.Https.Host, out var v) && v is string host)
{ {
@ -368,7 +370,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
private void MapSocksProxy(AppSettings settings, IDictionary<string, object> data) private void MapSocksProxy(AppSettings settings, IDictionary<string, object> data)
{ {
var proxy = new ProxySettings { Protocol = ProxyProtocol.Socks }; var proxy = new ProxyConfiguration { Protocol = ProxyProtocol.Socks };
if (data.TryGetValue(Keys.Browser.Proxy.Socks.Host, out var v) && v is string host) if (data.TryGetValue(Keys.Browser.Proxy.Socks.Host, out var v) && v is string host)
{ {
@ -458,13 +460,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
switch (position) switch (position)
{ {
case LEFT: case LEFT:
settings.Browser.AdditionalWindow.Position = BrowserWindowPosition.Left; settings.Browser.AdditionalWindow.Position = WindowPosition.Left;
break; break;
case CENTER: case CENTER:
settings.Browser.AdditionalWindow.Position = BrowserWindowPosition.Center; settings.Browser.AdditionalWindow.Position = WindowPosition.Center;
break; break;
case RIGHT: case RIGHT:
settings.Browser.AdditionalWindow.Position = BrowserWindowPosition.Right; settings.Browser.AdditionalWindow.Position = WindowPosition.Right;
break; break;
} }
} }
@ -481,13 +483,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
switch (position) switch (position)
{ {
case LEFT: case LEFT:
settings.Browser.MainWindow.Position = BrowserWindowPosition.Left; settings.Browser.MainWindow.Position = WindowPosition.Left;
break; break;
case CENTER: case CENTER:
settings.Browser.MainWindow.Position = BrowserWindowPosition.Center; settings.Browser.MainWindow.Position = WindowPosition.Center;
break; break;
case RIGHT: case RIGHT:
settings.Browser.MainWindow.Position = BrowserWindowPosition.Right; settings.Browser.MainWindow.Position = WindowPosition.Right;
break; break;
} }
} }

View file

@ -11,6 +11,7 @@ using System.IO;
using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Settings; using SafeExamBrowser.Settings;
using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Browser.Proxy;
using SafeExamBrowser.Settings.Logging; using SafeExamBrowser.Settings.Logging;
using SafeExamBrowser.Settings.Service; using SafeExamBrowser.Settings.Service;
using SafeExamBrowser.Settings.UserInterface; using SafeExamBrowser.Settings.UserInterface;
@ -116,7 +117,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
settings.Browser.AdditionalWindow.AllowForwardNavigation = true; settings.Browser.AdditionalWindow.AllowForwardNavigation = true;
settings.Browser.AdditionalWindow.AllowReloading = true; settings.Browser.AdditionalWindow.AllowReloading = true;
settings.Browser.AdditionalWindow.FullScreenMode = false; settings.Browser.AdditionalWindow.FullScreenMode = false;
settings.Browser.AdditionalWindow.Position = BrowserWindowPosition.Right; settings.Browser.AdditionalWindow.Position = WindowPosition.Right;
settings.Browser.AdditionalWindow.RelativeHeight = 100; settings.Browser.AdditionalWindow.RelativeHeight = 100;
settings.Browser.AdditionalWindow.RelativeWidth = 50; settings.Browser.AdditionalWindow.RelativeWidth = 50;
settings.Browser.AdditionalWindow.ShowReloadWarning = false; settings.Browser.AdditionalWindow.ShowReloadWarning = false;

View file

@ -1,56 +0,0 @@
/*
* Copyright (c) 2019 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 System.Collections.Generic;
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines the proxy settings for the browser engine.
/// </summary>
[Serializable]
public class BrowserProxySettings
{
/// <summary>
/// Determines whether proxy auto-configuration should be used. Requires a valid URL defined in <see cref="AutoConfigureUrl"/>.
/// </summary>
public bool AutoConfigure { get; set; }
/// <summary>
/// A valid URL to a proxy auto-configuration file (.pac). Is only evaluated if <see cref="AutoConfigure"/> is enabled.
/// </summary>
public string AutoConfigureUrl { get; set; }
/// <summary>
/// Forces proxy auto-detection by the browser engine.
/// </summary>
public bool AutoDetect { get; set; }
/// <summary>
/// A list of hosts for which all proxy settings should be bypassed.
/// </summary>
public IList<string> BypassList { get; set; }
/// <summary>
/// The proxy policy to be used.
/// </summary>
public ProxyPolicy Policy { get; set; }
/// <summary>
/// Defines all proxies to be used.
/// </summary>
public IList<ProxySettings> Proxies { get; set; }
public BrowserProxySettings()
{
BypassList = new List<string>();
Proxies = new List<ProxySettings>();
}
}
}

View file

@ -19,7 +19,7 @@ namespace SafeExamBrowser.Settings.Browser
/// <summary> /// <summary>
/// The settings to be used for additional browser windows. /// The settings to be used for additional browser windows.
/// </summary> /// </summary>
public BrowserWindowSettings AdditionalWindow { get; set; } public WindowSettings AdditionalWindow { get; set; }
/// <summary> /// <summary>
/// Determines whether the user will be allowed to download configuration files. /// Determines whether the user will be allowed to download configuration files.
@ -44,12 +44,12 @@ namespace SafeExamBrowser.Settings.Browser
/// <summary> /// <summary>
/// The settings to be used for the browser request filter. /// The settings to be used for the browser request filter.
/// </summary> /// </summary>
public BrowserFilterSettings Filter { get; set; } public FilterSettings Filter { get; set; }
/// <summary> /// <summary>
/// The settings to be used for the main browser window. /// The settings to be used for the main browser window.
/// </summary> /// </summary>
public BrowserWindowSettings MainWindow { get; set; } public WindowSettings MainWindow { get; set; }
/// <summary> /// <summary>
/// Determines how attempts to open a popup are handled. /// Determines how attempts to open a popup are handled.
@ -59,7 +59,7 @@ namespace SafeExamBrowser.Settings.Browser
/// <summary> /// <summary>
/// Determines the proxy settings to be used by the browser. /// Determines the proxy settings to be used by the browser.
/// </summary> /// </summary>
public BrowserProxySettings Proxy { get; set; } public ProxySettings Proxy { get; set; }
/// <summary> /// <summary>
/// The URL with which the main browser window will be loaded. /// The URL with which the main browser window will be loaded.
@ -73,10 +73,10 @@ namespace SafeExamBrowser.Settings.Browser
public BrowserSettings() public BrowserSettings()
{ {
AdditionalWindow = new BrowserWindowSettings(); AdditionalWindow = new WindowSettings();
Filter = new BrowserFilterSettings(); Filter = new FilterSettings();
MainWindow = new BrowserWindowSettings(); MainWindow = new WindowSettings();
Proxy = new BrowserProxySettings(); Proxy = new ProxySettings();
} }
} }
} }

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser.Filter
{ {
/// <summary> /// <summary>
/// Defines all possible results of a request filter operation. /// Defines all possible results of a request filter operation.

View file

@ -8,7 +8,7 @@
using System; using System;
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser.Filter
{ {
/// <summary> /// <summary>
/// Defines the settings for a request filter rule. /// Defines the settings for a request filter rule.

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser.Filter
{ {
/// <summary> /// <summary>
/// Defines all possible filter rule types. /// Defines all possible filter rule types.

View file

@ -8,6 +8,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser
{ {
@ -15,7 +16,7 @@ namespace SafeExamBrowser.Settings.Browser
/// Defines all settings for the request filter of the browser. /// Defines all settings for the request filter of the browser.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class BrowserFilterSettings public class FilterSettings
{ {
/// <summary> /// <summary>
/// Defines whether content requests for a web page should be filtered according to the defined <see cref="Rules"/>. /// Defines whether content requests for a web page should be filtered according to the defined <see cref="Rules"/>.
@ -32,7 +33,7 @@ namespace SafeExamBrowser.Settings.Browser
/// </summary> /// </summary>
public IList<FilterRuleSettings> Rules { get; set; } public IList<FilterRuleSettings> Rules { get; set; }
public BrowserFilterSettings() public FilterSettings()
{ {
Rules = new List<FilterRuleSettings>(); Rules = new List<FilterRuleSettings>();
} }

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2019 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;
namespace SafeExamBrowser.Settings.Browser.Proxy
{
/// <summary>
/// Defines the configuration of a proxy server.
/// </summary>
[Serializable]
public class ProxyConfiguration
{
/// <summary>
/// The host name or IP address of the proxy server.
/// </summary>
public string Host { get; set; }
/// <summary>
/// The password to be used for authentication.
/// </summary>
public string Password { get; set; }
/// <summary>
/// The port of the proxy server.
/// </summary>
public int Port { get; set; }
/// <summary>
/// The protocol of the proxy server.
/// </summary>
public ProxyProtocol Protocol { get; set; }
/// <summary>
/// Determines whether the proxy server requires authentication.
/// </summary>
public bool RequiresAuthentication { get; set; }
/// <summary>
/// The username to be used for authentication.
/// </summary>
public string Username { get; set; }
}
}

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser.Proxy
{ {
/// <summary> /// <summary>
/// Defines all currently supported proxy policies for the browser. /// Defines all currently supported proxy policies for the browser.
@ -14,12 +14,12 @@ namespace SafeExamBrowser.Settings.Browser
public enum ProxyPolicy public enum ProxyPolicy
{ {
/// <summary> /// <summary>
/// Use custom proxy settings as defined in <see cref="BrowserProxySettings"/>. /// Use custom proxy settings as defined in <see cref="ProxySettings"/>.
/// </summary> /// </summary>
Custom, Custom,
/// <summary> /// <summary>
/// Use the proxy settings of the operating system (i.e. ignore all custom settings defined in <see cref="BrowserProxySettings"/>). /// Use the proxy settings of the operating system (i.e. ignore all custom settings defined in <see cref="ProxySettings"/>).
/// </summary> /// </summary>
System System
} }

View file

@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser.Proxy
{ {
/// <summary> /// <summary>
/// Defines all protocols currently supported for proxies. /// Defines all protocols currently supported for proxies.

View file

@ -7,43 +7,51 @@
*/ */
using System; using System;
using System.Collections.Generic;
using SafeExamBrowser.Settings.Browser.Proxy;
namespace SafeExamBrowser.Settings.Browser namespace SafeExamBrowser.Settings.Browser
{ {
/// <summary> /// <summary>
/// Defines the settings for a proxy server. /// Defines the proxy settings for the browser engine.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class ProxySettings public class ProxySettings
{ {
/// <summary> /// <summary>
/// The host name or IP address of the proxy server. /// Determines whether proxy auto-configuration should be used. Requires a valid URL defined in <see cref="AutoConfigureUrl"/>.
/// </summary> /// </summary>
public string Host { get; set; } public bool AutoConfigure { get; set; }
/// <summary> /// <summary>
/// The password to be used for authentication. /// A valid URL to a proxy auto-configuration file (.pac). Is only evaluated if <see cref="AutoConfigure"/> is enabled.
/// </summary> /// </summary>
public string Password { get; set; } public string AutoConfigureUrl { get; set; }
/// <summary> /// <summary>
/// The port of the proxy server. /// Forces proxy auto-detection by the browser engine.
/// </summary> /// </summary>
public int Port { get; set; } public bool AutoDetect { get; set; }
/// <summary> /// <summary>
/// The protocol of the proxy server. /// A list of hosts for which all proxy settings should be bypassed.
/// </summary> /// </summary>
public ProxyProtocol Protocol { get; set; } public IList<string> BypassList { get; set; }
/// <summary> /// <summary>
/// Determines whether the proxy server requires authentication. /// The proxy policy to be used.
/// </summary> /// </summary>
public bool RequiresAuthentication { get; set; } public ProxyPolicy Policy { get; set; }
/// <summary> /// <summary>
/// The username to be used for authentication. /// Defines all proxies to be used.
/// </summary> /// </summary>
public string Username { get; set; } public IList<ProxyConfiguration> Proxies { get; set; }
public ProxySettings()
{
BypassList = new List<string>();
Proxies = new List<ProxyConfiguration>();
}
} }
} }

View file

@ -11,7 +11,7 @@ namespace SafeExamBrowser.Settings.Browser
/// <summary> /// <summary>
/// Defines the initial position of a browser window. /// Defines the initial position of a browser window.
/// </summary> /// </summary>
public enum BrowserWindowPosition public enum WindowPosition
{ {
Left, Left,
Center, Center,

View file

@ -14,7 +14,7 @@ namespace SafeExamBrowser.Settings.Browser
/// Defines all settings for a window of the browser engine. /// Defines all settings for a window of the browser engine.
/// </summary> /// </summary>
[Serializable] [Serializable]
public class BrowserWindowSettings public class WindowSettings
{ {
/// <summary> /// <summary>
/// Optionally defines the height of the browser window in physical pixels. /// Optionally defines the height of the browser window in physical pixels.
@ -59,7 +59,7 @@ namespace SafeExamBrowser.Settings.Browser
/// <summary> /// <summary>
/// Determines the initial position of the browser window (if it is not maximized). /// Determines the initial position of the browser window (if it is not maximized).
/// </summary> /// </summary>
public BrowserWindowPosition Position { get; set; } public WindowPosition Position { get; set; }
/// <summary> /// <summary>
/// Optionally defines the height of the browser window as percentage of the working area height. /// Optionally defines the height of the browser window as percentage of the working area height.

View file

@ -57,18 +57,18 @@
<Compile Include="Applications\ApplicationSettings.cs" /> <Compile Include="Applications\ApplicationSettings.cs" />
<Compile Include="Applications\BlacklistApplication.cs" /> <Compile Include="Applications\BlacklistApplication.cs" />
<Compile Include="Applications\WhitelistApplication.cs" /> <Compile Include="Applications\WhitelistApplication.cs" />
<Compile Include="Browser\BrowserFilterSettings.cs" /> <Compile Include="Browser\FilterSettings.cs" />
<Compile Include="Browser\BrowserSettings.cs" /> <Compile Include="Browser\BrowserSettings.cs" />
<Compile Include="Browser\BrowserWindowPosition.cs" /> <Compile Include="Browser\WindowPosition.cs" />
<Compile Include="Browser\BrowserWindowSettings.cs" /> <Compile Include="Browser\WindowSettings.cs" />
<Compile Include="Browser\FilterResult.cs" /> <Compile Include="Browser\Filter\FilterResult.cs" />
<Compile Include="Browser\FilterRuleSettings.cs" /> <Compile Include="Browser\Filter\FilterRuleSettings.cs" />
<Compile Include="Browser\FilterRuleType.cs" /> <Compile Include="Browser\Filter\FilterRuleType.cs" />
<Compile Include="Browser\PopupPolicy.cs" /> <Compile Include="Browser\PopupPolicy.cs" />
<Compile Include="Browser\ProxyPolicy.cs" /> <Compile Include="Browser\Proxy\ProxyPolicy.cs" />
<Compile Include="Browser\BrowserProxySettings.cs" />
<Compile Include="Browser\ProxyProtocol.cs" />
<Compile Include="Browser\ProxySettings.cs" /> <Compile Include="Browser\ProxySettings.cs" />
<Compile Include="Browser\Proxy\ProxyProtocol.cs" />
<Compile Include="Browser\Proxy\ProxyConfiguration.cs" />
<Compile Include="ConfigurationMode.cs" /> <Compile Include="ConfigurationMode.cs" />
<Compile Include="KioskMode.cs" /> <Compile Include="KioskMode.cs" />
<Compile Include="Logging\LogLevel.cs" /> <Compile Include="Logging\LogLevel.cs" />

View file

@ -34,7 +34,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
private IText text; private IText text;
private WindowClosingEventHandler closing; private WindowClosingEventHandler closing;
private BrowserWindowSettings WindowSettings private WindowSettings WindowSettings
{ {
get { return isMainWindow ? settings.MainWindow : settings.AdditionalWindow; } get { return isMainWindow ? settings.MainWindow : settings.AdditionalWindow; }
} }
@ -310,13 +310,13 @@ namespace SafeExamBrowser.UserInterface.Desktop
switch (WindowSettings.Position) switch (WindowSettings.Position)
{ {
case BrowserWindowPosition.Left: case WindowPosition.Left:
Left = 0; Left = 0;
break; break;
case BrowserWindowPosition.Center: case WindowPosition.Center:
Left = (SystemParameters.WorkArea.Width / 2) - (Width / 2); Left = (SystemParameters.WorkArea.Width / 2) - (Width / 2);
break; break;
case BrowserWindowPosition.Right: case WindowPosition.Right:
Left = SystemParameters.WorkArea.Width - Width; Left = SystemParameters.WorkArea.Width - Width;
break; break;
} }

View file

@ -34,7 +34,7 @@ namespace SafeExamBrowser.UserInterface.Mobile
private IText text; private IText text;
private WindowClosingEventHandler closing; private WindowClosingEventHandler closing;
private BrowserWindowSettings WindowSettings private WindowSettings WindowSettings
{ {
get { return isMainWindow ? settings.MainWindow : settings.AdditionalWindow; } get { return isMainWindow ? settings.MainWindow : settings.AdditionalWindow; }
} }
@ -319,13 +319,13 @@ namespace SafeExamBrowser.UserInterface.Mobile
switch (WindowSettings.Position) switch (WindowSettings.Position)
{ {
case BrowserWindowPosition.Left: case WindowPosition.Left:
Left = 0; Left = 0;
break; break;
case BrowserWindowPosition.Center: case WindowPosition.Center:
Left = (SystemParameters.WorkArea.Width / 2) - (Width / 2); Left = (SystemParameters.WorkArea.Width / 2) - (Width / 2);
break; break;
case BrowserWindowPosition.Right: case WindowPosition.Right:
Left = SystemParameters.WorkArea.Width - Width; Left = SystemParameters.WorkArea.Width - Width;
break; break;
} }