Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions API Draft Review #3409

Merged
merged 38 commits into from
Jun 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
23b39e7
extension API draft
Apr 19, 2023
f0e78ce
Merge branch 'main' into user/xiaqu/extension-api-draft
Apr 19, 2023
a3a7cfe
Environment options property name change
dianaqu Apr 26, 2023
fc4c790
Extension Class method naming change
dianaqu Apr 26, 2023
9e4876a
Typo Fix in ICoreWebView2RemoveCompletedHandler
dianaqu Apr 26, 2023
d82fc73
AddExtension command change
dianaqu Apr 26, 2023
9f6b6bb
AddExtension parameter better naming change
dianaqu Apr 26, 2023
17086e7
AddExtension comment expand with more details
dianaqu Apr 26, 2023
ce84750
CoreWebView2Extension should just be a list
dianaqu Apr 26, 2023
2510b59
Extension Id comment update
dianaqu Apr 26, 2023
360fe26
remove not necessary sample code. add detail comment and links
Apr 26, 2023
c3ff9a9
Change *Extension* to *BrowserExtension*
Apr 26, 2023
b18cee9
resolve merge conflict
Apr 26, 2023
37be3c7
.NET sample code clean up.
Apr 26, 2023
5175f8c
renaming hanlder to {interface}{method} format
Apr 26, 2023
3a0b2ff
add c++ install defualt extension sample. c# sample pending some othe…
Apr 27, 2023
fc07a38
Update extension c# sample using list
Apr 27, 2023
d124657
add install default extension c# sample
Apr 27, 2023
eaa2ea6
style
Apr 27, 2023
f5e088d
break up sample code to different sections
May 1, 2023
e4414d3
Public interface derive from previous public interface.
dianaqu May 1, 2023
abed3a9
Remove API better documentation
dianaqu May 1, 2023
472af64
AddBrowserExtension documentation improvement: scope
dianaqu May 1, 2023
9ad3227
Documentation change on SetIsEnabled
dianaqu May 1, 2023
9a49564
update documentation on option and add/get
May 2, 2023
17e964d
resolve merge confict
May 2, 2023
0c06d34
Install extension on first run short description
dianaqu May 5, 2023
fde8a79
add description. remove message box from installing default extensions
May 5, 2023
a1189cf
async on create environment
May 8, 2023
d989484
Fix sample code await/async problem
May 22, 2023
d24b54f
Documentation and sample code change
May 22, 2023
524e06c
Make sure sample code name and content match for c+++ and c#
May 23, 2023
45954cc
Update doc on add extension
May 23, 2023
fb65fa3
Update documentation to state what happens when extension is removed …
May 24, 2023
dac2155
Update extension install error
May 30, 2023
bdbde19
Doc change
dianaqu Jun 5, 2023
245df84
Doc Change
dianaqu Jun 5, 2023
9258b0d
Update naming and variable type
Jun 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add install default extension c# sample
Diana Qu committed Apr 27, 2023
commit d124657588ec343b1fb79cf6fe7411c503f8e8df
30 changes: 26 additions & 4 deletions specs/Extensions.md
Original file line number Diff line number Diff line change
@@ -286,14 +286,36 @@ void ScriptComponent::RemoveOrDisableExtension(const bool remove)
## .NET and WinRT
```c#
/// Create WebView Environment with option
string m_defaultExtensionId = "123";
string m_defaultExtensionFolderPath = "//Mydrive";
/// Create WebView Environment with option
void CreateEnvironmentWithOption()
{
CoreWebView2EnvironmentOptions options = new CoreWebView2EnvironmentOptions();
options.AreBrowserExtensionsEnabled = true;
CoreWebView2Environment environment = CoreWebView2Environment.CreateAsync(CoreWebView2EnvironmentOptions options: options);
webview.EnsureCoreWebView2Async(environment);
InstallDefaultExtensions();
}
// Install default extension before first navigation
void InstallDefaultExtensions()
{
List<CoreWebView2BrowserExtension> extensionsList = await m_coreWebView2.Profile.GetBrowserExtensionsAsync();
bool found = false;
for (int i = 0; i < extensionsList.Count; ++i)
{
if (extensionsList[i].Id == _defaultExtensionId)
{
// ... Navigate to first page
}
else
{
CoreWebView2Extension extension = await m_coreWebView2.Profile.AddBrowserExtensionAsync(m_defaultExtensionFolderPath);
}
}
}
// Extensions class
@@ -326,7 +348,7 @@ public partial class Extensions : Window
private async System.Threading.Tasks.Task FillViewAsync()
{
List<CoreWebView2Extension> extensionsList = await m_coreWebView2.Profile.GetExtensionsAsync();
List<CoreWebView2BrowserExtension> extensionsList = await m_coreWebView2.Profile.GetBrowserExtensionsAsync();
m_listData.Clear();
for (int i = 0; i < extensionsList.Count; ++i)
@@ -349,7 +371,7 @@ public partial class Extensions : Window
private async System.Threading.Tasks.Task ExtensionsToggleEnabledAsync(object sender, RoutedEventArgs e)
{
ListEntry entry = (ListEntry)ExtensionsList.SelectedItem;
List<CoreWebView2Extension> extensionsList = await m_coreWebView2.Profile.GetExtensionsAsync();
List<CoreWebView2BrowserExtension> extensionsList = await m_coreWebView2.Profile.GetBrowserExtensionsAsync();
bool found = false;
for (int i = 0; i < extensionsList.Count; ++i)
{
@@ -410,7 +432,7 @@ public partial class Extensions : Window
ListEntry entry = (ListEntry)ExtensionsList.SelectedItem;
if (MessageBox.Show("Remove extension " + entry + "?", "Confirm removal", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
List<CoreWebView2Extension> extensionsList = await m_coreWebView2.Profile.GetExtensionsAsync();
List<CoreWebView2BrowserExtension> extensionsList = await m_coreWebView2.Profile.GetBrowserExtensionsAsync();
bool found = false;
for (int i = 0; i < extensionsList.Count; ++i)
{