// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.ApplicationModel;
namespace Microsoft.Maui.Platform.Linux.Services;
///
/// Static Browser class providing MAUI-compatible API for opening URLs.
///
public static class Browser
{
private static IBrowser? _browser;
///
/// Gets or sets the browser implementation. Set during app initialization.
///
public static IBrowser Default
{
get => _browser ??= new BrowserService();
set => _browser = value;
}
///
/// Opens the specified URI in the default browser.
///
public static Task OpenAsync(string uri)
{
return Default.OpenAsync(uri);
}
///
/// Opens the specified URI in the default browser with the specified launch mode.
///
public static Task OpenAsync(string uri, BrowserLaunchMode launchMode)
{
return Default.OpenAsync(uri, launchMode);
}
///
/// Opens the specified URI in the default browser.
///
public static Task OpenAsync(Uri uri)
{
return Default.OpenAsync(uri);
}
///
/// Opens the specified URI in the default browser with the specified launch mode.
///
public static Task OpenAsync(Uri uri, BrowserLaunchMode launchMode)
{
return Default.OpenAsync(uri, launchMode);
}
///
/// Opens the specified URI in the default browser with the specified options.
///
public static Task OpenAsync(Uri uri, BrowserLaunchOptions options)
{
return Default.OpenAsync(uri, options);
}
}