Skip to content

Commit ba64639

Browse files
committed
- Added AddExtension, RemoveExtension and GetExtensions methods body
- Added a ChromeExtensionInfo class, that mimic the returned JS values from GetExtensions method (see https://electronjs.org/docs/api/browser-window#browserwindowgetextensions) - GetExtensions return a Dictionary<string, ChromeExtensionInfo>, to respect JS documentation declaration.
1 parent 5157561 commit ba64639

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

ElectronNET.API/BrowserWindow.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,5 +2310,37 @@ public void SetVibrancy(Vibrancy type)
23102310
ContractResolver = new CamelCasePropertyNamesContractResolver(),
23112311
NullValueHandling = NullValueHandling.Ignore
23122312
};
2313+
2314+
/// <summary>
2315+
/// Adds Chrome extension located at path, and returns extension's name.
2316+
/// The method will also not return if the extension's manifest is missing or incomplete.
2317+
/// Note: This API cannot be called before the ready event of the app module is emitted.
2318+
/// </summary>
2319+
/// <param name="path">Path to the Chrome extension</param>
2320+
/// <returns></returns>
2321+
public static string AddExtension(string path)
2322+
{
2323+
throw new NotImplementedException();
2324+
}
2325+
2326+
/// <summary>
2327+
/// Remove Chrome extension with the specified name.
2328+
/// Note: This API cannot be called before the ready event of the app module is emitted.
2329+
/// </summary>
2330+
/// <param name="name">Name of the Chrome extension to remove</param>
2331+
public static void RemoveExtension(string name)
2332+
{
2333+
throw new NotImplementedException();
2334+
}
2335+
2336+
/// <summary>
2337+
/// The keys are the extension names and each value is an object containing name and version properties.
2338+
/// Note: This API cannot be called before the ready event of the app module is emitted.
2339+
/// </summary>
2340+
/// <returns></returns>
2341+
public static Dictionary<string, ChromeExtensionInfo> GetExtensions()
2342+
{
2343+
throw new NotImplementedException();
2344+
}
23132345
}
23142346
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace ElectronNET.API.Entities
6+
{
7+
/// <summary>
8+
/// Provide metadata about the current loaded Chrome extension
9+
/// </summary>
10+
public class ChromeExtensionInfo
11+
{
12+
private string _name;
13+
private string _version;
14+
15+
16+
internal ChromeExtensionInfo(string name, string version)
17+
{
18+
_name = name;
19+
_version = version;
20+
}
21+
22+
/// <summary>
23+
/// Name of the Chrome extension
24+
/// </summary>
25+
public string Name
26+
{
27+
get => _name;
28+
}
29+
30+
/// <summary>
31+
/// Version of the Chrome extension
32+
/// </summary>
33+
public string Version
34+
{
35+
get => _version;
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)